CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF: DEFINE_CG_MOTION for vertical jump motion of an electrode!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 10, 2009, 09:56
Default UDF: DEFINE_CG_MOTION for vertical jump motion of an electrode!
  #1
New Member
 
Join Date: Jun 2009
Posts: 1
Rep Power: 0
alban is on a distinguished road
Hello everybody,


I have to create a DEFINE_CG_MOTION udf for my 2D CFD model (Fluent 6.3).
It consists in one electrode (rectangular shape) which just translate verticaly (y-direction) into a cavity of the same shape (the move looks like a jump like a piston in a cylinder, with no rotation !).
I want to describe the jump in function of the flow-time « tm » , with a sine function, where i can play on two parameters, the magnitude « h » of the jump and the its duration « t » (return in the down position).
This UDF will allow me to use dynamic mesh, and layering to study the hydrodynamic of the fluid between the electrode and the cavity hole during the jump (there is a small gap into this space...)


With the several CG_MOTION udf exemples i have found on the net i have wrote this but it doesnt work !!!

I NEED YOUR HELP !!!

(I’d like to work with this UDF on parallel processing (2 cores of my laptop), should I have to add some commands in my UDF or not ???)

I thank you so much…for the help and the time you have spend for me :-)

------------------------------------------------------------------------------------------------
#include <udf.h>
#include "dynamesh_tools.h"

/*I lock the five others degree of freedom that i am not using for the jump*/
static real v_x=0.0, v_z=0.0, omega_x=0.0, omega_y=0.0, omega_z=0.0;

DEFINE_CG_MOTION(jump_electrode, dt, vel, omega, time, dtime)
{
Thread *tf=t;
face_t f;


real t=0.5 /*Height of the jump*/
real h=0.05 /*Duration of the jump*/
real tm=RP_Get_Real("flow-time")

/* speed initialisation */
NV_S (vel, =, 0.0); /*I don’t know if it is useful to write these lines in my case*/
NV_S (omega, =, 0.0);

/* error message */
if (!Data_Valid_P ())
{
Message("Not good at all!\n")
return;
}

/* jump kinematic function */
vel[1] = (h*3.1415*2/t)*cos((3.1415*tm*2/t)-3.1415/2); /*in the y direction*/

/* Displaying */
Message("\ntime=%f, y=%f, Vy=%f",time,x_cg[1],vel[1]);
return
}
---------------------------------------------------------------------------------
there is the error message i receved before the fatal error... i don't really understand how to avoid it... maybe it can help you



..\..\src\cinematique2.c(8) : error C2065: 't' : undeclared identifier
..\..\src\cinematique2.c(8) : warning C4047: 'initializing' : 'struct thread_struct *' differs in levels of indirection from 'int '
..\..\src\cinematique2.c(10) : error C2065: 'x_cg' : undeclared identifier
..\..\src\cinematique2.c(10) : error C2109: subscript requires array or pointer type
..\..\src\cinematique2.c(12) : error C2275: 'real' : illegal use of this type as an expression
c:\fluent.inc\fluent6.3.26\src\global.h(158) : see declaration of 'real'
..\..\src\cinematique2.c(12) : error C2146: syntax error : missing ';' before identifier 't'
..\..\src\cinematique2.c(13) : error C2146: syntax error : missing ';' before identifier 'real'
..\..\src\cinematique2.c(13) : error C2275: 'real' : illegal use of this type as an expression
c:\fluent.inc\fluent6.3.26\src\global.h(158) : see declaration of 'real'
..\..\src\cinematique2.c(13) : error C2146: syntax error : missing ';' before identifier 'h'
..\..\src\cinematique2.c(13) : error C2065: 'h' : undeclared identifier
..\..\src\cinematique2.c(14) : error C2146: syntax error : missing ';' before identifier 'real'
..\..\src\cinematique2.c(14) : error C2275: 'real' : illegal use of this type as an expression
c:\fluent.inc\fluent6.3.26\src\global.h(158) : see declaration of 'real'
..\..\src\cinematique2.c(14) : error C2146: syntax error : missing ';' before identifier 'tm'
..\..\src\cinematique2.c(14) : error C2065: 'tm' : undeclared identifier
..\..\src\cinematique2.c(17) : error C2064: term does not evaluate to a function
..\..\src\cinematique2.c(24) : error C2143: syntax error : missing ';' before 'return'
..\..\src\cinematique2.c(31) : error C2109: subscript requires array or pointer type
..\..\src\cinematique2.c(33) : error C2143: syntax error : missing ';' before '}'
(system "copy c:\fluent.inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\2d_node\makefile")
1 fichier(s) copi‚(s).
(chdir "libudf")()
(chdir "ntx86\2d_node")()
cinematique2.c
..\..\src\cinematique2.c(8) : error C2065: 't' : undeclared identifier
..\..\src\cinematique2.c(8) : warning C4047: 'initializing' : 'struct thread_struct *' differs in levels of indirection from 'int '
..\..\src\cinematique2.c(10) : error C2065: 'x_cg' : undeclared identifier
..\..\src\cinematique2.c(10) : error C2109: subscript requires array or pointer type
..\..\src\cinematique2.c(12) : error C2275: 'real' : illegal use of this type as an expression
c:\fluent.inc\fluent6.3.26\src\global.h(158) : see declaration of 'real'
..\..\src\cinematique2.c(12) : error C2146: syntax error : missing ';' before identifier 't'
..\..\src\cinematique2.c(13) : error C2146: syntax error : missing ';' before identifier 'real'
..\..\src\cinematique2.c(13) : error C2275: 'real' : illegal use of this type as an expression
c:\fluent.inc\fluent6.3.26\src\global.h(158) : see declaration of 'real'
..\..\src\cinematique2.c(13) : error C2146: syntax error : missing ';' before identifier 'h'
..\..\src\cinematique2.c(13) : error C2065: 'h' : undeclared identifier
..\..\src\cinematique2.c(14) : error C2146: syntax error : missing ';' before identifier 'real'
..\..\src\cinematique2.c(14) : error C2275: 'real' : illegal use of this type as an expression
c:\fluent.inc\fluent6.3.26\src\global.h(158) : see declaration of 'real'
..\..\src\cinematique2.c(14) : error C2146: syntax error : missing ';' before identifier 'tm'
..\..\src\cinematique2.c(14) : error C2065: 'tm' : undeclared identifier
..\..\src\cinematique2.c(17) : error C2064: term does not evaluate to a function
..\..\src\cinematique2.c(24) : error C2143: syntax error : missing ';' before 'return'
..\..\src\cinematique2.c(31) : error C2109: subscript requires array or pointer type
..\..\src\cinematique2.c(33) : error C2143: syntax error : missing ';' before '}'
-----------------------------------------------------
THANKS AGAIN FOR THE HELP
alban is offline   Reply With Quote

Old   May 28, 2010, 16:31
Exclamation
  #2
New Member
 
iman
Join Date: Oct 2009
Posts: 9
Rep Power: 17
iman_1844 is on a distinguished road
it has many errors,

please describe your final target
iman_1844 is offline   Reply With Quote

Old   June 8, 2010, 19:54
Default
  #3
Member
 
alliche redha
Join Date: Jun 2010
Posts: 53
Rep Power: 16
cheredha is on a distinguished road
http://www.cfd-online.com/Forums/flu...ique-mesh.html
cheredha is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 08:37
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
fluent probelm"mesh motion udf" bestrcsekhar Main CFD Forum 0 November 2, 2008 02:38
UDF error CG Motion Alex FLUENT 0 March 22, 2006 18:40
UDF, back and forth motion Young O'Nel FLUENT 0 January 19, 2006 00:42


All times are GMT -4. The time now is 23:45.