| 5 | 1/1 | 返回列表 |
| 查看: 2047 | 回復: 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);//網(wǎng)格體積// 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) //判斷是否為壁面網(wǎng)格// { if (C_VOF(cell, sec_th) == 1.) //判斷液體是否充滿壁面// mass_dot = 0.0; //質(zhì)量源為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);//水蒸氣質(zhì)量分數(shù)// if (water_mass_fiction > Db) { mass_dot = -C_R(cell, first) * 0.256 * 0.0001 * (water_mass_fiction - Db) / distance * area/volume;//質(zhì)量源求解公式// 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);//網(wǎng)格體積// 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ā)表 | |
|---|---|---|---|---|
|
[考研] 304求調(diào)劑 +3 | 52hz~~ 2026-03-05 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 328求調(diào)劑 +6 | vuzhdkfjkx 2026-03-04 | 7/350 |
|
|
[考研] 271求調(diào)劑 +7 | 月色c 2026-03-05 | 8/400 |
|
|
[考研] 0703 東華大學 理學化學均過 a 線,總分 281 求調(diào)劑 +4 | 香香 Lu 2026-03-03 | 8/400 |
|
|
[考研] 紡織、生物、化學、材料等專業(yè) +3 | Eember. 2026-03-05 | 7/350 |
|
|
[考研] 材料類考研調(diào)劑 +7 | gemmgemm 2026-03-01 | 8/400 |
|
|
[考研] 302材料工程求調(diào)劑 +7 | Doleres 2026-03-01 | 8/400 |
|
|
[考研] 0703化學 學碩 理工科均可 不區(qū)分研究方向 總分279求調(diào)劑 +7 | 1一11 2026-03-03 | 7/350 |
|
|
[考研] 調(diào)劑材料學碩 +6 | 詞凝Y 2026-03-02 | 6/300 |
|
|
[考研] 求調(diào)劑院校 +6 | 云朵452 2026-03-02 | 12/600 |
|
|
[考研] 293求調(diào)劑 +3 | 是樂渝哇 2026-03-04 | 3/150 |
|
|
[考研] 286 +6 | ksncj 2026-03-04 | 6/300 |
|
|
[考研] 266求調(diào)劑 +7 | 哇塞王帥 2026-03-03 | 7/350 |
|
|
[考研] 一志愿鄭州大學,學碩,物理化學, 333求調(diào)劑 +5 | 李魔女斗篷 2026-03-04 | 5/250 |
|
|
[考研] 本科太原理工采礦工程,求調(diào)劑 +3 | onlx 2026-03-01 | 3/150 |
|
|
[考研] 一志愿314求調(diào)劑 +7 | 202111120625 2026-03-03 | 7/350 |
|
|
[考研] 347分電子信息專碩求調(diào)劑 +3 | 咕嘟咕嘟1 2026-03-03 | 3/150 |
|
|
[考研] 化工335求調(diào)劑 +5 | 摸摸貓貓頭 2026-03-02 | 5/250 |
|
|
[考研] 0856調(diào)劑 +10 | 劉夢微 2026-02-28 | 10/500 |
|
|
[考研] 一志愿鄭大材料學碩298分,求調(diào)劑 +6 | wsl111 2026-03-01 | 6/300 |
|