CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   udf help..... (https://www.cfd-online.com/Forums/fluent/46991-udf-help.html)

Ken January 11, 2008 09:13

udf help.....
 
hi everyone, i was trying to write an equation into udf but what i got is line 1 parse error... i am new to fluent and the udf thing, so here is my equation,

u=170 * (1 + tanh((25-y)/2.25))

and the udf i worte is based on the tutorial file i found in fluent.... here is the udf i wrote...

DEFINE_PROFILE(mass_flow_velocity,thread,index)

{

real x[ND_ND];

real y;

face_t f;

begin_f_loop(f,thread)

{

F_CENTROID(x,f,thread);

y = x[1];

F_PROFILE(f,thread,index) = 170.*(1.+tanh((25.-y)/2.25));

}

end_f_loop(f,thread)

}

can anyone correct it for me??

thanks alot...

al_c January 11, 2008 10:10

Re: udf help.....
 
At the beginning of every UDF you write must be

#include "udf.h"


Ken January 11, 2008 10:15

Re: udf help.....
 
thanks for the advise~~

but it still comes out with the 'line 1: parse error'...

would it be something wrong with my udf itself?...wrong command or so..?

al_c January 11, 2008 11:24

Re: udf help.....
 
I think, your udf is correct, only #include "udf.h" is missing. What operator do you have at line 1 after you add #include 'udf.h'? Do you use interpreted or compiled UDF?


Ken Lau January 11, 2008 12:58

Re: udf help.....
 
what do you mean by operator?

i actually havent got anything after line 1, just as it is in my shown udf...

i used interpreted udf~~

al_c January 11, 2008 14:27

Re: udf help.....
 
Here is the corrected udf - first line is #include "udf.h" :

#include "udf.h"

DEFINE_PROFILE(mass_flow_velocity,thread,index)

{

real x[ND_ND];

real y;

face_t f;

begin_f_loop(f,thread)

{

F_CENTROID(x,f,thread);

y = x[1];

F_PROFILE(f,thread,index) = 170.*(1.+tanh((25.-y)/2.25));

}

end_f_loop(f,thread)

}

Ken Lau January 11, 2008 15:13

Re: udf help.....
 
thanks alot, finally it works!!!!

thank you for your help^^


All times are GMT -4. The time now is 22:03.