CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF for 3-Dimensional geometry (

vimal January 1, 2004 02:49

UDF for 3-Dimensional geometry
I want to write a UDF for parabolic velocity proifles for flow in a 3-Dimensional pipe. Can any one suggest me.

ap January 2, 2004 17:26

Re: UDF for 3-Dimensional geometry
It's just the same as in 2D. Write the equation of the paraboloid which represents your profile.

Suppose your flow is oriented along the z axiz. Center the inlet with the origin of your reference system. Your profile will assume the simple form:

z = a*x^2 + b*y^2 + c

Use the macro F_CENTROID to retrieve the cell centroid coordinates, with a line like the following:


where x is an array of dimension ND_ND, f is the face and t the thread. Then, you can put

x = x[0];

y = x[1];

and use

F_PROFILE(f, t, i) = a*pow(x,2) + b*pow(y,2) + c;

replacing a, b and c with their values.

Hi :)


co2 January 5, 2004 14:09

Re: UDF for 3-Dimensional geometry

why do you put Hi :)

at the end of your message?

ap January 8, 2004 11:09

Re: UDF for 3-Dimensional geometry
Just a nice and short way to say "Hello and good work". A smile always helps.

Hi :)


hatta January 8, 2004 15:50

Re: UDF for 3-Dimensional geometry
Hi everyone,

Suppose i am using the velocity at the inlet of the st. pipe is 0.45 m/s. The ID of the tube is 0.0102 m, by using these values i made a UDF for 3D as

#include "udf.h"

DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y,z; face_t f;

begin_f_loop(f, thread)



y = x[0];

z = x[1]; F_PROFILE(f,thread,position)=0.45-y*y/(.0051*.0051)*0.45-z*z/(.0051*.0051)*0.45;

} end_f_loop(f, thread) }

when is read the velocity at the inlet of the tube it shows 2400 m/s. there is somthing wrong, can you please suggest me what is wrong here.

ap January 8, 2004 19:51

Re: UDF for 3-Dimensional geometry
If your velocity profile is function of y and z coordinates, these two lines are wrong:

y = x[0];

z = x[1];

The x vector contains in the order x,y,z coordinates. So:

x[0] -> x coordinate

x[1] -> y coordinate

x[2] -> z coordinate

To check the paraboloid equation, just plot it in a softwnare like gnuplot.

Hi :)


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