24小时热门版块排行榜    

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

songsny

铜虫 (初入文坛)

引用回帖:
5楼: Originally posted by 3_1415926 at 2016-03-08 10:45:42
按照你的UDF,应该是改成DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_surf,Z,dydt,dzdt)...

谢谢~按照你的提示改过了,编译可以通过,可是一计算就提示Error: FLUENT received fatal signal (ACCESS_VIOLATION) ,我怀疑是cell_t c0 = RP_CELL(&p->cCell); /* cell and thread */     Thread *t0 = RP_THREAD(&p->cCell); /* where the particle is in */这两行指针有问题,可是也不知道怎么修改,正在纠结中
7楼2016-03-09 10:34:29
已阅   回复此楼   关注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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 302求调剂 +9 zyx上岸! 2026-04-02 9/450 2026-04-02 23:07 by 马儿快快地跑
[考研] 一志愿陕西师范大学生物学317分 +4 1563日。 2026-04-02 4/200 2026-04-02 22:46 by liveagain126
[考研] 交通运输考试264分求工科调剂 +4 jike777 2026-04-02 4/200 2026-04-02 21:53 by zllcz
[考研] 一志愿华中农业071010,总分320求调剂 +6 困困困困坤坤 2026-04-02 6/300 2026-04-02 21:28 by dongzh2009
[考研] 070300化学求调剂 +8 起个名咋这么难 2026-03-27 9/450 2026-04-02 20:42 by dongzh2009
[考研] 一志愿华东理工大学,080500学硕,317分,求调剂 +13 s1145 2026-03-31 14/700 2026-04-02 18:55 by 哦哦嗯哈
[考研] 362求调剂 +14 西南交材料专硕3 2026-03-31 14/700 2026-04-02 17:50 by yunlongyang
[考研] 085600,材料与化工321分求调剂 +11 大馋小子 2026-03-28 11/550 2026-04-02 15:59 by yunlongyang
[考博] 材料工程专业硕士申博 +3 麟正宇 2026-03-30 3/150 2026-04-02 15:04 by greychen00
[考研] 367求调剂 +8 芋泥啵啵… 2026-03-28 8/400 2026-04-02 09:20 by olim
[考研] 085601材料工程找调剂 +20 oatmealR 2026-03-29 21/1050 2026-04-01 21:00 by lijunpoly
[考研] 0710生物学求调剂! +6 叙述文 2026-03-31 6/300 2026-04-01 09:39 by JourneyLucky
[考研] 070300化学354求调剂 +15 101次希望 2026-03-28 15/750 2026-03-31 17:58 by jp9609
[考研] 269求调剂 +4 我想读研11 2026-03-31 4/200 2026-03-31 10:04 by cal0306
[考研] 282求调剂 +3 呼吸都是减肥 2026-03-31 3/150 2026-03-31 10:00 by wangjy2002
[考研] 吉大生物学326分求调剂 +3 sunnyupup 2026-03-31 3/150 2026-03-31 09:28 by longlotian
[考研] 085701环境工程求调剂 +11 多久上课 2026-03-27 12/600 2026-03-30 21:21 by 研究僧导导
[考研] 297 地理学070500 复试求调剂 +3 小圆圈圈ooo 2026-03-30 3/150 2026-03-30 21:05 by 余震yz
[考研] 303求调剂 +7 DLkz1314. 2026-03-30 7/350 2026-03-30 16:05 by shuang5186
[考研] 调剂 +3 李嘉图·S·路 2026-03-27 3/150 2026-03-27 11:19 by wangjy2002
信息提示
请填处理意见