CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   reaction rate as UDF variable (

sivakumar February 7, 2002 16:44

reaction rate as UDF variable
hi all,

i need to know if it is possible for me to write the profile of a variable and read the values into a UDF - calculation. i run a incompressible reaction model to convergence initially and then i need to superimpose some scalars, the source term of which require the reaction rate in a cell. can any one suggest a way for doing this by the manner i have suggested or a new way please. any help would be greatly appreciated. thank you, siva

Greg Perkins February 8, 2002 19:56

Re: reaction rate as UDF variable
You can access reaction rates using the DEFINE_VR_RATE - the computed fluent values (for laminar and turbulent rates) are actually passed to this function - so you could save them to memory etc. and do nothing else in this routine and fluent would work fine.

This is a nifty feature which is not documented in the udf manuals anywhere - and one I found somewhat by accident - but its very useful if for example you want to modify the normal reaction rates by multiplying by a constant or turning them off in certain locations....etc....

Not sure about the second part of your question - you'll need to explain what you want to do in more detail.

Bascially, you can do (almost) anything using udfs...


sivakumar February 11, 2002 11:52

Re: reaction rate as UDF variable
hi greg,

thankz for the info, i dont quite understand how it works. i am using the uds to solve the transport equation for a scalar and the source term is,

S = a*reaction rate - b*(scalar)^2

so can u suggest a way for me to use the function to accompolish this, i would greatly appreciate the help. thank you, sivakumar.

Greg Perkins February 11, 2002 17:51

Re: reaction rate as UDF variable
I'm not quite sure what you want to do.

Are you saying the source term for your scalar is dependent upon the reaction rate for a homogeneous reaction that you have defined in Fluent??

If this is so, you can do something like:

DEFINE_VR_RATE(My_Rate_Udf,cell,thread,r,Sp_Mw,Sp_ Y,rate_lam,rate_turb) {

if (strcmp(r->name,"reaction-1")==0)

C_UDMI(cell,thread,0) = *rate_turb; }

Here you have stored the turbulent reaction rate for reaction 1 in the memory location, 0.

Now to define your source you'd do:

DEFINE_SOURCE(My_Srce,cell,thread,dS,eqn) {

real srce;

srce = A*C_UDMI(cell,thread,0) - B*pow(C_UDSI(cell,thread,my_uds),2.0);

dS[eqn] = -2*B*C_UDSI(cell,thread,my_uds);

return srce; }

here you have also added to derivative of the source term wrt to the scalar to the dS[eqn] to improve stability of the solver process.

my_uds = scalar uds location.

If you're trying to model some sort of hetrogeneous reaction rate expression, this sort of method may not be very good. It might be better to do the rate calculations yourself and ignore Fluent's inbuild single phase model.

Hope it helps,


Then your

sivakumar February 12, 2002 01:31

Re: reaction rate as UDF variable
thanks greg,

it is working fine and im trying to model aerosol dynamics using 3 additional scalar equation(first three volume based moments). iam having this problem, like my first scalar is converging to the experimental value but the other two are not, do u have any experience with such a problem?if not nevermind, thanks for the help again. regards, sivakumar

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