CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   On the Sample UDF in Fluent (

R.D.Prabhu February 22, 2001 11:57

On the Sample UDF in Fluent
Hi I was going through the Fluent supplied 'inlet.c' file to try modifying it for my use.

I reproduce the file below.


#include "udf.h"

DEFINE_PROFILE(inlet_uv_parabolic, thread, np) { face_t f; real x[ND_ND];

begin_f_loop (f,thread)



F_PROFILE(f,thread,np) = -2.1 + 157.5*x[1] - 2625.*x[1]*x[1];

} end_f_loop (f,thread) } ==================================

My question is how does the code know what 'ND_ND' (in x[ND_ND]) is ? ( Is it a global parameter ?)

Or is it something which is already defined in the header file 'udf.h' ?



Greg Perkins February 22, 2001 22:20

Re: On the Sample UDF in Fluent
I think its defined in a header file and depends on whether you have compiled in 2d or 3d - since it represents the number of dimensions. In 3D you have x[0], x[1] and x[2] in 2d only the first two.


R.D.Prabhu February 23, 2001 12:42

Re: On the Sample UDF in Fluent
Thanks Greg,

Probably the moment we start 'fluent 2d/3d' this variable gets fixed ..somewhere..

I have one more query.

I was trying to use two UDFS at two boundary faces in my problem ..say inlet1.c at face 1 and inlet2.c on face 2. I used define/UDFs/interpreted ..each time. I defined the boundary conditions immediately after each UDF that I read and compiled (interpreted).

I found fluent keeps the last UDF that was compiled. Each time I iterate I find the 'first' UDF missing.. The solver says...'function velocity_inlet_w' not found! ( I mean.. the name of the function which I used in the first UDF that I read into fluent.)

How do we supply more than One UDFs to Fluent then ?



Greg Perkins February 23, 2001 20:56

Re: On the Sample UDF in Fluent
In your .c file just put the functions sequentially in the file. Ie all your udfs can be in the one file.

In fact you can spread them across multiple files for the compiled ones if you like.


All times are GMT -4. The time now is 15:46.