CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   parse error in transient udf (

spring July 5, 2010 10:32

parse error in transient udf
Hey guys,

when I try to interprete the following transient udf, I always get two parse errors.

Here is my UDF:

#include "udf.h" /* must be at the beginning of every UDF */

/* constants: */
#define R 8. /* inlet radius [mm] (with actual scaling in Fluent applied!) */
#define VFLOW 15. /* effective volume flow [l/min] */
#define POWER 1./7. /* 1/7 power law defining turbulent profile */
#define f 15. /* breathing frequency */
#define tidal 0.5 /* tidal volume */

double PI;
real Umax; /* maximal inlet velocity */
real x[ND_ND]; /* this will hold the position vector every single face centroid */
real r;
real U;
real breath;
face_t f;

real t = CURRENT_TIME;

PI = acos(-1.);
Umax = pow(10.,3.)*VFLOW/PI/pow((R),2.)/49.;
breath = tidal/PI/f*sin(2*PI*f*t);

begin_f_loop(f,thread) /* loops over all faces in the thread passed
in the DEFINE macro argument */
r = sqrt(pow((1000*x[0]),2.)+pow((1000*x[2]),2.));
U = Umax*pow((1.-r/R),POWER);

if (breath > 0.0)
{F_PROFILE(f,thread,index) = U*breath;}
{F_PROFILE(f,thread,index) = 0.0;}

The errors are in the red lines.


Error: \UDFprofile3D_tansient.c: line 26: parse error.
Error: \UDFprofile3D_tansient.c: line 28: parse error.
Error: \UDFprofile3D_tansient.c: line 32: t: undeclared variable

I dont't know how to remove this errors, because I can't find any fault in my udf. But maybe your eyes are better than mine, and you can help me and tell me where my fault is :)
And I dont' think that's a problem caused be interpreting the UDF, because I've made the right steps:
1. activate "transient" under General
2. and interprete the udf as usual; Define->User Defined->Functions->Interpreted

Thank you very much in advance!


spring July 6, 2010 06:26


I've found my errors. I used the variable f twice: once as a frequence and the second time in the expression face_t f. That's once too much, hehe.
I also forgot to ad an f in the expression F_CENTROID(x,thread) ...


All times are GMT -4. The time now is 19:26.