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/)
-   -   Error udf - define_profile (https://www.cfd-online.com/Forums/fluent-udf/122000-error-udf-define_profile.html)

Mr.H August 9, 2013 16:58

Error udf - define_profile
 
Hi everybody,

I'm trying to interpreted an UDF-file but from fluent I get error all the time. It writes this error:

Error: C:\BFS_channel\inlet_z_velocity.c: line 1: parse error.


My UDF file looks like this:

#include "udf.h"
#define DELTA 0.003 /*thickness of boundary layer [m]*/
#define W 20. /*velocity in free streem [m/s]*/
#define P 1./7. /*exponent of power*/
DEFINE_PROFILE(inlet_z_velocity,thread,position)
{
real x [ND_ND], b;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
b=x[1];
if (b <= DELTA)
{
F_PROFILE(f,thread,position)=W*pow(b/DELTA,b);
}
else
{
F_PROFILE(f,thread,position)=W
}
}
end_f_loop(f,thread)
}

Can anybody help me please? I think I tried everything what I know and still can't find parse error in 1st line.

Thank you for your help

Best regards H.

blackmask August 12, 2013 00:56

You missed a semicolon at the end of
Code:

F_PROFILE(f,thread,position)=W;
but otherwise the code seems to be OK. Try to create a new text file, copy&paste the code to that file and try to re-compile that file.

Mr.H August 12, 2013 11:28

Thank you for your answer but it doesn't work anyway. So i think I will do it in CFX it will be much easier.

alireza9359300 August 14, 2013 07:01

I tested this code and worked
---------------------------------------
#include "udf.h"
#define DELTA 0.003 /*thickness of boundary layer [m]*/
#define W 20. /*velocity in free streem [m/s]*/
#define P 1./7. /*exponent of power*/
DEFINE_PROFILE(inlet_z_velocity,thread,position)
{
real x [ND_ND], b;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
b=x[1];
if (b <= DELTA)
F_PROFILE(f,thread,position)=W*pow(b/DELTA,b);
else
F_PROFILE(f,thread,position)=W;
}
end_f_loop(f,thread)
}
---------------------------------------------
when you are using (if) doesn't need {{}}


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