CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF for Oxygen Conc in Porous Bed (

Umesh September 23, 2003 14:05

UDF for Oxygen Conc in Porous Bed
Hi, I had written a UDF to specify the source of oxygen as a function of Bed Height.

I need to modify my UDF for Oxygen source to speficy Oxygen conc Co2 = 0.123 FROM (x= 10, y=10) TO (x=20, y=10) [total x is 0 to 30]

i.e. I WANT TO SPEFICY THE CONSTANT CONC. OF OXYGEN AT CERTAIN LOCATION OF BED along the Length. 1. How can I modify my following UDF for this. I had problem in including the variation with x.

2. Can I simplify this UDF given here.

DEFINE_SOURCE(oxy_source, c, t, dS, eqn) { real x[ND_ND]; real y; float source; C_CENTROID(x,c,t); y =x[1]; /* (h1, h2, h2 and h4 points on Bed height) i.e. y-direction */

if ((y< h1 && y>=h2) || (y< h3 && y >=h4) )

{ dS[eqn]=0;

source=ko2*(Coxy_eqm-C_YI(c,t,0))- kq*C_YI(c,t,1);


else if ((y < h2 && y >=h3) || (y< h4 && y >=h5))

{ dS[eqn]=0;

source= 1.5*ko2*( Coxy_eqm - C_YI(c,t,0));


return source; }

All suggestions are Welcome


cp September 23, 2003 23:03

Re: UDF for Oxygen Conc in Porous Bed

I guess, the function you used,


also returns the x coordinate of the cell. You can then embed that in your 'if' condition.

Hope this helps.


Greg Perkins September 24, 2003 03:01

Re: UDF for Oxygen Conc in Porous Bed
Do you mean a source of O2 injection (ie kg/m3-s) or the concentration itself (kg/m3)??

You have specified a mass source of O2 in kg/m3-s with your udf.

Also if you want to have a proper mass balance you need to add another source = sum of all species sources to the continuity equation.

If you want to fix the O2 concentration then do this by fixing the O2 mass fraction to a specific value through:

source = 1.0e10(Y_O2_I_Want - C_YI(c,t,i_o2)); ds[eqn] = -1.0e10;


Umesh September 24, 2003 05:00

Re: UDF for Oxygen Conc in Porous Bed
Dear CP and Greg, thanks for your suggestions

I want a constant conc. of Oxygen along a Line from x=10 to x=20 (kg/m3) as C_YI(c,t,0)=const. in the domain of the Porous bed.

I can use x=x[0] to get x coordinates.

But I am not able to write/Modify the UDF to take care of above requirement.


All times are GMT -4. The time now is 19:12.