fluent中udf编程提示出错 Error: received a fatal signal (Segmentation fault). Error Object: #f 200
1.先初始化,迭代一步后,再导入udf--问题依旧
2.先保存退出软件后,再重新打开--问题依旧
3.将4个udf分别拆开后,分别导入--没有出现问题
4.将其中的两个udf组合起来,导入--问题依旧(据此推断是udf的问题),下面是我的udf;将DEFINE_SOURCE(liq_src…)和DEFINE_SOURCE(vap_src…)这两个udf组合在一起,出现了开始的同样问题。请大神帮忙看下,问题出在哪?滴水之恩,涌泉相报,谢谢大神们!!!
附件截图是我引用udf的三个位置,附件文件是我的udf。
#include "udf.h"
#include "sg_mphase.h"
#define T_SAT 278
#define LAT_HT 2260000
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{
real cp=1200.176+2164.7398*pow(0.35,1.16317)+0.0229*pow(T,1.306682)+0.3285*pow(0.35,1.16317)*pow(T,1.306682);
*h = cp*(T-Tref);
return cp;
}
DEFINE_SOURCE(liq_src, cell, pri_th, dS, eqn)//与下面组合后出现问题
{
Thread *mix_th,*sec_th;
real m_dot_l;
mix_th=THREAD_SUPER_THREAD(pri_th);
sec_th=THREAD_SUB_THREAD(mix_th,1);
if(C_T(cell,mix_th)>=T_SAT)
{
m_dot_l=-0.1*C_VOF(cell,pri_th)*C_R(cell,pri_th)*fabs(C_T(cell,mix_th)-T_SAT)/T_SAT;
dS[eqn]=-0.1*C_R(cell,pri_th)*fabs(C_T(cell,mix_th)-T_SAT)/T_SAT;
}
else
{
m_dot_l=0.1*C_VOF(cell,sec_th)*C_R(cell,sec_th)*fabs(T_SAT-C_T(cell,mix_th))/T_SAT;
dS[eqn]=0.0;
}
return m_dot_l;
}
DEFINE_SOURCE(vap_src,cell,sec_th,dS,eqn)//与上面组合后出现问题
{
Thread *mix_th,*pri_th;
real m_dot_v;
mix_th=THREAD_SUPER_THREAD(sec_th);
pri_th=THREAD_SUB_THREAD(mix_th,0);
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot_v=0.1*C_VOF(cell,pri_th)*C_R(cell,pri_th)*fabs(C_T(cell,mix_th)-T_SAT)/T_SAT;
dS[eqn]=0.0;
}
else
{
m_dot_v=-0.1*C_VOF(cell,sec_th)*C_R(cell,sec_th)*fabs(T_SAT-C_T(cell,mix_th))/T_SAT;
dS[eqn]=-0.1*C_R(cell,sec_th)*fabs(C_T(cell,mix_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;
pri_th=THREAD_SUB_THREAD(mix_th,0);
sec_th=THREAD_SUB_THREAD(mix_th,1);
if(C_T(cell, mix_th)>=T_SAT)
{
m_dot=-0.1*C_VOF(cell,pri_th)*C_R(cell,pri_th)*fabs(C_T(cell,mix_th)-T_SAT)/T_SAT;
dS[eqn]=-0.1*C_VOF(cell,pri_th)*C_R(cell,pri_th)/T_SAT;
}
else
{
m_dot=0.1*C_VOF(cell,sec_th)*C_R(cell,sec_th)*fabs(T_SAT-C_T(cell,mix_th))/T_SAT;
dS[eqn]=-0.1*C_VOF(cell,sec_th)*C_R(cell,sec_th)/T_SAT;
}
return LAT_HT*m_dot;
}
QQ1.png
QQ2.png