CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Error during Compiling UDF for Rotor Motion (

deepak.dce06 October 11, 2013 18:51

Error during Compiling UDF for Rotor Motion
I had written a UDF to give motion to udf about a point.
The case is a 2D case.
When I try to compile the udf it gives an error that the UDF is not written for 2D. Could anyone have a look at it.
Appreciate the Help.

#include "udf.h"
#include "stdio.h"
DEFINE_CG_MOTION(ROtor_Motion,dt,vel,omega,time,dt ime)
Thread *tf = DT_THREAD (dt);
face_t f;
Node *v;
real time1, time2, theta1, theta2;
int n;
real CGravity[ND_ND];
real xnew[ND_ND];
real count;
real omega,e;
real trans[ND_ND];


Omega=1047.2; /*angular vel*/
e=0.16; /*eccentricity*/

time1 = time;
time2 = time+dtime;
theta1= time1 * omega; /*whirling angles at two consecutive times*/
theta2= time2 * omega;

trans[0]=e*(cos(theta2)-cos(theta1)); /* change in x & y coordinate*/
trans[1]= e*(sin(theta2)-sin(theta1));

CGravity[0] =0;
CGravity[1] =0;
count =0;
begin_f_loop (f, tf) /*loop to change the position of each node*/
CGravity[0] = CGravity[0]+xnew[0];
CGravity[1] = CGravity[1]+xnew[1];
count = count + 1;
f_node_loop (f, tf, n)
v = F_NODE (f, tf, n);
NV_V (NODE_COORD (v), +=, trans);
end_f_loop (f, tf);
CGravity[0] = CGravity[0]/count;
CGravity[1] = CGravity[1]/count;
Message ("%f %f \n", CGravity[0], CGravity[1]);

deepak.dce06 October 15, 2013 12:51

Anyone with UDF expertise??

All times are GMT -4. The time now is 09:06.