CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF error (https://www.cfd-online.com/Forums/fluent-udf/93139-udf-error.html)

colopolo October 6, 2011 04:02

UDF error
 
Hi all,

I interpreted the below udf file in Fluent.
I got parse error during interpreting.


cpp -I"C:\Fluent.Inc\fluent6.3.26/src" -I"C:\Fluent.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent.Inc\fluent6.3.26/client/src" -I"C:\Fluent.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<udfconfig.h>" "E:\Gambit\1106VIV01\motion.c"
Error: E:\Gambit\1106VIV01\motion.c: line 3: parse error.

I could not find what is wrong with udf file.

Please leave any comments on this problem.


#include "udf.h"

static real v_prev = 0.0;

DEFINE_CG_MOTION(osc,dt,vel,omega,time,dtime)
{
Thread *t;
Domain *d = Get_Domain(1);
real x_cg[3], force[3], moment[3];
real accl, dv;
real mass = 0.2;
real wn = 12.0;
real k= mass * wn*wn;
real c = 2*mass*wn*0.00;
int i;

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
t = DT_THREAD(dt);
for(i=0;i<3;i++)
x_cg[i]=DT_CG(dt)[i];

Compute_Force_And_Moment(d, t, x_cg, force, moment, TRUE);
force[1] += -k*x_cg[1] - c*vel[1];

accl = force[1]/mass;
dv = accl*dtime;
v_prev+=dv;
vel[1] = v_prev;
printf("Computed force: %g \n", force[1]);
printf("Velocity: %g\n", vel[1]);
}

m2montazari October 6, 2011 15:11

hi,
as the error says, the problem is with line 3. and in the udf you've post, definition of v_prev is the problem. try normal real(not static) definition. maybe fluent has some problems with static parameters!? then try renaming v_prev to vprev. all the things that could make problem is these two!
nothing else....
yours,
mohammad

Amir October 6, 2011 15:23

Hi,
You cannot interpret such UDFs even if you will solve error (line 3). You have to compile it.

Bests,

m2montazari October 6, 2011 15:59

hi,
I agree with amir.

colopolo October 6, 2011 19:33

Thank you guys.


All times are GMT -4. The time now is 20:42.