| 6 | 1/1 | 返回列表 |
| 查看: 3405 | 回復(fù): 5 | ||
[求助]
FLUENT UDF求助 已有1人參與
|
|
模擬的目標(biāo):使用了fluent14.5的dpm模型中的multicomponent顆粒,模擬尿素水溶液的噴霧干燥過程,想自定義顆粒表面的傳質(zhì)面積 使用的方法:使用宏DEFINE_DPM_HEAT_MASS,將fluent udf manual中DEFINE_DPM_HEAT_MASS的example復(fù)制過來修改 出現(xiàn)的問題:直接復(fù)制DEFINE_DPM_HEAT_MASS的example導(dǎo)入fluent編譯,提示出現(xiàn)語法錯誤,于是我把75行的 if (P_total c->pressure && dydt[0] > 0.) 改為if (P_total > c->pressure && dydt[0] > 0.) ,根據(jù)物理意義當(dāng)氣體的飽和蒸汽壓大于外界壓力時液體沸騰,所以加了一個大于號。編譯掛載沒問題了,計算的時候就出錯,顯示如下 DPM Iteration .... MPI Application rank 1 exited before MPI_Finalize() with status -1073741819 999999 (..\src\mpsystem.c@1172): mpt_read: failed: errno = 10054 999999: mpt_read: error: read failed trying to read 4 bytes: No such file or directory The fl process could not be started. PS:編譯環(huán)境應(yīng)該沒問題,因?yàn)榫幾g掛載過另一個udf是沒問題的。udf如下,也可以參見fluent14.5 udf manual 2.5.4 177頁或者附件的pdf。 /*********************************************************************** UDF for defining the heat and mass transport for multicomponent particle vaporization ***********************************************************************/ #include "udf.h" DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_surf,Z,dydt,dzdt) { int ns; Material *sp; real dens_total = 0.0; /* total vapor density*/ real P_total = 0.0; /* vapor pressure */ int nc = TP_N_COMPONENTS(p); /* number of particle components */ Thread *t0 = P_CELL_THREAD(p); /* thread where the particle is in*/ Material *gas_mix = THREAD_MATERIAL(DPM_THREAD(t0, p)); /* gas mixture material */ Material *cond_mix = P_MATERIAL(p); /* particle mixture material*/ cphase_state_t *c = &(p->cphase); /* cell information of particle location*/ real molwt[MAX_SPE_EQNS]; /* molecular weight of gas species */ real Tp = P_T(p); /* particle temperature */ real mp = P_MASS(p); /* particle mass */ real molwt_bulk = 0.; /* average molecular weight in bulk gas */ real Dp = DPM_DIAM_FROM_VOL(mp / P_RHO(p)); /* particle diameter */ real Ap = DPM_AREA(Dp); /* particle surface */ real Pr = c->sHeat * c->mu / c->tCond; /* Prandtl number */ real Nu = 2.0 + 0.6 * sqrt(p->Re) * pow(Pr, 1./3.); /* Nusselt number */ real h = Nu * c->tCond / Dp; /* Heat transfer coefficient*/ real dh_dt = h * (c->temp - Tp) * Ap; /* heat source term*/ dydt[0] += dh_dt / (mp * Cp); dzdt->energy -= dh_dt; mixture_species_loop(gas_mix,sp,ns) { molwt[ns] = MATERIAL_PROP(sp,PROP_mwi); /* molecular weight of gas species */ molwt_bulk += c->yi[ns] / molwt[ns]; /* average molecular weight */ } /* prevent division by zero */ molwt_bulk = MAX(molwt_bulk,DPM_SMALL); for (ns = 0; ns < nc; ns++) { int gas_index = TP_COMPONENT_INDEX_I(p,ns); /* gas species index of vaporization */ if(gas_index >= 0) { /* condensed material */ Material * cond_c = MIXTURE_COMPONENT(cond_mix, ns); /* vaporization temperature */ real vap_temp = MATERIAL_PROP(cond_c,PROP_vap_temp); /* diffusion coefficient */ real D = MATERIAL_PROP_POLYNOMIAL(cond_c, PROP_binary_diffusivity, c->temp); /* Schmidt number */ real Sc = c->mu / (c->rho * D); /* mass transfer coefficient */ real k = (2. + 0.6 * sqrt(p->Re) * pow(Sc, 1./3.)) * D / Dp; /* bulk gas concentration (ideal gas) */ real cvap_bulk = c->pressure / UNIVERSAL_GAS_CONSTANT / c->temp * c->yi[gas_index] / molwt_bulk / solver_par.molWeight[gas_index]; /* vaporization rate */ real vap_rate = k * molwt[gas_index] * Ap * (cvap_surf[ns] - cvap_bulk); /* no vaporization below vaporization temperature, no condensation */ if (Tp < vap_temp || vap_rate < 0.0) vap_rate = 0.; dydt[1+ns] -= vap_rate; dzdt->species[gas_index] += vap_rate; /* dT/dt = dh/dt / (m Cp)*/ dydt[0] -= hvap[gas_index] * vap_rate / (mp * Cp); /* gas enthalpy source term */ dzdt->energy += hgas[gas_index] * vap_rate; P_total += cvap_surf[ns]; dens_total += cvap_surf[ns] * molwt[gas_index]; } } /* multicomponent boiling */ P_total *= Z * UNIVERSAL_GAS_CONSTANT * Tp; if (P_total > c->pressure && dydt[0] > 0.) { real h_boil = dydt[0] * mp * Cp; /* keep particle temperature constant */ dydt[0] = 0.; for (ns = 0; ns < nc; ns++) { int gas_index = TP_COMPONENT_INDEX_I(p,ns); if (gas_index >= 0) { real boil_rate = h_boil / hvap[gas_index] * cvap_surf[ns] * molwt[gas_index] / dens_total; /* particle component mass source term */ dydt[1+ns] -= boil_rate; /* fluid species source */ dzdt->species[gas_index] += boil_rate; /* fluid energy source */ dzdt->energy += hgas[gas_index] * boil_rate; } } } } |
|
1. 首先,你得確定是你UDF的問題,unload 你的udf,改用常規(guī)的計算模型或者方法,會不會出現(xiàn)同上的問題,有時不一定UDF的問題,是你其他方面的設(shè)置出現(xiàn)問題。 2. 如果是UDF的問題,那么就要好好檢查你的UDF了,用UDF時,最好嚴(yán)格按照UDF指導(dǎo)內(nèi)的宏 進(jìn)行編寫,不要以常規(guī)C編寫習(xí)慣來寫。 3. UDF 中必須明確你聲明 的或者用過的每一個變量,保證不除0,變量最好先聲明,不出現(xiàn)沒有賦值的情況,同時你的值得確保在合理的范圍內(nèi)。 4. 數(shù)據(jù)類型要合理,采用雙精度求解器。 4. 以上你出現(xiàn)的錯誤,個人認(rèn)為可能在讀取數(shù)據(jù) 時出現(xiàn)了問題,不過你首先的排除是不是其他地方出現(xiàn)了問題 |

新蟲 (初入文壇)
銀蟲 (小有名氣)
| 6 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 085600 材料與化工 329分求調(diào)劑 +13 | Mr. Z 2026-03-25 | 13/650 |
|
|---|---|---|---|---|
|
[考研] 296求調(diào)劑 +3 | 彼岸t 2026-03-29 | 3/150 |
|
|
[考研] 352分-085602-一志愿985 +5 | 海納百川Ly 2026-03-29 | 5/250 |
|
|
[考研] 279求調(diào)劑 +4 | 蝶舞輕繞 2026-03-29 | 4/200 |
|
|
[考研] 材料學(xué)碩333求調(diào)劑 +11 | 北道巷 2026-03-24 | 11/550 |
|
|
[考研] 0703 化學(xué) 求調(diào)劑,一志愿山東大學(xué) 342 分 +4 | Shern—- 2026-03-28 | 4/200 |
|
|
[考研] 0703化學(xué)調(diào)劑,求導(dǎo)師收 +9 | 天天好運(yùn)來上岸?/a> 2026-03-24 | 10/500 |
|
|
[考研] 學(xué)碩274求調(diào)劑 +9 | Li李魚 2026-03-26 | 9/450 |
|
|
[考研] 085701求調(diào)劑初試286分 +4 | secret0328 2026-03-28 | 4/200 |
|
|
[考研] 291求調(diào)劑 +15 | hhhhxn.. 2026-03-23 | 21/1050 |
|
|
[考研] 一志愿南京航空航天大學(xué)材料學(xué)碩求調(diào)劑 +3 | @taotao 2026-03-28 | 3/150 |
|
|
[考研] 張芳銘-中國農(nóng)業(yè)大學(xué)-環(huán)境工程專碩-298 +4 | 手機(jī)用戶 2026-03-26 | 4/200 |
|
|
[考博] 26申博 +3 | 加油沖! 2026-03-26 | 3/150 |
|
|
[考研] 286求調(diào)劑 +4 | lim0922 2026-03-26 | 4/200 |
|
|
[考研] 求調(diào)劑 +6 | 林之夕 2026-03-24 | 6/300 |
|
|
[考研] 341求調(diào)劑 +7 | 青檸檬1 2026-03-26 | 7/350 |
|
|
[考研] 085601求調(diào)劑總分293英一數(shù)二 +4 | 鋼鐵大炮 2026-03-24 | 4/200 |
|
|
[考研] 334分 一志愿武理-080500 材料求調(diào)劑 +4 | 李李不服輸 2026-03-25 | 4/200 |
|
|
[考研]
|
黃粱一夢千年 2026-03-24 | 3/150 |
|
|
[考博] 26申博自薦 +3 | whh869393 2026-03-24 | 3/150 |
|