| 5 | 1/1 | 返回列表 |
| 查看: 3407 | 回復(fù): 5 | ||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | ||
ichabod銀蟲(chóng) (初入文壇)
|
[求助]
FLUENT UDF求助 已有1人參與
|
|
|
模擬的目標(biāo):使用了fluent14.5的dpm模型中的multicomponent顆粒,模擬尿素水溶液的噴霧干燥過(guò)程,想自定義顆粒表面的傳質(zhì)面積 使用的方法:使用宏DEFINE_DPM_HEAT_MASS,將fluent udf manual中DEFINE_DPM_HEAT_MASS的example復(fù)制過(guò)來(lái)修改 出現(xiàn)的問(wèn)題:直接復(fù)制DEFINE_DPM_HEAT_MASS的example導(dǎo)入fluent編譯,提示出現(xiàn)語(yǔ)法錯(cuò)誤,于是我把75行的 if (P_total c->pressure && dydt[0] > 0.) 改為if (P_total > c->pressure && dydt[0] > 0.) ,根據(jù)物理意義當(dāng)氣體的飽和蒸汽壓大于外界壓力時(shí)液體沸騰,所以加了一個(gè)大于號(hào)。編譯掛載沒(méi)問(wèn)題了,計(jì)算的時(shí)候就出錯(cuò),顯示如下 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)該沒(méi)問(wèn)題,因?yàn)榫幾g掛載過(guò)另一個(gè)udf是沒(méi)問(wèn)題的。udf如下,也可以參見(jiàn)fluent14.5 udf manual 2.5.4 177頁(yè)或者附件的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的問(wèn)題,unload 你的udf,改用常規(guī)的計(jì)算模型或者方法,會(huì)不會(huì)出現(xiàn)同上的問(wèn)題,有時(shí)不一定UDF的問(wèn)題,是你其他方面的設(shè)置出現(xiàn)問(wèn)題。 2. 如果是UDF的問(wèn)題,那么就要好好檢查你的UDF了,用UDF時(shí),最好嚴(yán)格按照UDF指導(dǎo)內(nèi)的宏 進(jìn)行編寫(xiě),不要以常規(guī)C編寫(xiě)習(xí)慣來(lái)寫(xiě)。 3. UDF 中必須明確你聲明 的或者用過(guò)的每一個(gè)變量,保證不除0,變量最好先聲明,不出現(xiàn)沒(méi)有賦值的情況,同時(shí)你的值得確保在合理的范圍內(nèi)。 4. 數(shù)據(jù)類型要合理,采用雙精度求解器。 4. 以上你出現(xiàn)的錯(cuò)誤,個(gè)人認(rèn)為可能在讀取數(shù)據(jù) 時(shí)出現(xiàn)了問(wèn)題,不過(guò)你首先的排除是不是其他地方出現(xiàn)了問(wèn)題 |

銀蟲(chóng) (初入文壇)
新蟲(chóng) (初入文壇)
銀蟲(chóng) (小有名氣)
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 材料與化工272求調(diào)劑 +15 | 阿斯蒂芬2004 2026-03-28 | 15/750 |
|
|---|---|---|---|---|
|
[考研] 300求調(diào)劑,材料科學(xué)英一數(shù)二 +10 | leaflight 2026-03-24 | 10/500 |
|
|
[考研] 294分080500材料科學(xué)與工程求調(diào)劑 +8 | 柳溪邊 2026-03-26 | 8/400 |
|
|
[考研] 22408 359分調(diào)劑 +4 | Qshers 2026-03-27 | 6/300 |
|
|
[考研] 349求調(diào)劑 +6 | 李木子啊哈哈 2026-03-25 | 6/300 |
|
|
[考研] 學(xué)碩274求調(diào)劑 +9 | Li李魚(yú) 2026-03-26 | 9/450 |
|
|
[考研] 一志愿北化085600材料專碩275|有文章專利|求調(diào)劑 +7 | Micky11223 2026-03-25 | 7/350 |
|
|
[考研] 一志愿中南大學(xué)化學(xué)0703總分337求調(diào)劑 +5 | niko- 2026-03-27 | 5/250 |
|
|
[考研] 266分,求材料冶金能源化工等調(diào)劑 +7 | 哇呼哼呼哼 2026-03-27 | 9/450 |
|
|
[考研] 085404求調(diào)劑,總分309,本科經(jīng)歷較為豐富 +4 | 來(lái)財(cái)aa 2026-03-25 | 4/200 |
|
|
[考研] 材料求調(diào)劑 +5 | .m.. 2026-03-25 | 5/250 |
|
|
[考研] 一志愿陜師大生物學(xué)071000,298分,求調(diào)劑 +5 | SYA! 2026-03-23 | 5/250 |
|
|
[考研] 317求調(diào)劑 +7 | 蛋黃咸肉粽 2026-03-26 | 7/350 |
|
|
[考研] 342求調(diào)劑 +3 | 加油a李zs 2026-03-26 | 3/150 |
|
|
[考研] 290分調(diào)劑求助 +3 | 吉祥止止陳 2026-03-25 | 3/150 |
|
|
[考研] 考研一志愿蘇州大學(xué)初始315(英一)求調(diào)劑 +3 | sbdksD 2026-03-24 | 4/200 |
|
|
[考研] 求調(diào)劑 +3 | 李李不服輸 2026-03-25 | 3/150 |
|
|
[考研] 材料專碩找調(diào)劑 +5 | 哈哈哈吼吼吼哈 2026-03-23 | 5/250 |
|
|
[考研] 求調(diào)劑 +6 | 研研,接電話 2026-03-24 | 7/350 |
|
|
[考研] 080500求調(diào)劑 +3 | zzzzfan 2026-03-24 | 3/150 |
|