坐标原点为体热源中心,加载高斯旋转体热源;程序如下,但是热源加载不上,求指点
#include "udf.h"
DEFINE_SOURCE(heat_flux,cell,thread,ds,eqn)
{
real x[ND_ND];
real oq,t0,v0,Q,time,cs,hh;
real r,rh;
real source_heat;
cell_t c;
C_CENTROID(x,c,thread);
Q=100000; /*枪功率*/
cs=3/pow(oq,2); /*形状因子*/
hh=150e-3; /*热源高度*/
oq=60e-3; /*热源半径*/
r=sqrt(pow(x[0]-0.35,2)+pow(x[1]+0.35,2)); /*坐标与热源中心的距离*/
rh=sqrt(log(hh/x[2])/3.)*oq; /*一定热源高度对应的半径rh*/
if (x[2]==0)
{
source_heat=3.*cs*Q/(3.14*hh*(1.-1./exp(3)));
ds[eqn] =0;
}
else if (x[2]>0&&x[2]<=hh&&r<=rh)
{
source_heat=3.*cs*Q/(3.14*hh*(1.-1./exp(3)))*exp(-3.*cs/log10(hh/x[2])*pow(r,2.));
ds[eqn] =0;
}
else
{
source_heat= ds[eqn] =0;
}
return source_heat;
}
参考信息:http://muchong.com/bbs/viewthread.php?tid=4198673 |