CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   syntax error when interpreting UDF (https://www.cfd-online.com/Forums/fluent/42391-syntax-error-when-interpreting-udf.html)

Erik September 26, 2006 08:14

syntax error when interpreting UDF
 
I have a problem when I interprete a UDF in Fluent. I think my C source code is correct, but when interpreting I get a syntax error in line 2.

My C source code is:

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

DEFINE_PROFILE(inlet_velocity,t,i)

{

float x[3]; /* this will hold the position vector */

float z; /* define z as a floating Data Type */

face_t f;

begin_f_loop(f, t) /* Loop over all faces in the thread passed in the DEFINE macro argument */

{

F_CENTROID(x,f,t);

z = x[3];

if (z <= 0.0143)

{

F_PROFILE(f, t, i) = 5.0 * (double power(z/0.0143, 1.0/7.0));

}

else

{

F_PROFILE(f, t, i) = 5.0

}

}

end_f_loop(f,t)

}

I hope somebody can help me with this problem.

Ahmed September 26, 2006 20:51

Re: syntax error when interpreting UDF
 
Try writting the first line as #include <udf.h>

Erik September 27, 2006 02:59

Re: syntax error when interpreting UDF
 
That doesn't seem to work. But thank you for your response

cadaei September 27, 2006 07:52

Re: syntax error when interpreting UDF
 
I have modified it a little and it compiles.

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

DEFINE_PROFILE(inlet_velocity,t,i)

{

real x[3]; /* this will hold the position vector */

real z; /* define z as a floating Data Type */

face_t f;

begin_f_loop(f, t) /* Loop over all faces in the thread passed in the DEFINE macro argument */

{

F_CENTROID(x,f,t);

z = x[2];

if (z <= 0.0143)

{

F_PROFILE(f, t, i) = 5.0 * (pow(z/0.0143, 1.0/7.0));

}

else

{

F_PROFILE(f, t, i) = 5.0;

}

}

end_f_loop(f,t)

}


All times are GMT -4. The time now is 07:25.