| 查看: 2321 | 回复: 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输出了三行的错误信息,请问问题出在哪里? |
» 猜你喜欢
2026年申博-电池方向
已经有4人回复
2026年博士申请求捞
已经有5人回复
26年博士申请自荐-电催化
已经有9人回复
申博自荐
已经有9人回复
研究生做的很差,你们会让毕业吗?
已经有11人回复
求碳排放博导;方向是LCA、生命周期可持续发展以及碳排放
已经有7人回复
2026博士申请求助
已经有4人回复
2026博士或科研助理转27年博士
已经有7人回复
急招2026年9月份入学博士
已经有3人回复
国自科送审了吗
已经有11人回复
2楼2023-07-15 10:24:21












回复此楼