找回密码
 注册
查看: 2191|回复: 0

蒸发凝结问题求助

[复制链接]
发表于 2013-9-16 11:12:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
蒸发沸腾UDF问题
本人正在学做两相流模型模拟蒸发冷凝,想取单元处的饱和压力,根据关系式得到对应的饱和温度,再讲单元处的温度与饱和温度相比较判断是否蒸发凝结,UDF程序如下,但是导入FLUENT中编译通过,不能开始计算,提示Error: Floating point error: invalid number

Error Object: (),想问问大家如何解决?谢谢各位了
UDF:#include <stdio.h>
#include <math.h>
#include "udf.h"
#include "sg_mphase.h"
#define L 445600
#define TB  20.268
#define PB  101325
#define R  4157
#define b 0.1

DEFINE_SOURCE(liq_src, cell, pri_th, dS, eqn)
{
Thread *mix_th, *sec_th;
real m_dot_l,Psat,T_SAT;
mix_th = THREAD_SUPER_THREAD(pri_th);
sec_th = THREAD_SUB_THREAD(mix_th, 1);
Psat = C_P(cell,pri_th);
T_SAT=1/(1/TB-R*log(Psat/PB)/L);

if(C_T(cell, mix_th)>=T_SAT){
m_dot_l = -b*C_VOF(cell, pri_th)*C_R(cell, pri_th)*
fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;
dS[eqn] = -b*C_R(cell, pri_th)*
fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;
}
else {
m_dot_l = b*C_VOF(cell, sec_th)*C_R(cell, sec_th)*
fabs(T_SAT-C_T(cell,mix_th))/T_SAT;
dS[eqn] = 0.;
}
return m_dot_l;
}
DEFINE_SOURCE(vap_src, cell, sec_th, dS, eqn)
{
Thread * mix_th, *pri_th;
real m_dot_v,Psat,T_SAT;
mix_th = THREAD_SUPER_THREAD(sec_th);
pri_th = THREAD_SUB_THREAD(mix_th, 0);
Psat = C_P(cell,pri_th);
T_SAT=1/(1/TB-R*log(Psat/PB)/L);
if(C_T(cell, mix_th)>=T_SAT){
m_dot_v = b*C_VOF(cell, pri_th)*C_R(cell, pri_th)*
fabs(C_T(cell, mix_th) - T_SAT)/T_SAT;
dS[eqn] = 0.;
}
else {
m_dot_v = -b*C_VOF(cell, sec_th)*C_R(cell, sec_th)*
fabs(T_SAT-C_T(cell,mix_th))/T_SAT;
dS[eqn] = -b*C_R(cell, sec_th)*
fabs(C_T(cell, sec_th) - T_SAT)/T_SAT;
}
return m_dot_v;

}
DEFINE_SOURCE(enrg_src, cell, mix_th, dS, eqn)
{
Thread *pri_th, *sec_th;
real m_dot,Psat,T_SAT;
pri_th = THREAD_SUB_THREAD(mix_th, 0);
sec_th = THREAD_SUB_THREAD(mix_th, 1);
Psat = C_P(cell,pri_th);
T_SAT=1/(1/TB-R*log(Psat/PB)/L);

if(C_T(cell, mix_th)>=T_SAT){
m_dot = -b*C_VOF(cell, pri_th)*C_R(cell, pri_th)*
fabs(C_T(cell, pri_th) - T_SAT)/T_SAT;
dS[eqn] = -b*C_VOF(cell, pri_th)*C_R(cell, pri_th)/T_SAT;
}

else {
m_dot = b*C_VOF(cell, sec_th)*C_R(cell, sec_th)*
fabs(T_SAT-C_T(cell,mix_th))/T_SAT;
dS[eqn] = -b*C_VOF(cell, sec_th)*C_R(cell, sec_th)/T_SAT;}
return L*m_dot;
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表