24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 3693  |  回复: 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的回帖

浅浅笑王子

铁虫 (正式写手)

引用回帖:
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的回帖
查看全部 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的回帖

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的回帖

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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 309分085801求调剂 +10 学员Gtwj7W 2026-03-31 10/500 2026-04-02 22:42 by yunlongyang
[考研] 319求调剂 +16 太容易1018 2026-04-01 16/800 2026-04-02 20:12 by seattle40
[考研] 275求调剂 +13 jjjjjjjjjjl 2026-03-27 13/650 2026-04-02 13:07 by yulian1987
[考研] 292分,材料与化工,申请调剂 +19 程晴之 2026-04-01 23/1150 2026-04-02 11:59 by 程晴之
[考研] 材料考研调剂 +9 Gs大王 2026-04-02 9/450 2026-04-02 10:24 by olim
[考研] 303求调剂 +8 DLkz1314. 2026-03-30 8/400 2026-04-02 09:08 by sanrepian
[考研] 考研调剂 +12 Amber00 2026-03-31 12/600 2026-04-02 09:04 by sanrepian
[考研] 291求调剂 +20 Y-cap 2026-03-29 25/1250 2026-04-01 23:49 by 欣喜777
[考研] 295材料工程专硕求调剂 +19 1428151015 2026-03-27 19/950 2026-04-01 22:34 by peike
[考研] 建环,能源,土木老师路过看一看!!! +4 嘿嘿uu 2026-04-01 4/200 2026-04-01 20:42 by 无懈可击111
[考研] 309求调剂 +19 谁不是少年 2026-03-29 19/950 2026-04-01 15:47 by jp9609
[考研] 283求调剂 +9 A child 2026-03-28 9/450 2026-04-01 14:20 by Jaylen.
[考研] 求0861交通运输专硕or材料专硕调剂 +4 勒布朗@ 2026-03-31 4/200 2026-04-01 09:54 by 一只好果子?
[考研] 288资源与环境专硕求调剂,不限专业,有学上就行 +25 lllllos 2026-03-30 26/1300 2026-04-01 09:52 by 一只好果子?
[考研] 0856调剂 +7 曲听筠 2026-03-30 7/350 2026-04-01 08:51 by JourneyLucky
[考研] 考研调剂 +9 小蜡新笔 2026-03-29 10/500 2026-03-31 19:52 by Dyhoer
[考研] 085600,专业课化工原理,320分求调剂 +6 大馋小子 2026-03-29 6/300 2026-03-31 10:03 by 氯化亚硝酰
[考研] 293求调剂 +3 末未mm 2026-03-30 5/250 2026-03-30 17:23 by 王保杰33
[考研] 298求调剂 +3 种圣赐 2026-03-29 3/150 2026-03-29 12:06 by longlotian
[考研] 本科双非材料,跨考一志愿华电085801电气,283求调剂,任何专业都可以 +6 芝士雪baoo 2026-03-28 8/400 2026-03-29 08:16 by 松花缸1201
信息提示
请填处理意见