CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   how can i use multiple udfs (

hami9293 February 23, 2010 02:35

how can i use multiple udfs
Hello every body
as a amateur user of fluent i have a problem
when i want to define multiple udf in my case file, my last defined udfs disappeared.
How can use multiple udfs in one case file?

thank you.

Goldsstean February 23, 2010 02:51

Re: how can i use multiple udfs
Write all the udf inside same header file for e.g

#include "udf.h"





So on...

hami9293 February 23, 2010 03:09

#include "udf.h"
my udf is so:

DEFINE_PROFILE(inlet, thread, position)

real pi = 3.1459 ;
real P0 = 11208 ;

face_t f;
real t = CURRENT_TIME;

begin_f_loop(f, thread)
t = t - floor(t) ;
if ( t>=0.5 )
F_PROFILE(f, thread, position) = P0*sin(pi*t);
F_PROFILE(f, thread, position) = P0*(1.5 - 0.5*cos(2*pi(t-0.5)));
end_f_loop(f, thread)

should i change it ?

Goldsstean February 23, 2010 03:13

Could you explain what you want to do.

hami9293 February 23, 2010 03:19

I have a pipe that has one inlet and four outlet.
the boundary condition for the inlet and outlet in transient pressure.
my udf is this transient pressure.
now when I interpret the pressure that is used for e.g. out 2 the last interpreted udfs has disappeared.

Goldsstean February 23, 2010 03:25

Correct me if im wrong, you would like to give profile to inlet and outlet too. then this udf will not work write separate udf.

If not try to compile and hook.

hami9293 February 23, 2010 03:34

let me explain more.

I have 5 different udfs for five boundaries . when i define e.g the third one , the two last defined udfs disappeared . ( i mean when i want to specify the boundary condition of the boundaries instead of 5 different udf i just have one .)

Goldsstean February 23, 2010 04:39

Where are the five udf above only you are showing one?

If you have five udf means write in same file.

hami9293 February 23, 2010 04:45

there are almost the same with a few differences in the formula of the pressure . I have written the first udf that is for inlet

Goldsstean February 23, 2010 04:47

Yes exactly, the whatever answer i have given first that is true.

Put all udf in same file.c ok

Goldsstean February 23, 2010 04:51

For eg

#include "udf.h"

DEFINE_PROFILE(inlet1, thread, position)

your programe;

DEFINE_PROFILE(inlet2, thread, position)

your programe;

DEFINE_PROFILE(inlet3, thread, position)

your programe;
DEFINE_PROFILE(inlet4, thread, position)

your programe;
DEFINE_PROFILE(inlet5, thread, position)

your programe;

Save the file and interprete you will see all the profile and select respectively for the inlet.

ok thanks I have work c u

hami9293 February 23, 2010 07:20

Thank your lucky stars.
Really thank you for your kind helps .
c u later.

mmunige June 5, 2016 21:09

nested if statement in udf
Respected members

I am using udf for defining transient temperature at inlet boundary of my model in fluent. I am writing nested if statement, but model keeps on using the same equation after 180 seconds, and does not move to the next if else statement. My udf is as follows:


DEFINE_PROFILE(inlet_temperature,thread,position )

face_t f;


real t = RP_Get_Real("flow-time");

if ( t <= 100.0 )

F_PROFILE(f,thread,position) = 379.48 + 0.0004*t;

else if (100.0 < t <= 180.0 )

F_PROFILE(f,thread,position) = 1.0624*t + 352.0;

else if (180.0 < t <= 200.0 )

F_PROFILE(f,thread,position) = 0.2716*t + 494.4;

else if (200.0 < t <= 400.0 )
F_PROFILE(f,thread,position) = 328.14*pow(t,0.097);
F_PROFILE(f,thread,position) = 727.82;


sorry for my poor knowledge of programming.
please help me on this error.

All times are GMT -4. The time now is 13:38.