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/104989-udf-error.html)

Prince of Persia July 20, 2012 02:07

UDF Error
 
Hi,

I'm trying to create a tranverse velocity profile UDF to use it as velocity inlet boundary condition to simulate flow in a water tank. The UDF is as follows:
#include "udf.h"
DEFINE_PROFILE(inlet_x_velocity,thread,index)
{
real x[ND_ND]; /* this will hold the position vector*/
real z;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z=x[2];
if (0.1<z<0.4)
F_PROFILE(f,thread,index) =0.063*pow((z/(0.1)),0.21)
else
F_PROFILE(f,theard,index)=log((z/(0.8))*0.15/0.41
}
end_f_loop(f,thread)
}

i got the following error when trying to interpret my Velocity2.c file in fluent:
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>" "C:\Users\amir\Desktop\Velocity2.c"
Error: C:\Users\amir\Desktop\Velocity2.c: line 13: parse error.

Thanks in advance!

flotus1 July 20, 2012 02:42

Typo...

F_PROFILE(f,theard,index)=log((z/(0.8))*0.15/0.41

Prince of Persia July 20, 2012 03:18

thanks my friend...
my problem is not solved yet!!!!!!!!!

flotus1 July 20, 2012 03:31

Try using some ";" at the end of lines

Prince of Persia July 20, 2012 03:56

it doesn't work!!!

#include "udf.h"
DEFINE_PROFILE(inlet_x_velocity,thread,index)
{
real x[ND_ND]; /* this will hold the position vector*/
real z;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread)
z=x[2];
if (0.1<z<0.4)
F_PROFILE(f,thread,index) =0.063*pow((z/(0.1)),0.21);
else
F_PROFILE(f,thread,index)=log((z./(0.8)).*(0.15./0.41);
}
end_f_loop(f,thread)
}

flotus1 July 20, 2012 07:52

Did you copy parts of the UDF from the manual?

Then it contains "invisible" signs which prevent the UDF from being interpreted properly.

akm July 23, 2012 13:49

if (z > 0.1 && z < 0.4) ...


All times are GMT -4. The time now is 10:12.