24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 3696  |  回复: 12
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

songsny

铜虫 (初入文坛)

[求助] UDF编译出错 DEFINE_DPM_HEAT_MASS 已有2人参与

想用UDF中的宏 DEFINE_DPM_HEAT_MASS来模拟液滴对SO2的吸收,就照着例子自己改了改,可是编译出错,又用原来的例子直接编译,发现同样的错误,代码如下:错误提示为..\..\src\multivap.c(6) : warning C4003: not enough actual parameters for macro 'DEFINE_DPM_HEAT_MASS'
..\..\src\multivap.c(7) : error C2055: expected formal parameter list, not a type list
..\..\src\multivap.c(25) : error C2109: subscript requires array or pointer type
..\..\src\multivap.c(25) : error C2106: '+=' : left operand must be l-value
..\..\src\multivap.c(26) : error C2223: left of '->energy' must point to struct/union
..\..\src\multivap.c(65) : error C2109: subscript requires array or pointer type
..\..\src\multivap.c(65) : error C2106: '-=' : left operand must be l-value
..\..\src\multivap.c(66) : error C2223: left of '->species' must point to struct/union
..\..\src\multivap.c(68) : error C2109: subscript requires array or pointer type
..\..\src\multivap.c(68) : error C2106: '-=' : left operand must be l-value
..\..\src\multivap.c(70) : error C2223: left of '->energy' must point to struct/union
求大神指点怎么修改
CODE:
/***********************************************************************
UDF for defining the heat and mass transport for
multicomponent particle vaporization
***********************************************************************/
#include "udf.h"
DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_surf,dydt,dzdt)
{
int ns;
int nc = TP_N_COMPONENTS( p ); /* number of particle components */
cell_t c0 = RP_CELL(&p->cCell); /* cell and thread */
Thread *t0 = RP_THREAD(&p->cCell); /* where the particle is in */
Material *gas_mix = THREAD_MATERIAL( t0 ); /* gas mixture material */
Material *cond_mix = p->injection->material;/* particle mixture material */
cphase_state_t *c = &(p->cphase); /* cell info of particle location */
real molwt[MAX_SPE_EQNS]; /* molecular weight of gas species */
real Tp = P_T(p); /* particle temperature */
real mp = P_MASS(p); /* particle mass */
real molwt_bulk = 0.; /* average molecular weight in bulk gas */
real Dp = DPM_DIAM_FROM_VOL( mp / P_RHO(p) ); /* particle diameter */
real Ap = DPM_AREA(Dp); /* particle surface */
real Pr = c->sHeat * c->mu / c->tCond; /* Prandtl number */
real Nu = 2.0 + 0.6 * sqrt( p->Re ) * pow( Pr, 1./3. ); /* Nusselt number */
real h = Nu * c->tCond / Dp; /* Heat transfer coefficient */
real dh_dt = h * ( c->temp - Tp ) * Ap; /* heat source term */
dydt[0] += dh_dt / ( mp * Cp );
dzdt->energy -= dh_dt;
{
Material *sp;
mixture_species_loop(gas_mix,sp,ns)
{
molwt[ns] = MATERIAL_PROP(sp,PROP_mwi); /* molecular weight of gas species */
molwt_bulk += C_YI(c0,t0,ns) / molwt[ns]; /* average molecular weight */
}
}
/* prevent division by zero */
molwt_bulk = MAX(molwt_bulk,DPM_SMALL);
for( ns = 0; ns < nc; ns++ )
{
/* gas species index of vaporization */
int gas_index = TP_COMPONENT_INDEX_I(p,ns);
if( gas_index >= 0 )
{
/* condensed material */
Material * cond_c = MIXTURE_COMPONENT(cond_mix, ns );
/* vaporization temperature */
real vap_temp = MATERIAL_PROP(cond_c,PROP_vap_temp);
/* diffusion coefficient */
real D = MATERIAL_PROP_POLYNOMIAL( cond_c, PROP_binary_diffusivity, c->temp);
/* Schmidt number */
real Sc = c->mu / ( c->rho * D );
/* mass transfer coefficient */
real k = ( 2. + 0.6 * sqrt(p->Re) * pow( Sc, 1./3. ) ) * D / Dp;

/* bulk gas concentration */
real cvap_bulk = c->pressure / UNIVERSAL_GAS_CONSTANT / c->temp
* c->yi[gas_index] / molwt_bulk / solver_par.molWeight[gas_index];

/* vaporization rate */
real vap_rate = k * molwt[gas_index] * Ap * ( cvap_surf[ns] - cvap_bulk );
/* only condensation below vaporization temperature */
if( 0. < vap_rate && Tp < vap_temp )
vap_rate = 0.;
dydt[1+ns] -= vap_rate;
dzdt->species[gas_index] += vap_rate;
/* dT/dt = dh/dt / (m Cp)*/
dydt[0] -= hvap[gas_index] * vap_rate / ( mp * Cp );
/* gas enthalpy source term */
dzdt->energy += hgas[gas_index] * vap_rate;
}
}
}

回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

3_1415926

金虫 (小有名气)

引用回帖:
3楼: Originally posted by 浅浅笑王子 at 2016-03-07 19:17:10
real Z,??Compressibility
这一行也写在下面么
...

这行不用,是用来说明Z的含义。主要是这个DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_surf,dydt,dzdt)少了参量Z,改成DEFINE_DPM_HEAT_MASS (name, p, C_p, hgas, hvap, cvap_surf, Z, dydt, dzdt)就行了
4楼2016-03-08 10:44:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 13 个回答

3_1415926

金虫 (小有名气)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
songsny: 金币+10, ★★★★★最佳答案 2016-03-09 10:37:33
DEFINE_DPM_HEAT_MASS (name, p, C_p, hgas, hvap, cvap_surf, Z, dydt, dzdt)
你少了个参量Z
real Z,  Compressibility
加上去就没事了
2楼2016-03-04 20:53:34
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

浅浅笑王子

铁虫 (正式写手)

引用回帖:
2楼: Originally posted by 3_1415926 at 2016-03-04 20:53:34
DEFINE_DPM_HEAT_MASS (name, p, C_p, hgas, hvap, cvap_surf, Z, dydt, dzdt)
你少了个参量Z
real Z,  Compressibility
加上去就没事了

real Z,??Compressibility
这一行也写在下面么

发自小木虫Android客户端
3楼2016-03-07 19:17:10
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

3_1415926

金虫 (小有名气)

引用回帖:
4楼: Originally posted by 3_1415926 at 2016-03-08 10:44:09
这行不用,是用来说明Z的含义。主要是这个DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_surf,dydt,dzdt)少了参量Z,改成DEFINE_DPM_HEAT_MASS (name, p, C_p, hgas, hvap, cvap_surf, Z, dydt, dzdt)就行了...

按照你的UDF,应该是改成DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_surf,Z,dydt,dzdt)
5楼2016-03-08 10:45:42
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 一志愿深大085601材料工程专业(专硕)300分可以调剂去哪 +7 10160315 2026-04-02 7/350 2026-04-02 22:48 by liveagain126
[考研] 求调剂 +5 朔朔话 2026-04-02 6/300 2026-04-02 22:02 by barlinike
[考研] 312求调剂 +3 赊月色 2026-04-02 4/200 2026-04-02 21:50 by macy2011
[考研] 326分求调剂 +3 于是乎呢 2026-04-01 3/150 2026-04-02 21:30 by jing_jenna
[考研] 070305高分子化学与物理 304分求调剂 +16 c297914 2026-03-28 16/800 2026-04-02 20:50 by dongzh2009
[考研] 学硕机械工程303求调剂 +5 无名所以叫吴明 2026-03-30 5/250 2026-04-02 20:12 by hengsmith
[考研] 286分调剂 +20 Faune 2026-03-30 22/1100 2026-04-02 13:24 by clyblh
[考研] 材料化工340求调剂 +5 jhx777 2026-03-30 5/250 2026-04-02 12:45 by smileboy2006
[考研] 求调剂推荐 +3 南山南@ 2026-04-01 3/150 2026-04-02 12:09 by xiaoranmu
[考研] 0710生物学336分求调剂 +3 kiyy 2026-04-01 3/150 2026-04-02 10:54 by w虫虫123
[考研] 085600,材料与化工321分,求调剂 +13 大馋小子 2026-03-27 13/650 2026-04-02 10:48 by sanrepian
[考研] 310分求调剂 +4 成功上岸wang 2026-04-01 4/200 2026-04-01 20:35 by liu823948201
[考研] 290求调剂 +5 dfffsar 2026-03-29 5/250 2026-04-01 19:45 by 6781022
[考研] 材料调剂 +11 一样YWY 2026-03-31 11/550 2026-04-01 11:35 by wangjy2002
[考研] 339求调剂 +5 zjjkt 2026-03-31 5/250 2026-04-01 09:18 by JourneyLucky
[考研] 311(085601)求调剂 +12 liziyeyeye 2026-03-28 13/650 2026-04-01 00:34 by fmesaito
[考研] 070300化学专业279调剂 +10 哈哈哈^_^ 2026-03-31 10/500 2026-03-31 23:13 by liu823948201
[基金申请] 面上5B能上会吗? +8 redcom 2026-03-29 8/400 2026-03-31 15:53 by niuailing
[考研] 求调剂 +7 青春裁为三截 2026-03-29 7/350 2026-03-30 13:14 by laoshidan
[考研] 求佛 +7 迷人的哈哈 2026-03-28 7/350 2026-03-28 16:47 by 催化大白
信息提示
请填处理意见