| 5 | 1/1 | 返回列表 |
| 查看: 2046 | 回復: 4 | ||
| 【懸賞金幣】回答本帖問題,作者cfd菜雞將贈送您 40 個金幣 | ||
[求助]
這是我編寫濕空氣冷凝的udf導入fluent后初始化就無法完成,是不是死循環(huán),求大神指導
|
||
|
#include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "mem.h" #define LAT_HT 2.257e6 #define WALL_NUMBER 3 #define scdomain_index 3 #define prim_index 0 #define index_evap_primary 1 int phase_domain_index; real face_center[ND_ND], cell_center[ND_ND], a[ND_ND], distance; real p_op, p, diffusivity; real cell_vapor_pressure, wall_temper, wall_pressure, wall_mass_fraction; real NV_VEC(A); real area, area_density, mass_transfer_coeff; real water_temper, water_satpressure, water_mass_fraction; real vapor_density; int n; Domain *subdomain; cell_t c; Thread *t; Thread **pt; Thread *tp; Thread *ts; Thread *tf, *tb; face_t fa; face_t fb; real source; DEFINE_SOURCE(vap_src, cell, first, dS, eqn) { Thread *mixer, *sec_th; real m_dot_first; real mass_dot; mixer = THREAD_SUPER_THREAD(first); sec_th = THREAD_SUB_THREAD(mixer, 1); real Db; real water_mass_fiction; real area; real volume; begin_c_loop(cell,mixer) { volume = C_VOLUME(cell, mixer);//網格體積// c_face_loop(cell, mixer, n)//對所有cell面循環(huán)// { fa = C_FACE(cell, mixer, n);//獲取面指針// tf = C_FACE_THREAD(cell, mixer, n);//獲取面所在thread指針// if (THREAD_ID(tf) == WALL_NUMBER) //判斷是否為壁面網格// { if (C_VOF(cell, sec_th) == 1.) //判斷液體是否充滿壁面// mass_dot = 0.0; //質量源為0// else { C_CENTROID(cell_center, cell, mixer);//獲取cell中心坐標// F_CENTROID(face_center, fa, tf);//獲取面中心坐標// NV_VV(a, =, cell_center, -, face_center);//體心到面心矢量// distance = NV_MAG(a);//體心到面心距離// F_AREA(A, fa, tf);//面積矢量// area = NV_MAG(A);//面積// wall_temper = F_T(fa, tf) - 273.15;//獲取壁面溫度攝氏度// Db = (4.709 + 0.196 * wall_temper + 0.006122 * wall_temper * wall_temper + 0.0004386 * wall_temper * wall_temper * wall_temper) / 1000;//壁面溫度對應飽和含濕量// water_mass_fiction = C_YI(cell, first, 0);//水蒸氣質量分數// if (water_mass_fiction > Db) { mass_dot = -C_R(cell, first) * 0.256 * 0.0001 * (water_mass_fiction - Db) / distance * area/volume;//質量源求解公式// dS[eqn] = 0; } } } } } end_c_loop(cell,mixer) return mass_dot; } DEFINE_SOURCE(liq_src, cell, second, dS, eqn) { Thread *mix_th, *fir_th; real mass_dot; real Db; real water_mass_fiction; real area; real volume; mix_th = THREAD_SUPER_THREAD(second); fir_th = THREAD_SUB_THREAD(mix_th, 1); begin_c_loop(cell, mix_th) { volume = C_VOLUME(cell, mix_th);//網格體積// c_face_loop(cell, mix_th, n) { fa = C_FACE(cell, mix_th, n); tf = C_FACE_THREAD(cell, mix_th, n); if (THREAD_ID(tf) == WALL_NUMBER) { if (C_VOF(cell, fir_th) == 1.) mass_dot = 0.0; else { C_CENTROID(cell_center, cell, mix_th); F_CENTROID(face_center, fa, tf); NV_VV(a, =, cell_center, -, face_center); distance = NV_MAG(a); F_AREA(A, fa, tf);//面積矢量// area = NV_MAG(A);//面積// wall_temper = F_T(fa, tf) - 273.15; Db = (4.709 + 0.196 * wall_temper + 0.006122 * wall_temper * wall_temper + 0.0004386 * wall_temper * wall_temper * wall_temper) / 1000; water_mass_fiction = C_YI(cell, second, 0); if (water_mass_fiction > Db) { mass_dot = C_R(cell, second) * 0.256 * 0.0001 * (water_mass_fiction - Db) / distance * area / volume; dS[eqn] = 0; } } } } } end_c_loop(cell, mixer) return mass_dot; } DEFINE_SOURCE(enrg_src, cell, mixer, dS, eqn) { Thread* first, * sec_th; real m_dot; real mass_dot; first = THREAD_SUB_THREAD(mixer, 0); sec_th = THREAD_SUB_THREAD(mixer, 1); real Db; real water_mass_fiction; real area; real volume; begin_c_loop(cell, mixer) { c_face_loop(cell, mixer, n) { fa = C_FACE(cell, mixer, n); tf = C_FACE_THREAD(cell, mixer, n); if (THREAD_ID(tf) == WALL_NUMBER) { if (C_VOF(cell, sec_th) == 1.) mass_dot = 0.0; else { C_CENTROID(cell_center, cell, mixer); F_CENTROID(face_center, fa, tf); NV_VV(a, =, cell_center, -, face_center); distance = NV_MAG(a); F_AREA(A, fa, tf);//面積矢量// area = NV_MAG(A);//面積// wall_temper = F_T(fa, tf) - 273.15; Db = (4.709 + 0.196 * wall_temper + 0.006122 * wall_temper * wall_temper + 0.0004386 * wall_temper * wall_temper * wall_temper) / 1000; water_mass_fiction = C_YI(cell, first, 0); if (water_mass_fiction > Db) { mass_dot = -C_R(cell, first) * 0.256 * 0.0001 * (water_mass_fiction - Db) / distance * area / volume; dS[eqn] = 0; } } } } } end_c_loop(cell, mixer) return mass_dot * LAT_HT; |
木蟲 (著名寫手)
新蟲 (小有名氣)
新蟲 (小有名氣)
新蟲 (小有名氣)
| 5 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 材料調劑 +4 | L9370 2026-03-05 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 接收調劑 +19 | 津萌津萌 2026-03-02 | 29/1450 |
|
|
[考研] 080500材料科學與工程 +11 | 202114020319 2026-03-03 | 11/550 |
|
|
[考研] 283求調劑 +10 | 鹿沫笙 2026-03-02 | 11/550 |
|
|
[考研] 材料085600 303求調劑 +7 | 1bygone 2026-03-04 | 7/350 |
|
|
[考研] 0856材料求調劑 +17 | hyf hyf hyf 2026-02-28 | 18/900 |
|
|
[考研] 22408-273求調劑-擔任3個項目的負責人-1篇國際期刊論文(一作)1篇核心期刊論文在投。 +3 | 沒想好取什么名 2026-03-03 | 3/150 |
|
|
[考研] 286 +6 | ksncj 2026-03-04 | 6/300 |
|
|
[考研] 本科太原理工采礦工程,求調劑 +3 | onlx 2026-03-01 | 3/150 |
|
|
[考研] 325求調劑 +5 | 學家科 2026-03-04 | 5/250 |
|
|
[考研] 291求調劑 +4 | Afy123456 2026-03-03 | 7/350 |
|
|
[考研] 306求調劑 +7 | 張張張張oo 2026-03-03 | 7/350 |
|
|
[考研] 298求調劑 +3 | 人間唯你是清歡 2026-03-03 | 4/200 |
|
|
[考研] 292求調劑 +3 | sgbl 2026-03-03 | 3/150 |
|
|
[考研] 284求調劑 +6 | 天下熯 2026-03-02 | 6/300 |
|
|
[考研] 11408,學碩276求調劑 +3 | 崔wj 2026-03-02 | 5/250 |
|
|
[考研] 306分材料調劑 +5 | chuanzhu川燭 2026-03-01 | 6/300 |
|
|
[考研] 一志愿山東大學材料與化工325求調劑 +5 | 半截的詩0927 2026-03-02 | 5/250 |
|
|
[考研] 材料調劑 +6 | 愛擦汗的可樂冰 2026-02-28 | 7/350 |
|
|
[考研] 322求調劑 +3 | 熊境喆 2026-03-01 | 3/150 |
|