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

user-defined function problem

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 18, 2011, 07:02
Default user-defined function problem
  #1
Senior Member
 
raymond
Join Date: Nov 2009
Posts: 149
Rep Power: 7
wlt_1985 is on a distinguished road
I wrote an user-defined function. I do not know whether is it correct or not since floating error appears each time I interpret it into my model. Please have a check for me. Thanks a lot.

#include "udf.h"

/* DENSITY - START */
DEFINE_PROPERTY(formic_acid_density, c, t)
{
real C; /* self-defined variable for convenience */
real D; /* self-defined variable for convenience */
real rho; /* calculated density in unit kg/m3 */
real T = C_T(c,t); /* temperature in unit kelvin, K */
const real A = 0.36821; /* dimensionless regression coeficient */
const real B = 0.24296; /* dimensionless regression coeficient */
const real n = 0.23663; /* dimensionless regression coeficient */
const real Tc = 580; /* critical temperature in unit kelvin, K */
C = 1-T/Tc; /* self-defined variable for convenience */
D = pow(C, n); /* self-defined variable for convenience */
rho = A*(pow(B, -D))*1000; /* calculated density in unit kg/m3 */
return rho;
}
wlt_1985 is offline   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
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
solving passive scalar by user function in AVLFIRE huyp Main CFD Forum 0 September 4, 2008 10:21
particle diameter (user defined function) eulerian nasser FLUENT 0 June 18, 2006 03:39
User defined function of mass flow rate Eric FLUENT 1 April 22, 2005 18:15
User Defined Function for convection coefficient ereiss FLUENT 1 July 8, 2004 16:10


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