我写一个能量方程的源项,但是计算结果显示,我的源项加没加计算结果都一样,证明说这里面有地方写错了。但是我实在看不出来哪里弄错了。 我加载代码的方式应该是正确的吧(先iinterpreted,然后Cell zone, source前打勾,最后把能量UDF源选进去) #include "udf.h" #include "sg_mphase.h" DEFINE_SOURCE(energy_source,c,m_t,dS,eqn) { Thread *l_t, *v_t; real m_dot, hc, source, fv, dT,m_dot2,source2; real cigma_m, cigma_m2,flag; real D_l, D_v,p_loc; real p_sat,p_sat2, T_loc, p_vapor,dp, dp2, T_loc2, p_vapor2; real p1, p2, p3, p4,m_dot_Re,m_dot_Re2,m_dot_Rc,m_dot_Rc2; real F_vap, F_cond, temp1, hc2; p_loc=C_P(c,m_t)*1000000; F_vap=0.02; F_cond=0.01; l_t=THREAD_SUB_THREAD(m_t,0); v_t=THREAD_SUB_THREAD(m_t,1); fv=C_VOF(c,v_t)*C_R(c,v_t)/(C_VOF(c,v_t)*C_R(c,v_t)+C_VOF(c,l_t)*C_R(c,l_t)); T_loc=C_T(c,m_t); p1=10.86; p2=-1980; p3=1.233*100000; p4=-2.617*1000000; p_sat=p1*T_loc*T_loc*T_loc+p2*T_loc*T_loc+p3*T_loc+p4; dT=0.01; T_loc2=T_loc+dT; p_sat2=p1*T_loc2*T_loc2*T_loc2+p2*T_loc2*T_loc2+p3*T_loc2+p4; p_vapor=p_sat+0.5*0.39*C_R(c,m_t)*C_K(c,m_t); p_vapor2=p_sat2+0.5*0.39*C_R(c,m_t)*C_K(c,m_t); p1=3.424e-09; p2=-1.867e-07; p3= -0.0002614; p4=0.02863; cigma_m=p1*T_loc*T_loc*T_loc+p2*T_loc*T_loc+p3*T_loc+p4; cigma_m2=p1*T_loc2*T_loc2*T_loc2+p2*T_loc2*T_loc2+p3*T_loc2+p4; p1=-0.0002051; p2=0.03527; p3=-3.064; p4=320.1; hc=p1*T_loc*T_loc*T_loc+p2*T_loc*T_loc+p3*T_loc+p4; hc2=p1*T_loc2*T_loc2*T_loc2+p2*T_loc2*T_loc2+p3*T_loc2+p4; dp=p_vapor-p_loc; dp2=p_vapor2-p_loc; temp1=sqrt(C_K(c,m_t)); D_l=C_R(c,l_t); D_v=C_R(c,v_t); m_dot_Re=0.0; m_dot_Rc=0.0; source=0.0; source2=0.0; flag=1000.0; if(p_loc<=p_vapor) { m_dot_Re=F_vap*temp1/cigma_m*D_l*D_v*sqrt(2/3*dp/D_l)*(1-fv); } if(p_loc>p_vapor) { m_dot_Rc=F_cond*temp1/cigma_m*D_l*D_l*sqrt(2/3*(-dp)/D_l)*fv; } source=(m_dot_Re-m_dot_Rc)*hc*flag; dS[eqn]=0.0; return source; } |
|
共 1 个关于本帖的回复 最后回复于 2014-6-6 10:04