| 查看: 3561 | 回復(fù): 11 | |||
leixiaobo713銀蟲 (正式寫手)
|
[求助]
fluent中UDF編譯的問題!
|
|
本人想編的程序是這樣的: 材料是有初始溫度的,而且初始溫度為X(X軸坐標(biāo))的函數(shù);模擬開始后,在很短時間內(nèi)材料的溫度將發(fā)生變化,變化的溫度為初始溫度的函數(shù),在一定時間后(上面提到的很短時間),材料的溫度僅隨流體的流動而自然發(fā)生變化,沒有再生熱源。我變得程序是這樣的,雖然能編譯,但是模擬一開始就出現(xiàn)錯誤,請高手指點(diǎn),本人是小白,謝謝! #include "udf.h" DEFINE_PROFILE(unsteady_temperature,thread,position) { real t, temperature; face_t f; real x; begin_f_loop(f,thread) { t=RP_Get_Real("flow-time" ;if(t<=0.000000001) {temperature=325.0-0.115*x; F_PROFILE(f,thread,position) =temperature+(297.68625-7.37218/(1+exp((temperature-299.65187)/7.97379))); } else F_PROFILE(f,thread,position) =temperature; } end_f_loop(f,thread); } 模擬出現(xiàn)的錯誤提示: Updating solution at time level N... done. iter continuity x-velocity y-velocity energy time/iter chip-exec: unsteady_temperature: wrong return type: float udf function expectedchip-exec: unsteady_temperature: argument 1: incorrect type (36): int expectedchip-exec: unsteady_temperature: argument 2: incorrect type (5): pointer 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: () |

木蟲 (正式寫手)
| 是不是溫度沒有賦初值?如果t<=0.000000001條件達(dá)不到temperature等于多少呢??還有,即使?jié)M足t<=0.000000001,那么x值為多少?x不知道的話,溫度也確定不了了啊 |
銀蟲 (正式寫手)

銀蟲 (正式寫手)
|
#include "udf.h" DEFINE_PROFILE(unsteady_temperature,thread,position) { real t, temperature=298.0; face_t f; real x[ND_ND]; F_CENTROID(x,f,thread); begin_f_loop(f,thread) { t=RP_Get_Real("flow-time" ; if(t>0&&t<=0.1) F_PROFILE(f,thread,position)=temperature; else if(t>=0.1&&t<0.4) { temperature=298.0+5*x[1]; F_PROFILE(f,thread,position) =temperature+(297.68625-7.37218/(1+exp((temperature-299.65187)/7.97379))); } else { temperature=F_PROFILE(f,thread,position); F_PROFILE(f,thread,position) =temperature; } } end_f_loop(f,thread); } 我改成這樣,還是上面的問題啊,請指教! 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: () |

金蟲 (正式寫手)
擊破長空

銀蟲 (正式寫手)

金蟲 (正式寫手)
擊破長空
|
#include "udf.h" DEFINE_PROFILE(unsteady_temperature,thread,position) { real t, temperature=298.0; face_t f; real x[ND_ND]; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); t=RP_Get_Real("flow-time" ;if((t>0)&&(t<=0.1)) F_PROFILE(f,thread,position)=temperature; else if((t>=0.1)&&(t<0.4)) { temperature=298.0+5.*x[1]; F_PROFILE(f,thread,position) =temperature+(297.68625-7.37218/(1.+exp((temperature-299.65187)/7.97379))); } else { F_PROFILE(f,thread,position) =temperature; } } end_f_loop(f,thread); } 我修改了一下你的程序,然后編譯了運(yùn)行。是沒有問題的。 你自己認(rèn)真與修改后的核對一下。 這個程序,一點(diǎn)兒也不難,你用點(diǎn)心,完全可以搞定的。 |

銀蟲 (正式寫手)

專家顧問 (著名寫手)
![]() |
專家經(jīng)驗: +60 |
銀蟲 (正式寫手)

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 312求調(diào)劑 +8 | 陌宸希 2026-03-16 | 9/450 |
|
|---|---|---|---|---|
|
[考研] 0817 化學(xué)工程 299分求調(diào)劑 有科研經(jīng)歷 有二區(qū)文章 +3 | rare12345 2026-03-18 | 3/150 |
|
|
[考研] 303求調(diào)劑 +4 | 睿08 2026-03-17 | 6/300 |
|
|
[考研] 290求調(diào)劑 +10 | ADT 2026-03-11 | 10/500 |
|
|
[考研] 265求調(diào)劑 +3 | 梁梁校校 2026-03-17 | 3/150 |
|
|
[考研] 301求調(diào)劑 +9 | yy要上岸呀 2026-03-17 | 9/450 |
|
|
[考研] 268求調(diào)劑 +7 | 好運(yùn)連綿不絕 2026-03-12 | 8/400 |
|
|
[考研] 302求調(diào)劑 +9 | 負(fù)心者當(dāng)誅 2026-03-11 | 9/450 |
|
|
[考研] 290求調(diào)劑 +6 | 孔志浩 2026-03-12 | 11/550 |
|
|
[考研] 材料與化工專碩調(diào)劑 +5 | heming3743 2026-03-16 | 5/250 |
|
|
[考研] 0703化學(xué)調(diào)劑,求各位老師收留 +8 | 秋有木北 2026-03-14 | 8/400 |
|
|
[考研] 326求調(diào)劑 +3 | mlpqaz03 2026-03-15 | 3/150 |
|
|
[考研] 求老師收留調(diào)劑 +4 | jiang姜66 2026-03-14 | 5/250 |
|
|
[考研] 085601材料工程315分求調(diào)劑 +3 | yang_0104 2026-03-15 | 3/150 |
|
|
[考研] 材料與化工(0856)304求B區(qū)調(diào)劑 +6 | 邱gl 2026-03-12 | 7/350 |
|
|
[考研] 304求調(diào)劑 +6 | Mochaaaa 2026-03-12 | 7/350 |
|
|
[考研] 301求調(diào)劑 +6 | Liyouyumairs 2026-03-11 | 6/300 |
|
|
[考研] 材料工程調(diào)劑 +4 | 咪咪空空 2026-03-11 | 4/200 |
|
|
[考研] 290求調(diào)劑 +3 | ADT 2026-03-13 | 3/150 |
|
|
[考研] 283求調(diào)劑,材料、化工皆可 +8 | 蘇打水7777 2026-03-11 | 10/500 |
|