| 查看: 2963 | 回复: 15 | ||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | ||
[求助]
udf不能正确调用颗粒的宏的值进行计算
|
||
|
采用多表面燃烧模型模拟煤颗粒燃烧,使用DEFINE_PR_RATE计算颗粒反应,并读取颗粒质量P_INIT_MASS(p),和颗粒温度P_T(p),以监测计算过程。 用fprintf(fpOut2,"%f\n",P_T(p));和fprintf(fpOut1,"%f\n",P_INIT_MASS(p));输出, 可是导出的P_T(p)数据与在material面板中设置的颗粒密度值相等,P_INIT_MASS数据与在离散相中设置的颗粒直径数值相等,其他颗粒的宏输出也不正确。 udf不能正确地调用P_INIT_MASS(p)与P_T(p)的值。请教下各位,这是为什么? #include "udf.h" #define A1 10.6313 #define E1 5.1811e+07 DEFINE_PR_RATE(user_pr_rate,c,t,r,mw,pp,p,sf,dif_i,cat_i,rr) { real ash_mass = P_INIT_MASS(p)*(1.-1./3.); real one_minus_conv1 = MAX(0.,3*(P_MASS(p)-ash_mass)/P_INIT_MASS(p)); real one_minus_conv = 3.*exp(2.*log(one_minus_conv1)/3.); real rate = A1*exp(-E1/UNIVERSAL_GAS_CONSTANT/P_T(p)); *rr = -rate*P_INIT_MASS(p)*one_minus_conv; FILE *fpOut1 = fopen("P_INIT_MASS(p).txt","a" ;fprintf(fpOut1,"%f\n",P_INIT_MASS(p)); fclose(fpOut1); FILE *fpOut2 = fopen("P_T(p).txt","a" ;fprintf(fpOut2,"%f\n",P_T(p)); fclose(fpOut2); FILE *fpOut3 = fopen("P_MASS(p).txt","a" ;fprintf(fpOut3,"%f\n",P_MASS(p)); fclose(fpOut3); } |
» 猜你喜欢
上海工程技术大学张培磊教授团队招收博士生
已经有3人回复
上海工程技术大学【激光智能制造】课题组招收硕士
已经有5人回复
求助院士们,这个如何合成呀
已经有4人回复
临港实验室与上科大联培博士招生1名
已经有9人回复
想换工作。大多数高校都是 评职称时 认可5年内在原单位取得的成果吗?
已经有7人回复
需要合成515-64-0,50g,能接单的留言
已经有4人回复
自荐读博
已经有4人回复
写了一篇“相变储能技术在冷库中应用”的论文,论文内容以实验为主,投什么期刊合适?
已经有6人回复
带资进组求博导收留
已经有10人回复
最近几年招的学生写论文不引自己组发的文章
已经有11人回复
15楼2017-12-12 10:03:47
【答案】应助回帖
★ ★ ★
感谢参与,应助指数 +1
13386846246: 金币+3, ★有帮助 2017-03-09 15:54:38
感谢参与,应助指数 +1
13386846246: 金币+3, ★有帮助 2017-03-09 15:54:38
|
首先P_INIT_MASS(p),是初始质量,如果你想调用的质量是当前质量应该用P_MASS(p),另进入当前cell时的质量是P_MASS0(p) 对于你的问题,可能是由于没有告诉程序正在追踪的颗粒,在最开始加入 Tracked_Particle *p试一试。 好久没写UDF了,可能说的不对。具体你还是看一下UDF手册。 以下内容百度来的,供参考: DEFINE_PR_RATE(name,c,t,r,mw,ci,p,sf,dif index,cat index,rr) symbol name---- UDF name. cell t c---- Cell index of current particle. Thread *t---- Pointer to cell thread for particle. Reaction *r---- Pointer to data structure that represents the current reaction. real *mw---- Pointer to array containing gaseous and surface species molecular weights real *ci---- Pointer to array containing gas partial pressures. Tracked Particle *p---- Pointer to Tracked Particle data structure that contains data related to the particle being tracked. real *sf---- Pointer to array containing mass fractions of the solid species in the particle char mass at the current time step. int dif_index---- Diffusion controlled species as defined in the Reactions panel for the current reaction. int cat_index---- Catalyst species as defined in the Reactions panel for the current reaction. |
2楼2017-03-09 13:01:48
3楼2017-03-09 13:23:05
13386846246: 回帖置顶 2017-03-09 16:10:48
13386846246: 取消置顶 2017-03-09 16:11:18
13386846246: 取消置顶 2017-03-09 16:11:18
|
谢谢您的回复,加入Tracked_Particle *p 后进行编译,出现redefinition of formal parameter 'p'问题,应该是DEFINE_PR_RATE(name,c,t,r,mw,ci,p,sf,dif index,cat index,rr)中已经声明了*p。 有些地方不明白,想问下: (1)P_INIT_MASS(p) 在面板中并没设置参数,那P_INIT_MASS(p)的数值是怎么得到的,是根据P_INIT_DIAM(p)与P_INIT_RHO(p)计算的么? (2)P_MASS0(p)与P_INIT_MASS(p)是什么关系? |
4楼2017-03-09 15:58:14







;
回复此楼
