| 查看: 2425 | 回复: 8 | ||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | ||
[求助]
求解答--UDF中DEFINE_ADJUST报错 已有2人参与
|
||
|
以前使用过简单的DEFINE_PROFILE语句来定义入口边界条件,可能因为语句比较简单,所以没有出现过问题。 但最近在用FLUENT做室内热舒适评价的过程中却遇到诸多问题。为逐步解决这些问题,我决定先从最简单的计算出发,一步步解决。 但是,没想到,下面两个简单的UDF竟然会如此棘手。。。 求好心的朋友们帮忙解答~~感谢万分~~~ 一、FLUENT UDF tutorial中关于DEFINE_ADJUST的UDF,求解湍流耗散的体积积分,此UDF与tutorial完全一致。 #include "udf.h" DEFINE_ADJUST(turb_diss, d) { Thread *t; real sum_diss=0.; cell_t c; thread_loop_c (t,d) { begin_c_loop (c,t) sum_diss += C_D(c,t)*C_VOLUME(c,t); end_c_loop (c,t) } printf("Volume integral of turbulent dissipation: %g\n", sum_diss); } (1)若使用Interpret功能,则可以正常运行得出结果。 (2)但若使用Compile功能,则会出现如下错误提示: # Generating udf_names.c because of makefile turb_diss.obj udf_names.c udf_names.c(7) : error C2085: ‘udf_data’ : not in formal parameter list udf_names.c(7) : error C2143: syntax error : missing ‘;’ before ‘=’ udf_names.c(8) : warning C4138: ‘*/’ found outside of comment udf_names.c(10) : error C2065: ‘udf_data’ : undeclared identifier (3)求助:是什么原因造成compile编译出现错误? 二、 对于自己编写一个求解摄氏度的非常简单程序: #include "udf.h" DEFINE_ADJUST(temp1, d) { Thread *t; real tempa=0.; cell_t c; thread_loop_c (t,d) { begin_c_loop (c,t) tempa = C_T(c,t) - 273.15; C_UDSI(c,t,0)=tempa; end_c_loop (c,t) } } (1)使用Interpret功能时报错: Chip-exec: temp1: wrong return type: float udf function expected Chip-exec: temp1: argument 1: incorrect type (36): int expected Chip-exec: temp1: argument 2: incorrect type (0): pointer expected Chip-exec: temp1: argument 3: incorrect type (0): int expected Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () (2)若使用Compile功能,则出现与tutorial case相同的错误,即: udf_names.c(7) : error C2085: ‘udf_data’ : not in formal parameter list udf_names.c(7) : error C2143: syntax error : missing ‘;’ before ‘=’ udf_names.c(8) : warning C4138: ‘*/’ found outside of comment udf_names.c(10) : error C2065: ‘udf_data’ : undeclared identifier (3)求助: (3.1) 是什么原因造成了interpret出现错误? (3.2) 同样,又是什么原因造成compile的错误? (3.3) 关于user defined scalar(UDS): 在一个DEFINE_ADJUST中,能否通过C_UDSI(c,t,0),C_UDSI(c,t,1),C_UDSI(c,t,2)….. C_UDSI(c,t,i)来同时定义多个不同的UDS?还是说,要定义i个不同的DEFINE_ADJUST,来分别定义多个不同的UDS? |
» 猜你喜欢
交叉科学部支持青年基金,对三无青椒是个机会吗?
已经有4人回复
招博士
已经有6人回复
限项规定
已经有8人回复
国家基金申请书模板内插入图片不可调整大小?
已经有5人回复
国家级人才课题组招收2026年入学博士
已经有5人回复
Fe3O4@SiO2合成
已经有6人回复
青年基金C终止
已经有4人回复
青椒八年已不青,大家都被折磨成啥样了?
已经有7人回复
为什么nbs上溴 没有产物点出现呢
已经有10人回复
救命帖
已经有11人回复
6楼2016-04-15 09:37:04
2楼2016-04-14 14:45:10
3楼2016-04-14 15:06:20
4楼2016-04-14 18:54:28













回复此楼