声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2711|回复: 1

[UDF专题] 蒸发凝结的UDF问题求助

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

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

您需要 登录 才可以下载或查看,没有账号?我要加入

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;
}
回复
分享到:

使用道具 举报

发表于 2014-4-21 10:12 | 显示全部楼层
怎么没有人讨论啊?这么好的问题
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-12-23 17:09 , Processed in 0.076458 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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