CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

UDF for Density variation

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

Reply
 
LinkBack Thread Tools Display Modes
Old   February 11, 2006, 18:35
Default UDF for Density variation
  #1
Naresh
Guest
 
Posts: n/a
Dear Forum users,

I am facing a problem with an UDF that I have written. Basically I am trying to change the density based on the length. The model is a multiphase model(2 phase Eulerian), and is a vertical column of 30m height with a pressure outlet at the top. The code is as follows:

#include "udf.h" #include "metric.h"

FILE *fp;

DEFINE_PROPERTY(rho,c1,t1) { float density,rho=C_R(c1,t1); float temperature=1523.01; float x[ND_ND];

C_CENTROID(x,c1,t1);

if (x[1]<=4.64)

{temperature=1773+246.9136*(x[1]-1.4);

if (temperature<=2573 || temperature>=1773)

density = rho*1523.01/temperature;

} else if (x[1]>4.64 && x[1]<=35.64)

{temperature=2573-83.83648*(x[1]-4.64);

if (temperature<=2573 || temperature>=393)

density = rho*1523.01/temperature;

} else density=0.7;

return density; }

The problem is, when I try to use this UDF it diverges and eventually gives a floating point error(invalid number). All help in fixing this will be appreciated.

-Naresh
  Reply With Quote

Reply

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
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
UDF temperature variation Alex E-H FLUENT 1 November 7, 2008 09:04
UDF temperature variation Alex E-H FLUENT 2 November 5, 2008 10:18
UDF for C_VOF variation with time and space Frederik FLUENT 4 December 19, 2005 01:53


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