|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
/*Definition of constants*/
#include "udf.h"
#define kb 1.38e-23
#define charge 1.602e-19
#define stefan 5.67e-8
#define grayness 0.20
#define molecular 66.317e-29
#define magpre 12.56e-7
#define current 11.3
enum{ /*C_UDM使用的枚举指针*/
Jx,
Jy,
Bz,
radiation,
sigma,
GRAD_T4_x,
GRAD_T4_y,
pressure,
elec_han,
modi_den,/*更改密度属性后,利用UDM存储值,代入等离子体压强的计算公式*/
turbu_energy/*湍流耗散率边界条件中引用*/
};
enum{ /*C_UDS使用的枚举指针*/
T4
};
DEFINE_INIT(init_function,domain)/*初始化*/
{
cell_t c;
Thread *t;
real x[ND_ND];
thread_loop_c(t,domain)
{
begin_c_loop_all(c, t)
{
C_CENTROID(x,c,t);
C_T(c,t)=1000;
C_U(c,t)=0.0;
C_V(c,t)=0.0;
C_P(c,t)=101325.0;
}
end_c_loop(c, t);
}
}
DEFINE_ADJUST(adjust_compute,domain)/*存取、迭代时修正物理量的函数*/
{
cell_t c;
Thread *t;
thread_loop_c(t,domain)
{
begin_c_loop(c, t)
{ real temp;
temp=C_T(c,t);
C_UDMI(c,t,Bz)=C_UDSI_G(c,t,2)[0]-C_UDSI_G(c,t,1)[1];/*切向磁感应强度*/
C_UDMI(c,t,Jy)=-C_UDMI(c,t,sigma)*(C_UDSI_G(c,t,0)[1]);/*径向电流密度*/
C_UDMI(c,t,Jx)=-C_UDMI(c,t,sigma)*(C_UDSI_G(c,t,0)[0]);/*轴向电流密度*/
C_UDMI(c,t,sigma)=308.17189-0.10405*temp-6.69744e-5*temp*temp+1.91193e-8*pow(temp,3)-1.04491e-12*pow(temp,4)+1.69421e-17*pow(temp,5);/*电导率计算*/
C_UDMI(c,t,pressure)=C_UDMI(c,t,modi_den)*kb*temp/molecular;/*等离子体压强计算*/
C_UDMI(c,t,radiation)=-grayness*stefan*(C_UDMI(c,t,GRAD_T4_x)+C_UDMI(c,t,GRAD_T4_y));/*辐射项*/
C_UDSI(c,t,T4)=pow(temp,4);/*温度四次幂的存储*/
C_UDMI(c,t,GRAD_T4_x)=C_UDSI_G(c,t,T4)[0];/*温度四次幂导的存储,用辐射项添加*/
C_UDMI(c,t,GRAD_T4_y)=C_UDSI_G(c,t,T4)[1];
}
end_c_loop(c,t);
}
}
DEFINE_SOURCE(electron_source,c,t,dS,eqn)/*电子焓输运项添加*/
{
real elec_source;
elec_source=2.5*kb/charge*(C_UDMI(c,t,Jx)*(C_T_G(c,t)[0])+C_UDMI(c,t,Jy)*(C_T_G(c,t)[1]));
dS[eqn]=2.5*kb/charge;
C_UDMI(c,t,elec_han)=elec_source;
return elec_source;
}
DEFINE_SOURCE(energy_Source,c,t,dS,eqn)/*能量方程源项焦耳热、辐射、电子焓输运*/
{
real source;
source=(C_UDMI(c,t,Jy)*C_UDMI(c,t,Jy)+C_UDMI(c,t,Jx)*C_UDMI(c,t,Jx))/C_UDMI(c,t,sigma)-C_UDMI(c,t,radiation)+C_UDMI(c,t,elec_han);
dS[eqn]=0.0;
return source;
}
DEFINE_SOURCE(X_mon_Source,c,t,dS,eqn)/*轴向动量方程源项洛伦兹力*/
{
real sourcex;
sourcex=C_UDMI(c,t,Jy)*C_UDMI(c,t,Bz);
dS[eqn]=0.0;
return sourcex;
}
DEFINE_SOURCE(Y_mon_Source,c,t,dS,eqn)/*径向动量方程源项洛伦兹力*/
{
real sourcey;
sourcey=-C_UDMI(c,t,Jx)*C_UDMI(c,t,Bz);
dS[eqn]=0.0;
return sourcey;
}
/*Definition of current-consistence source term-scalor0*/
DEFINE_SOURCE(current_Source,c,t,dS,eqn)/*电流连续性方程源项为0.0*/
{
real source;
source=0.0;
dS[eqn]=0.0;
return source;
}
/*Definition of current-consistence diffusivity-scalor0*/
DEFINE_DIFFUSIVITY(current_diff,c,t,i)/*电流连续性方程的扩散项为电导率*/
{
return C_UDMI(c,t,sigma);
}
/*Definition of X-vector potential source terms-scalor1*/
DEFINE_SOURCE(X_potential_Source,c,t,dS,eqn)/*轴向矢势方程源项*/
{
real source;
source=magpre*C_UDMI(c,t,Jx);
dS[eqn]=magpre;
return source;
}
/*Definition of Y-vector potential source terms-scalor2*/
DEFINE_SOURCE(Y_potential_Source,c,t,dS,eqn)/*径向矢势方程源项*/
{
real x[ND_ND];
real source;
C_CENTROID(x,c,t);
source=magpre*C_UDMI(c,t,Jy)-(C_UDSI(c,t,2))/(x[1]*x[1]);
dS[eqn]=magpre;
return source;
}
/*Definition of plasma Material Properties*/
DEFINE_PROPERTY(argon_density,c,t)/*氩等离子体密度*/
{
real den,temp;
temp=C_T(c,t);
if(temp>25000)
den=8.22e-3;
else if(temp>1000)
den=1.03778*exp(-temp/815.835)+0.20949*exp(-temp/6139.04506)+0.00412;
else
den=4.87e-1;
C_UDMI(c,t,modi_den)=den;/*用于计算等离子体压强*/
return den;
}
DEFINE_PROPERTY(argon_viscosity,c,t)/*氩等离子体黏度*/
{
real vis,temp;
real temp=C_T(c,t);
if(temp>25000)
vis=1.46e-5;
else if(temp>1000)
vis=1.03778*exp(-temp/815.835)+0.20949*exp(-temp/6139.04506)+0.00412;
else
vis=6.94e-5;
return vis;
}
DEFINE_PROPERTY(argon_thercond,c,t)/*氩等离子体热导率*/
{
real ther_cond,temp;
real temp=C_T(c,t);
if(temp>25000)
ther_cond=4.33;
else if(temp>1000)
ther_cond=0.03925+1.23774e-4*temp-6.66118e-08*temp*temp+1.11405e-11*pow(temp,3)-5.93296e-16*pow(temp,4)+1.03134e-20*pow(temp,5);
else
ther_cond=5.42e-2;
return ther_cond;
}
DEFINE_PROFILE(cathode_bc_phi,thread,i)/*通过电势梯度定义阴极尾端电流密度的分布*/
{
cell_t c;
face_t f;
Thread *t;
begin_f_loop(f,thread)
{
F_PROFILE(f,thread,i)=-current*1000000/(M_PI*C_UDMI(c,t,sigma));
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(k_profile,thread,i)/*点火器进口湍流动能*/
{
cell_t c;
face_t f;
Thread *t;
begin_f_loop(f,thread)
{
F_PROFILE(f,thread,i)=0.005*pow(C_V(c,t),2);
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(dissip_profile,thread,i)/*点火器进口湍流耗散率*/
{
cell_t c;
face_t f;
Thread *t;
begin_f_loop(f,thread)
{
C_UDMI(f,t,turbu_energy)=0.005*pow(C_V(c,t),2);
F_PROFILE(f,thread,i)=0.1*pow(C_UDMI(f,t,turbu_energy),2);
}
end_f_loop(f,thread)
}
这是我的源程序,能够正常编译,但是一初始化就出现下面的问题,没法初始化Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: #f,
麻烦大神能够指点一下啊,困在这里好多天了。
|
|