CFD Online Logo CFD Online URL
Home > Forums > FLUENT

Error using UDF to modify density

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   February 13, 2008, 17:11
Default Error using UDF to modify density
Posts: n/a

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; }

  Reply With Quote

Old   July 13, 2011, 07:35
New Member
Navid Sharifi
Join Date: Oct 2010
Location: Iran, Tehran
Posts: 10
Rep Power: 8
n.sharifi is on a distinguished road
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.
n.sharifi is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set periodic boundary conditions Ganesh FLUENT 13 January 22, 2014 05:11
UDF: Density Cell Gradient Vector Macros matteo FLUENT 0 December 1, 2007 13:14
UDF to change density in species transport Karthik FLUENT 6 December 8, 2004 19:19
Density Gradient- UDF Michal FLUENT 2 May 23, 2002 06:45
UDF : derivate of density D.Stratmann FLUENT 2 February 2, 2001 04:02

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