24小时热门版块排行榜    

查看: 4013  |  回复: 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的回帖

xiaojing_14

新虫 (初入文坛)

楼主,您好,我想请问下,您最后还是用DEFINE_DPM_HEAT_MASS做的烟气脱硫吗?能够用DEFINE_DPM_SOURCE呢?
13楼2017-12-27 17:10:05
已阅   回复此楼   关注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

金虫 (小有名气)

引用回帖:
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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 欢迎发来filecode的Mz6后的代码验证其规律 +35 医学老男孩 2026-08-13 82/4100 2026-08-17 19:18 by 我4大白菜
[基金申请] 感觉是下周放榜了 +4 angus9576 2026-08-17 8/400 2026-08-17 17:26 by angus9576
[基金申请] filecode=后面第一个是大写字母 +8 wangze12014 2026-08-14 10/500 2026-08-17 17:05 by xter9665
[基金申请] 时间戳变了,能看出什么问题? +4 基诺咪客 2026-08-17 4/200 2026-08-17 16:10 by Vivilian
[基金申请] 哪位老哥知道今年的国自然具体哪一天放榜? +12 Ldrop2023 2026-08-13 15/750 2026-08-17 15:02 by 小豌豆_发芽
[基金申请] 今天系统多次维护,明天很可能放榜! +8 zju2000 2026-08-16 9/450 2026-08-17 12:20 by lmz0216
[基金申请] 时间戳又变了8-15 +13 archvillain 2026-08-15 25/1250 2026-08-16 20:13 by zhaosm1982
[基金申请] 2027广东省杰青 +3 奶牛小黑 2026-08-15 6/300 2026-08-16 20:07 by 奶牛小黑
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 26/1300 2026-08-16 12:35 by 启萌科技
[基金申请] 有时候,自然基金真的不能太认真 (我的申报经验) +10 majunge000 2026-08-11 12/600 2026-08-16 08:18 by xli1984
[精细化工] 招聘 金属平磨液,抛光液研发工程师 +3 小天0311 2026-08-14 3/150 2026-08-16 07:31 by H9PLUS
[基金申请] 各位道友,我要去昆明玩几天,回来见。 +7 Tide man 2026-08-14 8/400 2026-08-15 01:11 by arzu_hma
[基金申请] 是这周出结果还是下周出结果? +4 yuleib84 2026-08-11 4/200 2026-08-14 23:05 by lfy8008
[硕博家园] 读博的好处 +4 lnee 2026-08-11 4/200 2026-08-14 10:20 by ahsoarli
[基金申请] 重要来源:本周末出结果 +10 瞬息宇宙 2026-08-12 10/500 2026-08-13 15:46 by likettle
[基金申请] 不应该看fileCode +7 且听虎啸 2026-08-12 9/450 2026-08-13 14:27 by flydreamws
[基金申请] Filecode 又变了,巨变 +3 WH3796 2026-08-12 4/200 2026-08-13 14:13 by 小木虫6752397
[基金申请] 结合人工智能,周易传统文化,filecode打分制来了,3分以上希望很大。 +3 Tide man 2026-08-12 4/200 2026-08-13 08:35 by ZJTJZ
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +11 Tide man 2026-08-11 11/550 2026-08-13 07:35 by 撸猫猫
[基金申请] 什么时候出结果,有咨询渠道??? +3 Tide man 2026-08-11 3/150 2026-08-11 17:54 by kudofaye
信息提示
请填处理意见