2.5.5.  DEFINE_DPM_HEAT_MASS

2.5.5.1. Description

You can use DEFINE_DPM_HEAT_MASS to specify the heat and mass transfer of multicomponent particles to the gas phase.

When a DEFINE_DPM_HEAT_MASS UDF is activated, then the number of species that can be referenced and interact with the particles via the UDF is limited to those with a species index less than the maximum UDF species number, defined using the TUI command define/models/dpm/options/maximum-udf-species. The default number for maximum-udf-species is 50.

2.5.5.2. Usage

DEFINE_DPM_HEAT_MASS (name, tp, C_p, hgas, hvap, cvap_surf, Z, dydt, dzdt)

Argument Type

Description

symbol name

UDF name.

Tracked_Particle *tp

Pointer to the Tracked_Particle data structure which contains data related to the particle being tracked.

real C_p

Particle heat capacity.

real *hgas

Enthalpies of vaporizing gas phase species.

real *hvap

Vaporization enthalpies of vaporizing components.

real *cvap_surf

Vapor equilibrium concentrations of vaporizing components.

real Z

Compressibility,

real *dydt

Source terms of the particle temperature and component masses.

dpms_t *dzdt

Source terms of the gas phase enthalpy and species masses.

Function returns

void

There are eight arguments to DEFINE_DPM_HEAT_MASS: name, tp, C_p, hgas, hvap, cvap_surf, Z, dydt, and dzdt. You supply name, the name of the UDF. tp, C_p, hgas, hvap, cvap_surf, and Z are variables that are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to compute the particle and gas phase source terms and store the values in dydt and dzdt, respectively.

2.5.5.3. Example

The following is an example of a compiled UDF that uses DEFINE_DPM_HEAT_MASS. It implements the source terms for the following:

Source Term

Variable

Unit

particle temperature

dydt[0]

K/s

particle component mass

dydt[1..]

kg/s

gas phase enthalpy

dzdt->energy

J/s

gas phase species mass

dzdt->species[0..]

kg/s

/***********************************************************************
   UDF for defining the heat and mass transport for
   multicomponent particle vaporization
 ***********************************************************************/
 #include "udf.h"
 #include "dpm_mem.h"
 
 DEFINE_DPM_HEAT_MASS(multivap,tp,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(tp);   /* number of particle components */
   Thread *t0 = TP_CELL_THREAD(tp);   /* thread where the particle is in*/
   Material *gas_mix = THREAD_MATERIAL(DPM_THREAD(t0, tp)); /* gas mixture
   material */
   Material *cond_mix = TP_MATERIAL(tp); /* particle mixture material*/
   cphase_state_t *c = &(tp->cphase[0]); /* cell information of particle location*/
   real molwt[MAX_SPE_EQNS]; /* molecular weight of gas species */
   real Tp = TP_T(tp);   /* particle temperature */
   real mp = TP_MASS(tp);   /* particle mass */
   real molwt_bulk = 0.;  /* average molecular weight in bulk gas */
   real Dp = DPM_DIAM_FROM_VOL(mp / TP_RHO(tp)); /* 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(tp->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(tp,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(tp,cond_c,TP_T(tp));
       /* Schmidt number */
       real Sc = c->mu / (c->rho * D);
       /* mass transfer coefficient */
       real k = (2. + 0.6 * sqrt(tp->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(tp,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;
               }
          }
     }
 }

2.5.5.4. Hooking a DPM Particle Heat and Mass Transfer UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_DPM_HEAT_MASS is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (for example, multivap) will become visible in the Set Injection Properties dialog box in ANSYS Fluent. See Hooking DEFINE_DPM_HEAT_MASS UDFs for details on how to hook your DEFINE_DPM_HEAT_MASS UDF to ANSYS Fluent.


Release 18.2 - © ANSYS, Inc. All rights reserved.