CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   outlet pressure (

om1234 May 31, 2010 19:30

outlet pressure
hi all
i'm going to analysis 2d centrifugal outlet line,i try to define static pressure in a single face of grid. i use this udf,but it doesn't work, but when i try to use it with if else ,answers are correct. i myself think that the problem is that the define-profile macro is a array of data and i must define the pressure in all of the cell faces, but i'm not sure.I wish any one can help me.

DEFINE_PROFILE(outlet_p, thread, position)
real x;
real y[ND_ND];
face_t f;

begin_f_loop(f, thread)
if (0.004<x<0.006) /* in this interior there is a face centroid or if (0.004<x & x<0.006)*/
F_PROFILE(f, thread, position) = 1e5;
end_f_loop(f, thread)

O.D.Y. June 1, 2010 03:56


well I guess you are right the F_PROFILE is used to generate profiles of BC.
You could use it to give constant pressure to all faces or any profile.

anyway, I guess you do not assign any value to x like


I would suggest to use DEFINE_ADJUST, it is executed before every iteration and you can directly set the pressure of a face to your desired value.

F_P(f,t) is the function to get the pressure at a face.

om1234 June 1, 2010 04:28

Dear o.d.y.
thanx for your reply
i forgot to write x=y[1] here.i wrote it in original udf.
DEFINE_ADJUST,as i know is used to define some thing in entire cell or face of the mesh,i maen the arg "d" in this macro is refered to all zones and boundary and you can't define a special domain in this macro.
about F_P(f,t),i don't know how this macro is written.and unfortunately i coundn't find any example about it. i will be so thankful if u could help me.

O.D.Y. June 1, 2010 04:44

well DEFINE_ADJUST can be used to assign data to some faces or cells...

the variable d is pointer of type Domain.
This means, that it points to the domain the DEFINE_ADJUST function is applied to.

Nevertheless you should be able to set the value of just some specific cells.
Maybe it works like you have already tried.

It may look like this:

Thread *t;

real x;
real y[ND_ND];
real pressure ;

face_t f;

pressure = 1.e5;

thread_loop_f(t, d)
x = y[0]; /* 0 is the x coordinate */
if (0.004<x<0.006)
F_P(f,t) = pressure;
end_f_loop(f, t)


I didn't test that, its juts an idea of how it MIGHT work.
And please notice that index 0 of y[ND_ND] is the x-coordinate, maybe this already solves your problem.

good luck

om1234 June 1, 2010 06:55

Dear miss/sir
at first i should thank u for ur attention
In define_adjust macro(when hook it via define>user_defined>function hooks>adjust), "d" is refered to whole mesh,and when we hook this udf in fluent, I think that,fluent choose all cells that are in the range of 0.004,0.006, but I want to specify the pressure in one face and in one thread(outlet line). if in this case we consider a interior for y(e.g y=0.225), then the centroid_F macro doesn't work.I dont know if it is true or false that we deal this macro like F_PROFILE and use it in boundary condition(outlet line),nevertheless when i hook it in pressure outlet boundary condition, answers are not correct. pressure value is the same when i specify zero pressure in outlet and i think fluent dont know this macro and going to specify the pressure outlet, zero(it's default value) I've really confused.

outlet pressure is in the range of -7.92e3~6.05e2 like what happened in specifying zero to outlet pressure

O.D.Y. June 1, 2010 07:38

Oh yes, I see...

the DEFINE_ADJUST is for the entire domain and not for the boundaries, what a pitty... Then DEFINE_PROFILE is probably the best choice, but I don't know how to fix the problem at the moment, sorry.

I think I will give it a try myself and see if i can find something out......

om1234 June 1, 2010 09:04

Dear friend
I really thanx
In an article this method was suggested with auther,but he did it in CFX-TASCflow, and unfurtunately I think, this is not possible in fluent to specify a value just for one cell/face in boundary condition.
best regard

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