#include \
/* Define which user-defined scalars to use. */ enum {
p,ads,d_ads,q_ads,H_ad };
DEFINE_ADJUST(p_absolute, domain) //计算每个单元绝对压力,并存储 {
Thread *t; cell_t c;
real p_operating; real p_static;
/* solve the absolute pressure. */ thread_loop_c (t,domain) {
if (NULL != THREAD_STORAGE(t,SV_UDS_I(p))) {
begin_c_loop (c,t) {
p_static=C_P(c,t); p_operating = RP_Get_Real(\ C_UDSI(c,t,p) = p_static+p_operating; }
end_c_loop (c,t) } } }
DEFINE_ADJUST(Heat_Adsorption, domain) //计算每个单元绝对压力,并存储 {
Thread *t; cell_t c;
real p_operating; real p_static;
/* solve the absolute pressure. */ thread_loop_c (t,domain) {
if (NULL != THREAD_STORAGE(t,SV_UDS_I(H_ad))&& NULL != T_STORAGE_R_NV(t,SV_UDSI_M1(H_ad))) {
begin_c_loop (c,t) { C_UDSI(c,t,H_ad)=3080*sqrt(log(71.6/C_UDSI_M1(c,t,ads)));
}
end_c_loop (c,t) } } }
DEFINE_ADJUST(adsorption, domain) //通过D_A方程计算每个单元吸附量并存储 {
Thread *t; cell_t c; real n_o; real E_t; real x_p; real A; real x_b; real n;
/* solve the adsorption equation. */ thread_loop_c (t,domain) {
if (NULL != THREAD_STORAGE(t,SV_UDS_I(ads))&& NULL != T_STORAGE_R_NV(t,SV_UDSI_M1(ads)))
{
begin_c_loop (c,t) //D_A方程 { real tem=C_T(c, t); n_o=71.6; E_t=3080+18.9*tem; x_p=1.47E9/C_UDSI(c,t,p); A=8.31429*tem*log(x_p); x_b=-A*A/(E_t*E_t); C_UDSI(c,t,ads)=n_o*exp(x_b); }
end_c_loop (c,t) } } }
DEFINE_ADJUST(q_adsorption, domain) //计算LDF模型中每个单元的qn {
Thread *t; cell_t c;
/* solve the absolute pressure. */ thread_loop_c (t,domain) {
if (NULL != THREAD_STORAGE(t,SV_UDS_I(q_ads))&& NULL != T_STORAGE_R_NV(t,SV_UDSI_M1(q_ads))) {
begin_c_loop (c,t) //LDF模型 { real physical_dt; physical_dt = RP_Get_Real(\ C_UDSI(c,t,q_ads)=C_UDSI_M1(c,t,q_ads)+0.15*physical_dt*(C_UDSI_M1(c,t,ads)-C_UDSI_M1(c,t,q_ads)); }
end_c_loop (c,t) } } }
DEFINE_ADJUST(d_adsorption, domain) //计算每个单元的原项 {
Thread *t; cell_t c;
/* solve the energy source. */ thread_loop_c (t,domain) {
if (NULL != THREAD_STORAGE(t,SV_UDS_I(d_ads))&& NULL != T_STORAGE_R_NV(t,SV_UDSI_M1(d_ads))) {
begin_c_loop (c,t) { C_UDSI(c,t,d_ads)=-0.532224*0.15*(C_UDSI(c,t,ads)-C_UDSI(c,t,q_ads)); }
end_c_loop (c,t) } } }
DEFINE_SOURCE(mass_source,c,t,dS,eqn) //定义质量原项 {
real m_source;
m_source=C_UDSI_M1(c,t,d_ads);
dS[eqn] = 0.0; return m_source; }
DEFINE_SOURCE(energy_source,c,t,dS,eqn) //定义能量原项 {
real e_source;
e_source=-C_UDSI_M1(c,t,d_ads)*0.496056352e3*3080*sqrt(log(71.6/C_UDSI_M1(c,t,ads))); dS[eqn] = 0.0; return e_source; }