| 查看: 2200 | 回复: 1 | ||
| 【悬赏金币】回答本帖问题,作者矢志不渝……将赠送您 10 个金币 | ||
[求助]
fluent udf message宏的使用问题 已有1人参与
|
||
|
程序如下,用于获取并显示计算域最小温度,最大温度和平均温度(来源于udf manual文档DEFINE_ON_DEMAND一节的示例) #include "udf.h" #include "math.h" #include "sg.h" DEFINE_ON_DEMAND(ex) { Domain *d; real tavg = 0.; real tmax = 0.; real tmin = 0.; real temp,volume,vol_tot; real i = 0; Thread *t; cell_t c; d = Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { volume = C_VOLUME(c,t); temp = C_T(c,t); if (temp < tmin || tmin == 0.) tmin = temp; if (temp > tmax || tmax == 0.) tmax = temp; vol_tot += volume; tavg += temp*volume; } end_c_loop(c,t) tavg /= vol_tot; i = i+1; Message0("\n Tmin = %g; Tmax = %g ;Tavg = %g; i= %g\n",tmin,tmax,tavg,i); } } 然而,在fluent中execute后,显示结果如下: Tmin = 2589.32; Tmax = 3136.66; Tavg = 3057.71; i= 1 Tmin = 300; Tmax = 3136.66; Tavg = 3.70544e+07; i= 2 Tmin = 300; Tmax = 3136.6;6 Tavg = 4.45858e+11; i= 3 实际情况是,计算域最小温度为300K,最高温度应该没错。也就是说,一次execute输出了三行的错误信息,请问问题出在哪里? |
» 猜你喜欢
推荐一本书
已经有10人回复
纳米粒子粒径的测量
已经有6人回复
国自然申请面上模板最新2026版出了吗?
已经有6人回复
溴的反应液脱色
已经有4人回复
参与限项
已经有5人回复
有没有人能给点建议
已经有5人回复
假如你的研究生提出不合理要求
已经有12人回复
全日制(定向)博士
已经有5人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
2楼2023-07-15 10:24:21












回复此楼