| 查看: 1926 | 回复: 4 | ||
| 【悬赏金币】回答本帖问题,作者cfd菜鸡将赠送您 40 个金币 | ||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | ||
[求助]
这是我编写湿空气冷凝的udf导入fluent后初始化就无法完成,是不是死循环,求大神指导
|
||
|
#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面循环// { 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; |
» 猜你喜欢
职称评审没过,求安慰
已经有48人回复
26申博自荐
已经有3人回复
A期刊撤稿
已经有4人回复
垃圾破二本职称评审标准
已经有17人回复
投稿Elsevier的Neoplasia杂志,到最后选publishing options时页面空白,不能完成投稿
已经有22人回复
EST投稿状态问题
已经有7人回复
毕业后当辅导员了,天天各种学生超烦
已经有4人回复
三无产品还有机会吗
已经有6人回复
4楼2021-09-28 21:22:25
mopsite
木虫 (著名写手)
- 应助: 2 (幼儿园)
- 金币: 8612.7
- 散金: 424
- 红花: 2
- 帖子: 2531
- 在线: 615小时
- 虫号: 172296
- 注册: 2006-01-19
- 专业: 传热传质学
2楼2021-05-12 14:28:33
3楼2021-09-28 21:22:09
5楼2021-10-01 09:45:33













回复此楼
