CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   interpreted UDF (https://www.cfd-online.com/Forums/fluent/30366-interpreted-udf.html)

James October 8, 2002 03:10

interpreted UDF
 
I compiled the UG example on DEFINE_CG_MOTION

/************************************************** ********** * * 1-degree of freedom equation of motion (x-direction) * ************************************************** **********/

#include "udf.h"

#include "dynamesh_tools.h"

static real v_prev = 0.0;

DEFINE_CG_MOTION(piston, dt, vel, omega, time, dtime)

{

Thread *t;

face_t f;

real NV_VEC (A);

real force, dv;

/* reset velocities */

NV_S (vel, =, 0.0);

NV_S (omega, =, 0.0);

if (!Data_Valid_P ())

return;

/* get the thread pointer for which this motion is defined */

t = DT_THREAD ((Dynamic_Thread *)dt);

/* compute pressure force on body by looping through all faces */

force = 0.0;

begin_f_loop (f, t)

{

F_AREA (A, f, t);

force += F_P (f, t) * NV_MAG (A);

}

end_f_loop (f, t)

/* compute change in velocity, i.e., dv = F * dt / mass

velocity update using explicit euler formula */

dv = dtime * force / 50.0;

v_prev += dv;

Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev, force);

/* set x-component of velocity */

vel[0] = v_prev;

}

I interpreted it in order to have it in my dynamic mesh udf panel but the interpretation failed and the message is :

/usr/local/Fluent.Inc/contrib/lnx86/cpp -I/usr/local/Fluent.Inc/fluent6.0/src -I/usr/local/Fluent.Inc/fluent6.0/cortex/src -I/usr/local/Fluent.Inc/fluent6.0/client/src -I/usr/local/Fluent.Inc/fluent6.0/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" /home/memoire/jaj/tenplus/libudf/lnx86/2d/piston.c Error: /home/memoire/jaj/tenplus/libudf/lnx86/2d/piston.c: line 10: parse error.

Can anyone tell me what is the problem ??

thanks

james

Alexandre October 8, 2002 08:56

Re: interpreted UDF
 
you must compile it since static values cannot be used with interpreted udfs

James October 8, 2002 09:32

Re: interpreted UDF
 
I rewrote the udf file and it worked thanks


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