| 查看: 2951 | 回复: 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); } |
» 收录本帖的淘帖专辑推荐
实验 |
» 猜你喜欢
垃圾破二本职称评审标准
已经有18人回复
职称评审没过,求安慰
已经有53人回复
毕业后当辅导员了,天天各种学生超烦
已经有5人回复
26申博自荐
已经有3人回复
A期刊撤稿
已经有4人回复
EST投稿状态问题
已经有7人回复
9楼2017-03-13 16:57:17
【答案】应助回帖
★ ★ ★
感谢参与,应助指数 +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













;
回复此楼
