|
楼主 |
发表于 2012-2-20 16:13:55
|
显示全部楼层
#include "udf.h"
#include "sg_mphase.h"
DEFINE_PROPERTY(cell_density_1,cell,pri_th)
{real roh1;
Thread * mix_th;
mix_th = THREAD_SUPER_THREAD(pri_th);
if(C_T(cell, mix_th)>=323.)
roh1=1e-5*(0.0984*pow(C_T(cell, mix_th)-273,3)-7.364*pow(C_T(cell, mix_th)-273,2)+386.4*(C_T(cell, mix_th)-273)-4911);
else if(C_T(cell, mix_th)>=303.)
roh1=1e-3*(0.632e-3*pow(C_T(cell, mix_th)-273,3)-0.02048*pow(C_T(cell, mix_th)-273,2)+1.1736*(C_T(cell, mix_th)-273)-3.473);
else if(C_T(cell, mix_th)>=293.)
roh1=1e-2*(0.315e-2*pow(C_T(cell, mix_th)-273,2)-0.027*(C_T(cell, mix_th)-273)+1.0091);
else roh1=1.71e-2;
return roh1;}
DEFINE_PROPERTY(cell_density_2,cell,pri_th)
{real roh2;
Thread * mix_th;
mix_th = THREAD_SUPER_THREAD(pri_th);
if(C_P(cell, mix_th)<=1000.)
roh2=3000*pow(C_P(cell, mix_th)*1e-5,3)-95*pow(C_P(cell, mix_th)*1e-5,2)+7.401*(C_P(cell, mix_th)*1e-5)+0.000448;
else if(C_P(cell, mix_th)<=3000.)
roh2=-10.4*pow(C_P(cell, mix_th)*1e-5,2)+6.566*(C_P(cell, mix_th)*1e-5)+0.00355;
else if(C_P(cell, mix_th)<=10000.)
roh2=-3.1*pow(C_P(cell, mix_th)*1e-5,2)+6.093*(C_P(cell, mix_th)*1e-5)+0.01138;
return roh2;}
浪子大哥你帮我看看我的udf函数有问题没有,编译没有错误,但是迭代就会出现问题Error: Floating point error: invalid number
Error Object: () |
|