| 24小時熱門版塊排行榜 |
| 9 | 1/1 | 返回列表 |
| 查看: 2498 | 回復: 8 | ||
azhu081127銅蟲 (初入文壇)
|
[求助]
求解答--UDF中DEFINE_ADJUST報錯 已有2人參與
|
|
以前使用過簡單的DEFINE_PROFILE語句來定義入口邊界條件,可能因為語句比較簡單,所以沒有出現(xiàn)過問題。 但最近在用FLUENT做室內(nèi)熱舒適評價的過程中卻遇到諸多問題。為逐步解決這些問題,我決定先從最簡單的計算出發(fā),一步步解決。 但是,沒想到,下面兩個簡單的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功能,則可以正常運行得出結(jié)果。 (2)但若使用Compile功能,則會出現(xiàn)如下錯誤提示: # 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編譯出現(xiàn)錯誤? 二、 對于自己編寫一個求解攝氏度的非常簡單程序: #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功能,則出現(xiàn)與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出現(xiàn)錯誤? (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? |
銅蟲 (初入文壇)
銅蟲 (初入文壇)
銅蟲 (初入文壇)
銅蟲 (初入文壇)
銅蟲 (初入文壇)
| 9 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 292分,材料與化工,申請調(diào)劑 +18 | 程晴之 2026-04-01 | 20/1000 |
|
|---|---|---|---|---|
|
[考研] 282求調(diào)劑 +17 | ycy1201 2026-04-01 | 19/950 |
|
|
[考研] 288求調(diào)劑 一志愿哈工大 材料與化工 +28 | 洛神哥哥 2026-03-31 | 28/1400 |
|
|
[考研] 271求調(diào)劑 +14 | 勒布朗@ 2026-03-31 | 18/900 |
|
|
[考研] 085601材料工程找調(diào)劑 +20 | oatmealR 2026-03-29 | 21/1050 |
|
|
[考研] 265求調(diào)劑 +11 | yelck 2026-04-01 | 12/600 |
|
|
[考研] 求調(diào)劑 +4 | 圖鑒212 2026-03-30 | 5/250 |
|
|
[考研] 288資源與環(huán)境專碩求調(diào)劑,不限專業(yè),有學上就行 +25 | lllllos 2026-03-30 | 26/1300 |
|
|
[考研] 求調(diào)劑,一志愿北林食品與營養(yǎng)095500,301分,已過六級,有科研經(jīng)歷 +4 | 快樂儲蓄罐 2026-03-31 | 4/200 |
|
|
[考研] 考研調(diào)劑 +9 | 小蠟新筆 2026-03-29 | 10/500 |
|
|
[考研] 一志愿華東師范大學有機化學專業(yè),初試351分,復試被刷求調(diào)劑! +9 | 真名有冰 2026-03-29 | 10/500 |
|
|
[考研] 一志愿南昌大學324求調(diào)劑 +6 | hanamiko 2026-03-29 | 6/300 |
|
|
[考研] 085601 材料工程 313分 求調(diào)劑 +6 | Ong3 2026-03-27 | 6/300 |
|
|
[考博] 材料專業(yè)申博 +5 | 杜雨婷dyt 2026-03-29 | 5/250 |
|
|
[考研] 一志愿大連理工大學,機械工程學碩,341 +3 | 西瓜田的守望者 2026-03-30 | 3/150 |
|
|
[考研] 085600,專業(yè)課化工原理,320分求調(diào)劑 +6 | 大饞小子 2026-03-29 | 6/300 |
|
|
[考研] 334分 一志愿武理 材料求調(diào)劑 +16 | 李李不服輸 2026-03-26 | 16/800 |
|
|
[考研] 11408軟件工程求調(diào)劑 +3 | Qiu學ing 2026-03-28 | 3/150 |
|
|
[考研] 藥學105500求調(diào)劑 +3 | Ssun。。 2026-03-28 | 3/150 |
|
|
[考研] 打過很多競賽,085406控制工程300分,求調(diào)劑 +3 | askeladz 2026-03-26 | 3/150 |
|