| 9 | 1/1 | 返回列表 |
| 查看: 2496 | 回復(fù): 8 | ||
azhu081127銅蟲 (初入文壇)
|
[求助]
求解答--UDF中DEFINE_ADJUST報錯 已有2人參與
|
|
以前使用過簡單的DEFINE_PROFILE語句來定義入口邊界條件,可能因?yàn)檎Z句比較簡單,所以沒有出現(xiàn)過問題。 但最近在用FLUENT做室內(nèi)熱舒適評價的過程中卻遇到諸多問題。為逐步解決這些問題,我決定先從最簡單的計(jì)算出發(fā),一步步解決。 但是,沒想到,下面兩個簡單的UDF竟然會如此棘手。。。 求好心的朋友們幫忙解答~~感謝萬分~~~ 一、FLUENT UDF tutorial中關(guān)于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功能,則可以正常運(yùn)行得出結(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) 關(guān)于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ā)表 | |
|---|---|---|---|---|
|
[考研] 材料調(diào)劑 +9 | Eujd1 2026-03-31 | 10/500 |
|
|---|---|---|---|---|
|
[考研] 284求調(diào)劑 +9 | 小熊~~ 2026-03-31 | 9/450 |
|
|
[考研] 求調(diào)劑 生物學(xué) 377分 +6 | zzll03 2026-03-31 | 6/300 |
|
|
[考研] 315求調(diào)劑 +6 | akie... 2026-03-28 | 7/350 |
|
|
[考研] 334分 一志愿武理-080500 材料求調(diào)劑 +9 | 李李不服輸 2026-03-25 | 9/450 |
|
|
[考研] 367求調(diào)劑 +7 | 芋泥啵啵… 2026-03-28 | 7/350 |
|
|
[考研] 一志愿211,335分,0856,求調(diào)劑院校和導(dǎo)師 +10 | 傾____蕭 2026-03-27 | 11/550 |
|
|
[考研] 吉大生物學(xué)326分求調(diào)劑 +3 | sunnyupup 2026-03-31 | 3/150 |
|
|
[考研] 08工科求調(diào)劑286 +5 | tgs_001 2026-03-28 | 5/250 |
|
|
[考研] 289求調(diào)劑 +16 | 新時代材料 2026-03-27 | 16/800 |
|
|
[考研] 環(huán)境科學(xué)與工程334分求調(diào)劑 +6 | 王一一依依 2026-03-30 | 8/400 |
|
|
[考研] 085404求調(diào)劑,總分309,本科經(jīng)歷較為豐富 +6 | 來財(cái)aa 2026-03-25 | 6/300 |
|
|
[考研] 318一志愿吉林大學(xué)生物與醫(yī)藥 求調(diào)劑 +5 | 篤行致遠(yuǎn). 2026-03-28 | 5/250 |
|
|
[考研] 356求調(diào)劑 +4 | gysy?s?a 2026-03-28 | 4/200 |
|
|
[考研] 本科新能源科學(xué)與工程,一志愿華理能動285求調(diào)劑 +7 | AZMK 2026-03-28 | 11/550 |
|
|
[考研] 壓國家一區(qū)線,求導(dǎo)師收留,有恩必謝! +7 | 迷人的哈哈 2026-03-28 | 7/350 |
|
|
[考研] 283求調(diào)劑 +7 | A child 2026-03-28 | 7/350 |
|
|
[考研] 308求調(diào)劑 +7 | 墨墨漠 2026-03-27 | 7/350 |
|
|
[考研] 305求調(diào)劑 +5 | 哇盧卡庫 2026-03-26 | 5/250 |
|
|
[考研] 302求調(diào)劑 +4 | 錦衣衛(wèi)藤椒 2026-03-25 | 4/200 |
|