24小时热门版块排行榜    

查看: 2126  |  回复: 3

Monkeystar

新虫 (初入文坛)

[求助] 求大神仅仅是解释一下fluent帮助文件中的这个udf

int、real这些是定义数据类型我知道,Nu是努塞尔数,Sc是施密特数这些我也知道,
主要是:1、加粗的部分不懂。2、有箭头的东西不太懂,如c->yi[ns],这个c到底是什么,怎么可以弄出yi、密度这些东西。3、cvap_surf[ns]是什么、gas_index又是什么,气体指数?具体是指哪个物理量

udf如下(帮助文件udf篇中的2.5.5.3处):


#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 T,Dso2_l,kso2_l,Dso2_g,Sc,kso2_g,Dca,Kso2_G,tp,Cca,Hso2,Cso2_i,a,e,b;
   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 = DPM_BINARY_DIFFUSIVITY(p,cond_c,P_T(p));
       /* 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;
               }
          }
     }
}
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Monkeystar

新虫 (初入文坛)

别沉啊
2楼2018-04-19 18:24:36
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Monkeystar

新虫 (初入文坛)

算是懂了吧,不知道怎么删除本贴,如果版主看到了就删了吧
3楼2018-04-21 00:39:51
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

keen_xq

铁虫 (小有名气)

引用回帖:
3楼: Originally posted by Monkeystar at 2018-04-21 00:39:51
算是懂了吧,不知道怎么删除本贴,如果版主看到了就删了吧

楼主,这些带箭头的量应该是引用结构体里的数据。 我现在也遇到了相同的问题,UDF手册中有很多查不到的宏,还有一些类似你贴出来的莫名其妙的引用,楼主你是如何解决的,有相关资料吗??谢谢了
勿忘初心,方得始终。
4楼2018-08-20 22:06:26
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 Monkeystar 的主题更新
信息提示
请填处理意见