木蟲 (小有名氣)
老木蟲 ![]()
|
[求助]
UDF的編譯通不過
我從UDF的英文幫助中復(fù)制粘貼下面的內(nèi)容成c程序,通過fluent的udf導(dǎo)入編譯,(Define->user-defined->functions->interpreted)彈出下面的錯誤
cpp -I"C:\Fluent.Inc\fluent6.3.26/src" -I"C:\Fluent.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent.Inc\fluent6.3.26/client/src" -I"C:\Fluent.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="" "E:\計算\冷凝-重試\condensation-2.c"
Error: E:\\274\306\313\343\\300\344\304\375-\326\330\312\324\condensation-2.c: line 9: structure reference not implemented
我看了fluent的“dpm.h”的頭文件,在其中存在這個結(jié)構(gòu),請問大俠,這個是什么原因造成的,怎樣才能解決這個問題。
c程序在附件中也有一份。
/***********************************************************************
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,dydt,dzdt){
int ns;
int nc=TP_N_COMPONENTS(p); /* number of particle components */
//以離散相P確定P所在的單元及線,以及單元,從而找到該單元連續(xù)相的信息。
cell_t c0=RP_CELL(&(p->cCell)); /* cell and thread */
Thread *t0=RP_THREAD(&(p->cCell)); /* where the particle is in */
//離散相和連續(xù)相的材料
Material *gas_mix=THREAD_MATERIAL(t0); /* gas mixture material */
Material *cond_mix=p->injection->material;/* particle mixture material */
cphase_state_t *c=&(p->cphase); /* cell info of particle location */
//連續(xù)相的分子量及平均分子量
real molwt[MAX_SPE_EQNS]; /* molecular weight of gas species */
real molwt_bulk=0.0; /* average molecular weight in bulk gas */
//離散相的信息:溫度、質(zhì)量、粒徑,表面積,普朗特數(shù)Pr,努賽爾德數(shù)Nu,表面對流系數(shù),;
real Tp=P_T(p); /* particle temperature */
real mp=P_MASS(p); /* particle mass */
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.0/3.0); /* Nusselt number 可以從《傳熱傳質(zhì)基本原理》的P270的公式(7.56)*/
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;
//求1/平均分子量的值,在解釋中為平均分子量,實際計算為其倒數(shù),因此在引用時要注意
{
Material *sp;
mixture_species_loop(gas_mix,sp,ns){
molwt[ns]=MATERIAL_PROP(sp,PROP_mwi); /* molecular weight of gas species */
molwt_bulk+=C_YI(c0,t0,ns)/molwt[ns]; /* average molecular weight */
}
}
/* prevent division by zero */
molwt_bulk=MAX(molwt_bulk,DPM_SMALL);
for(ns=0;ns
/* gas species index of vaporization */
int gas_index=TP_COMPONENT_INDEX_I(p,ns);
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+0.6*sqrt(p->Re)*pow(Sc,1.0/3.0))*D/Dp;
/* bulk gas concentration */
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);
/* only condensation below vaporization temperature */
if(0.0
vap_rate=0.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;
}
}
}![]()
1.jpg[ Last edited by llongtan on 2012-11-19 at 15:13 ] |
» 本帖附件資源列表
-
歡迎監(jiān)督和反饋:小木蟲僅提供交流平臺,不對該內(nèi)容負責(zé)。
本內(nèi)容由用戶自主發(fā)布,如果其內(nèi)容涉及到知識產(chǎn)權(quán)問題,其責(zé)任在于用戶本人,如對版權(quán)有異議,請聯(lián)系郵箱:xiaomuchong@tal.com
- 附件 1 : condensation-2.c
2012-11-19 15:09:25, 3.11 K
- 附件 2 : 1.cas
2012-11-19 15:13:59, 892.03 K
- 附件 3 : 1.dat
2012-11-19 15:14:03, 2.54 M
» 收錄本帖的淘帖專輯推薦
» 猜你喜歡
» 本主題相關(guān)價值貼推薦,對您同樣有幫助:
|