CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Error using UDF to modify density (

NRD February 13, 2008 17:11

Error using UDF to modify density

I am trying to specify an equation of state (instead of ideal gas law). I am using DEFINE_PROPERTY for this. As a first step I have written an UDF where I calculate the density of gas using ideal gas law and activate for density in the properties of air and also turned on the energy equation. The simulation diverges. Not sure why since the UDF as shown below is fairly straightforward. Works fine if I make rhoa=constant.

Can someone suggest any corrections.

Thanks in advance.

#include "udf.h" #define rg 287.03

DEFINE_PROPERTY(liquid, c, t) { real rhoa, p_operating, pres, temp;

p_operating = RP_Get_Real ("operating-pressure"); pres = C_P(c,t) + p_operating; temp=C_T(c,t);


return rhoa; }

n.sharifi July 13, 2011 07:35

I've encountered a problem like you.
when i simplify the problem and use an inviscid compressible flow with the same UDF define property macro, the other bugs are observed.
1) the cell center contour of T-static and T-total are the same !!!
2) the net mass flow rate is changed.
3) the maximum velocity is increased.
so i believe that we should introduce a static temperatue and static pressure calculation macros to the solver.but how can we do it and how does it hooked?
if you have an idea please note it. may be it useful for us.

All times are GMT -4. The time now is 11:48.