CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   udf (

mmoja July 13, 2009 12:34

Hello experts,
Below is a short UDF i wrote to calculate the density of supercritical CO2, however it
does not run, it gives a floating point error.
If firstly,I replace the C_P(c,t) with a value say 2 bars it calculates the correct
density though constant throughout. Secondly, if I initialize the gauge pressure in the
solve menu, it uses that value as C_P(c,t) which results to constant density in the
bed... does not depict any pressure drop or change.
I just wandering and wondering where the problem could be.
inlet boundary condition- mass inflow and pressure outlet BC.

#include "udf.h"
#define B 1.1
#define Q 0.2
#define D 0.01
#define R 188.90
#define K 1.330

DEFINE_PROPERTY(superfluid_density, c, t)
real rho;
real press;
real p_operating;
real temp= C_T(c,t);
press = C_P(c,t);
rho = D*pow(press,B)/pow(temp,Q);
return rho;
DEFINE_PROPERTY(sound_speed, c, t)
real a;
real temp = C_T(c,t);
a = sqrt(R*K*temp);
return a;

byronsmith July 23, 2009 02:17

The macro for density is C_R(c,t) in mem.h try using the macro instead of the variable rho

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