| 8 | 1/1 | 返回列表 |
| 查看: 1399 | 回復(fù): 7 | ||
[求助]
關(guān)于UDF時(shí)間項(xiàng)問題求助
|
| 例如求解非穩(wěn)態(tài)導(dǎo)熱問題,其中熱源項(xiàng)是溫度+時(shí)間函數(shù)(即熱源項(xiàng)是溫度的分段函數(shù),且與溫度大于分段溫度后經(jīng)歷的時(shí)間t有關(guān))。問題為:由Q=F(T)*F(t),非穩(wěn)態(tài)求解怎樣記錄單元格溫度大于分段溫度后所經(jīng)歷的時(shí)間t |
木蟲 (著名寫手)
|
我只知道當(dāng)前時(shí)間的求解是用宏t=CURRENT_TIME,如果你在模擬之前能確定單元格溫度等于分段溫度所經(jīng)歷時(shí)間的話,大于分段溫度后所經(jīng)歷的時(shí)間只需用當(dāng)前時(shí)間減去等于時(shí)間就好了。如果不能確定,是不是可以先模擬到兩個(gè)溫度相等的情形,然后記錄下這個(gè)時(shí)間,后面就可以直接相減了。 我不太懂你這個(gè)問題,僅供參考。 [ 發(fā)自手機(jī)版 http://www.gaoyang168.com/3g ] |

金蟲 (小有名氣)
鐵桿木蟲 (正式寫手)
|
#include "udf.h" #define T0 0 #define T1 100 #define T2 200 #define T3 300 #define T4 400 real time DEFINE_SOURCE(xmom_source,c,t,dS,eqn) { real writetime[4]; int count[4] = {0}; if(C_T(c,t)>=T0 && count[0] == 0) { writetime[0] = CURRENT_TIME; count[0] = 1; } if(C_T(c,t)>T1 && C_T(c,t)<=T2 && count[1] == 0) { writetime[1] = CURRENT_TIME; count[1] = 1; } if(C_T(c,t)>T2 && C_T(c,t)<=T3 && count[2] == 0) { writetime[2] = CURRENT_TIME; count[2] = 1; } if(C_T(c,t)>T3 && C_T(c,t)<=T4 && count[3] == 0) { writetime[3] = CURRENT_TIME; count[3] = 1; } source = F(T)*F(t); dS[eqn] = 0.0; return source; } 這個(gè)結(jié)構(gòu)可否? |

鐵桿木蟲 (正式寫手)
|
#include "udf.h" #define T0 0 #define T1 100 #define T2 200 #define T3 300 #define T4 400 #define CellNum 10000 //fluent 網(wǎng)格(cell)的個(gè)數(shù) //fluent cell的結(jié)構(gòu)體 typedef struct FLUENT_CELL_struct { int count[4]; real writetime[4]; }FLUENT_CELL; //定義fluent_cell FLUENT_CELL fluent_cell[CellNum]; fluent cell時(shí)間記錄器初始化 void FLUENT_CELL_Initialize(void) { int i, n; cell_t c; Thread *t; Domain *d; d = Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { for(i=0; i<4; i++) { fluent_cell[c].count = 0; fluent_cell[c].writetime = 0.0; } } end_c_loop(c, t) } } //數(shù)據(jù)初始化 DEFINE_INIT(reck_time_init,d) { FLUENT_CELL_Initialize(); } //源項(xiàng)添加 DEFINE_SOURCE(heat_generate_source,c,t,dS,eqn) { if(C_T(c,t)>=T0 && count[0] == 0) { fluent_cell[c].writetime[0] = CURRENT_TIME; count[0] = 1; } if(C_T(c,t)>T1 && C_T(c,t)<=T2 && count[1] == 0) { fluent_cell[c].writetime[1] = CURRENT_TIME; count[1] = 1; } if(C_T(c,t)>T2 && C_T(c,t)<=T3 && count[2] == 0) { fluent_cell[c].writetime[2] = CURRENT_TIME; count[2] = 1; } if(C_T(c,t)>T3 && C_T(c,t)<=T4 && count[3] == 0) { fluent_cell[c].writetime[3] = CURRENT_TIME; count[3] = 1; } source = F(T)*F(t); dS[eqn] = 0.0; return source; } DEFINE_SOURCE(heat_generate_source,c,t,dS,eqn)里面有c,t(cell, thread)表示每次只計(jì)算一個(gè)單元的。 |

| 8 | 1/1 | 返回列表 |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
百度網(wǎng)盤 |
360云盤 |
千易網(wǎng)盤 |
華為網(wǎng)盤
在新窗口頁面中打開自己喜歡的網(wǎng)盤網(wǎng)站,將文件上傳后,然后將下載鏈接復(fù)制到帖子內(nèi)容中就可以了。 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 材料專碩英一數(shù)二306 +5 | z1z2z3879 2026-03-18 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 0703化學(xué)調(diào)劑 +8 | 妮妮ninicgb 2026-03-15 | 12/600 |
|
|
[考研] 294求調(diào)劑材料與化工專碩 +5 | 陌の森林 2026-03-18 | 5/250 |
|
|
[教師之家] 焦慮 +8 | 水冰月月野兔 2026-03-13 | 12/600 |
|
|
[考研] 化學(xué)工程321分求調(diào)劑 +15 | 大米飯! 2026-03-15 | 18/900 |
|
|
[考研] 070300化學(xué)319求調(diào)劑 +6 | 錦鯉0909 2026-03-17 | 6/300 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | pupcoco 2026-03-17 | 7/350 |
|
|
[考研] 材料與化工求調(diào)劑 +6 | 為學(xué)666 2026-03-16 | 6/300 |
|
|
[考研] 材料與化工專碩調(diào)劑 +5 | heming3743 2026-03-16 | 5/250 |
|
|
[考研] [導(dǎo)師推薦]西南科技大學(xué)國防/材料導(dǎo)師推薦 +3 | 尖角小荷 2026-03-16 | 6/300 |
|
|
[考研] 304求調(diào)劑 +4 | ahbd 2026-03-14 | 4/200 |
|
|
[考研] 070303 總分349求調(diào)劑 +3 | LJY9966 2026-03-15 | 5/250 |
|
|
[考研] 0703 物理化學(xué)調(diào)劑 +3 | 我可以上岸的對(duì)?/a> 2026-03-13 | 5/250 |
|
|
[考研] 26考研一志愿中國石油大學(xué)(華東)305分求調(diào)劑 +3 | 嘉年新程 2026-03-15 | 3/150 |
|
|
[考研] 本科南京大學(xué)一志愿川大藥學(xué)327 +3 | 麥田耕者 2026-03-14 | 3/150 |
|
|
[考研] 265求調(diào)劑 +4 | 威化餅07 2026-03-12 | 4/200 |
|
|
[考研] 297求調(diào)劑 +4 | 學(xué)海漂泊 2026-03-13 | 4/200 |
|
|
[考研] 材料專碩350 求調(diào)劑 +4 | 王金科 2026-03-12 | 4/200 |
|
|
[考研] 274求調(diào)劑 +3 | S.H1 2026-03-12 | 3/150 |
|
|
[考研] 290求調(diào)劑 +3 | ADT 2026-03-13 | 3/150 |
|