3.2.8. Model-Specific Macros

3.2.8.1. DPM Macros

The macros listed in Table 3.27: Macros for Particles at Current Position Defined in dpm_types.h – Table 3.32: Macros for Particle Material Properties Defined in dpm_laws.h can be used to return real variables associated with the Discrete Phase Model (DPM), in SI units (where relevant). They are typically used in DPM UDFs that are described in Discrete Phase Model (DPM) DEFINE Macros. The variables are available in both the pressure-based and the density-based solver. The macros are defined in the dpm_types.h and dpm_laws.h header files, which are included in udf.h.

The variable tp indicates a pointer to the Tracked_Particle structure (Tracked_Particle *tp) which gives you the value for the particle at the current position, the variable m indicates a pointer to the relevant Material structure (Material *m), and the real variable t is the temperature.

Refer to the following sections for examples of UDFs that use some of these macros: DEFINE_DPM_LAW , DEFINE_DPM_BC , DEFINE_DPM_INJECTION_INIT , DEFINE_DPM_SWITCH , and DEFINE_DPM_PROPERTY .

The TP_... macros listed in Table 3.27: Macros for Particles at Current Position Defined in dpm_types.h through Table 3.31: Macros for Particle Species, Laws, Materials, and User Scalars Defined in dpm_types.h are to be used to access elements of variables of the type Tracked_Particles or elements within instances of the data structure pointed to by pointer variables of the type Tracked_Particle *.

In addition, the dpm_types.h header file also contains definitions for the PP_... macros that are analogous to the corresponding TP_... macros. The PP_... macros are similar in function, but they are to be used for accessing elements of variables of the Particle or elements within the data structure that are pointed to by pointer variables of the type Particle *.


Important:  The TP_.... and analogous PP_... macros should not be used interchangeably. Their definitions may be modified without notice in future releases.


Table 3.27:  Macros for Particles at Current Position Defined in dpm_types.h

Macro

Argument Types

Returns

TP_POS(tp)[i]

Tracked_Particle *tp, int i

position i= 0, 1, 2

TP_VEL(tp)[i]

Tracked_Particle *tp, int i

velocity i= 0, 1, 2

TP_DIAM(tp)

Tracked_Particle *tp

diameter

TP_T(tp)

Tracked_Particle *tp

temperature

TP_RHO(tp)

Tracked_Particle *tp

density

TP_MASS(tp)

Tracked_Particle *tp

mass

TP_TIME(tp)

Tracked_Particle *tp

current particle time

TP_DT(tp)

Tracked_Particle *tp

time step

TP_FLOW_RATE(tp)

Tracked_Particle *tp

flow rate of particles in a stream in kg/s (see below for details)

TP_LMF(tp)

Tracked_Particle *tp

liquid mass fraction (wet combusting particles only)

TP_LF(tp)

Tracked_Particle *tp

liquid volume fraction (wet combusting particles only)

TP_VF(tp)

Tracked_Particle *tp

volatile fraction (combusting particles only)

TP_CF(tp)

Tracked_Particle *tp

char mass fraction (combusting particles only)

TP_VFF(tp)

Tracked_Particle *tp

volatile fraction remaining (two competing rates devolatilization model only)


TP_FLOW_RATE(tp)

Each particle in a steady flow calculation represents a “stream" of many particles that follow the same path. The number of particles in this stream that passes a particular point in a second is the “strength" of the stream. TP_FLOW_RATE(tp) returns the strength multiplied by TP_MASS_INIT(tp) at the current particle position.

Table 3.28:  Macros for Particles at Entry to Current Cell Defined in dpm_types.h

Macro

Argument Types

Returns

TP_POS0(tp)[i]

Tracked_Particle *tp, int i

position i= 0, 1, 2

TP_VEL0(tp)[i]

Tracked_Particle *tp, int i

velocity i= 0, 1, 2

TP_DIAM0(tp)

Tracked_Particle *tp

diameter

TP_T0(tp)

Tracked_Particle *tp

temperature

TP_RHO0(tp)

Tracked_Particle *tp

density

TP_MASS0(tp)

Tracked_Particle *tp

mass

TP_TIME0(tp)

Tracked_Particle *tp

particle time at entry

TP_LMF0(tp)

Tracked_Particle *tp

liquid mass fraction (wet combusting particles only)



Important:  Note that when you are using the macros listed in Table 3.28: Macros for Particles at Entry to Current Cell Defined in dpm_types.h to track transient particles, the particle state is the beginning of the fluid flow time step only if the particle does not cross a cell boundary.


Table 3.29:  Macros for Particle Cell Index and Thread Pointer Defined in dpm_types.h

Name (Arguments)

Argument Types

Returns

TP_CELL(tp)

Tracked_Particle *tp

cell_t c, cell index of the cell in which the particle is currently located

TP_CELL_THREAD(tp)

Tracked_Particle *tp

Thread *tc, pointer to the thread of the cell in which the particle is currently located

TP_FILM_FACE(tp)

Tracked_Particle *tp

face_t f, face index of the face to which the film particle is currently attached

TP_FILM_THREAD(tp)

Tracked_Particle *tp

Thread *tf, pointer to the thread of the face to which the film particle is currently attached


Table 3.30:  Macros for Particles at Injection into Domain Defined in dpm_types.h

Macro

Argument Types

Returns

TP_INIT_POS(tp)[i]

Tracked_Particle *tp, int i

position i= 0, 1, 2

TP_INIT_VEL(tp)[i]

Tracked_Particle *tp, int i

velocity i= 0, 1, 2

TP_INIT_DIAM(tp)

Tracked_Particle *tp

diameter

TP_INIT_TEMP(tp)

Tracked_Particle *tp

temperature

TP_INIT_RHO(tp)

Tracked_Particle *tp

density

TP_INIT_MASS(tp)

Tracked_Particle *tp

mass

TP_INIT_LMF(tp)

Tracked_Particle *tp

liquid mass fraction (wet combusting particles only)


Table 3.31:  Macros for Particle Species, Laws, Materials, and User Scalars Defined in dpm_types.h

Macro

Argument Types

Returns

TP_EVAP_SPECIES_INDEX(tp)

Tracked_Particle *tp

evaporating species index in mixture

TP_DEVOL_SPECIES_INDEX(tp)

Tracked_Particle *tp

devolatilizing species index in mixture

TP_OXID_SPECIES_INDEX(tp)

Tracked_Particle *tp

oxidizing species index in mixture

TP_PROD_SPECIES_INDEX(tp)

Tracked_Particle *tp

combustion products species index in mixture

TP_CURRENT_LAW(tp)

Tracked_Particle *tp

int law, current particle law index

TP_NEXT_LAW(tp)

Tracked_Particle *tp

int next_law, next particle law index

TP_MATERIAL(tp)

Tracked_Particle *tp

Material *m, material pointer

TP_USER_REAL(tp,i)

Tracked_Particle *tp, int i

storage array for user-defined values (indexed by i)


Table 3.32:  Macros for Particle Material Properties Defined in dpm_laws.h

Macro

Argument Types

Returns

DPM_BOILING_TEMPERATURE (tp,m)

Tracked_Particle *tp, Material *m

boiling temperature

DPM_DIFFUSION_COEFF(tp,t)

DPM_BINARY_DIFFUSIVITY(tp,m,t)

Tracked_Particle *tp, Material *m, real t

Binary diffusion coefficient to be used in the gaseous boundary layer around the particle

DPM_EMISSIVITY(tp,m)

DPM_SCATT_FACTOR(tp,m)

Tracked_Particle *tp, Material *m

emissivity and scattering factor for the radiation model

DPM_KTC(tp)

Tracked_Particle *tp

thermal conductivity

DPM_HEAT_OF_PYROLYSIS(tp)

Tracked_Particle *tp

heat of pyrolysis

DPM_HEAT_OF_REACTION(tp)

Tracked_Particle *tp

heat of reaction

DPM_LATENT_HEAT(tp,m)

Tracked_Particle *tp, Material *m

latent heat

DPM_LIQUID_SPECIFIC_HEAT(tp,t)

Tracked_Particle *tp, real t

specific heat of material used for liquid associated with particle

DPM_MU(tp)

Tracked_Particle *tp

dynamic viscosity of liquid part of particle

DPM_RHO(tp,m,t)

Tracked_Particle *tp, Material *m, real t

particle density

DPM_SPECIFIC_HEAT(tp,t)

Tracked_Particle *tp, real t

specific heat

DPM_SWELLING_COEFF(tp)

Tracked_Particle *tp

swelling coefficient for devolatilization

DPM_SURFTEN(tp)

Tracked_Particle *tp

surface tension of liquid part of particles

DPM_VAPOR_PRESSURE(tp,m,t)

Tracked_Particle *tp, Material *m, real t

vapor pressure of liquid part of particle

DPM_VAPOR_TEMP(tp,m)

DPM_EVAPORATION_TEMPERATURE(tp,m)

Tracked_Particle *tp, Material *m

vaporization temperature used to switch to vaporization law

DPM_VOLATILE_FRACTION(tp)

Tracked_Particle *tp

particle material volatile fraction

DPM_CHAR_FRACTION(tp)

Tracked_Particle *tp

particle material char fraction


Table 3.33:  Macros to access source terms on CFD cells for the DPM model

Macro

Argument Types

Returns

C_DPMS_MOM_S(c,t)

cell_t c, Thread *t

momentum source (SI units: kg m/s2), explicit

C_DPMS_MOM_AP(c,t)

cell_t c, Thread *t

momentum source (SI units: kg/s), implicit

C_DPMS_WSWIRL_S(c,t)

cell_t c, Thread *t

momentum source swirl component (SI units: kg m/s2), explicit

C_DPMS_WSWIRL_AP(c,t)

cell_t c, Thread *t

momentum source swirl component (SI units: kg/s), implicit

C_DPMS_ENERGY(c,t)

cell_t c, Thread *t

energy source (SI units: J/s), explicit

C_DPMS_ENERGY_AP(c,t)

cell_t c, Thread *t

energy source (SI units: J/K/s), implicit

C_DPMS_YI(c,t,i)

cell_t c, Thread *t, int i (species index)

species mass source (SI units: kg/s), explicit

C_DPMS_YI_AP(c,t,i)

cell_t c, Thread *t, int i (species index)

species mass source (SI units: kg/s), implicit

C_DPMS_REACTION_RATE_POST(c,t,i)

cell_t c, Thread *t, int i (particle reaction index)

reaction rates of particle REACTIONS (SI units: kg/s/m3)

C_DPMS_VAP_PER_MATERIAL(c,t,i)

cell_t c, Thread *t, int i (material index)

vaporization mass source of material i (SI units: kg/s)

C_DPMS_DEVOL_PER_MATERIAL(c,t,i)

cell_t c, Thread *t, int i (material index)

devolatilization mass source of material i (SI units: kg/s)

C_DPMS_BURN_PER_MATERIAL(c,t,i)

cell_t c, Thread *t, int i (material index)

burnout mass source of material i (SI units: kg/s)

C_DPMS_PDF_1(c,t)

cell_t c, Thread *t

mass source of pdf stream 1 (SI units: kg/s)

C_DPMS_PDF_2(c,t)

cell_t c, Thread *t

mass source of pdf stream 2 (SI units: kg/s)

C_DPMS_EMISS(c,t)

cell_t c, Thread *t

particles emissivity (SI units: m2K4)

C_DPMS_ABS(c,t)

cell_t c, Thread *t

particles absorption coefficient (SI units: m3/m)

C_DPMS_SCAT(c,t)

cell_t c, Thread *t

particles scattering coefficient (SI units: m3/m)

C_DPMS_BURNOUT(c,t)

cell_t c, Thread *t

burnout mass source (SI units: kg/s)

C_DPMS_CONCENTRATION(c,t)

cell_t c, Thread *t

concentration of particles (SI units: kg/s/m3)

C_DPMS_SURF_YI(c,t,i)

cell_t c, Thread *t, int i (surface species index)

concentration of particle surface species (SI units: kg/s/m3)



Note:

3.2.8.2. NOx Macros

The following macros can be used in NOx model UDFs in the calculation of pollutant rates. These macros are defined in the header file sg_nox.h, which is included in udf.h. They can be used to return real NOx variables in SI units, and are available in both the pressure-based and the density-based solver. See DEFINE_NOX_RATE for examples of DEFINE_NOX_RATE UDFs that use these macros.

Table 3.34:  Macros for NOx UDFs Defined in sg_nox.h

Macro

Returns

POLLUT_EQN(Pollut_Par)

index of pollutant equation being solved (see below)

MOLECON(Pollut,SPE)

molar concentration of species specified by SPE (see below)

NULLIDX(Pollut_Par,SPE)

TRUE if the species specified by SPE does not exist in ANSYS Fluent case (that is, in the Species dialog box)

ARRH(Pollut,K)

Arrhenius rate calculated from the constants specified by K (see below)

POLLUT_FRATE(Pollut)

production rate of the pollutant species being solved

POLLUT_RRATE(Pollut)

reduction rate of the pollutant species being solved

POLLUT_QRATE(Pollut)

quasi-steady rate of N2O formation (if the quasi-steady model is used)

POLLUT_FLUCTDEN(Pollut)

fluctuating density value (or, if no PDF model is used, mean density at a given cell

POLLUT_FLUCTTEM(Pollut)

fluctuating temperature value (or, if no PDF model is used, mean temperature at a given cell)

POLLUT_FLUCTYI(Pollut,SPE)

fluctuating mass fraction value (or, if no PDF model is used, mean mass fraction at a given cell) of the species given by index SPE

POLLUT_CTMAX(Pollut_Par)

upper limit for the temperature PDF integration (see below)



Important:   Pollut_Par is a pointer to the Pollut_Parameter data structure that contains auxiliary data common to all pollutant species and NOx is a pointer to the NOx_Parameter data structure that contains data specific to the NOx model.


  • POLLUT_EQN(Pollut_Par) returns the index of the pollutant equation currently being solved. The indices are EQ_NO for NO, EQ_HCN for HCN, EQ_N2O for O, and EQ_NH3 for .

  • MOLECON(Pollut,SPE) returns the molar concentration of a species specified by SPE, which is either the name of the species or IDX(i) when the species is a pollutant (like NO). SPE must be replaced by one of the following identifiers: FUEL, O2, O, OH, H2O, N2, N, CH, CH2, CH3, IDX(NO), IDX(N2O), IDX(HCN), IDX(NH3). For example, for molar concentration you should call MOLECON(Pollut, O2), whereas for NO molar concentration the call should be MOLECON(Pollut, IDX(NO)). The identifier FUEL represents the fuel species as specified in the Fuel Species drop-down list under Prompt NO Parameters in the NOx Model dialog box.

  • ARRH(Pollut,K) returns the Arrhenius rate calculated from the constants specified by K. K is defined using the Rate_Const data type and has three elements - A, B, and C. The Arrhenius rate is given in the form of

    where T is the temperature.

    Note that the units of K must be in m-mol-J-s.

  • POLLUT_CTMAX(Pollut_Par) can be used to modify the value used as the upper limit for the integration of the temperature PDF (when temperature is accounted for in the turbulence interaction modeling). You must make sure not to put this macro under any conditions within the UDF (for example, IN_PDF or OUT_PDF).

3.2.8.3. SOx Macros

The following macros can be used in SOx model UDFs in the calculation of pollutant rates. These macros are defined in the header file sg_nox.h, which is included in udf.h. They can be used to return real SOx variables in SI units and are available in both the pressure-based and the density-based solver. See DEFINE_SOX_RATE for examples of DEFINE_SOX_RATE UDFs that use these macros.

Table 3.35:  Macros for SOx UDFs Defined in sg_nox.h

Macro

Returns

POLLUT_EQN(Pollut_Par)

index of pollutant equation being solved (see below)

MOLECON(Pollut,SPE)

molar concentration of species specified by SPE (see below)

NULLIDX(Pollut_Par,SPE)

TRUE if the species specified by SPE does not exist in ANSYS Fluent case (that is, in the Species dialog box)

ARRH(Pollut,K)

Arrhenius rate calculated from the constants specified by K (see below)

POLLUT_FRATE(Pollut)

production rate of the pollutant species being solved

POLLUT_RRATE(Pollut)

reduction rate of the pollutant species being solved

POLLUT_FLUCTDEN(Pollut)

fluctuating density value (or, if no PDF model is used, mean density at a given cell)

POLLUT_FLUCTTEM(Pollut)

fluctuating temperature value (or, if no PDF model is used, mean temperature at a given cell)

POLLUT_FLUCTYI(Pollut,SPE)

fluctuating mass fraction value (or, if no PDF model is used, mean mass fraction at a given cell) of the species given by index SPE

POLLUT_CTMAX(Pollut_Par)

upper limit for the temperature PDF integration (see below)



Important:   Pollut_Par is a pointer to the Pollut_Parameter data structure that contains auxiliary data common to all pollutant species and SOx is a pointer to the SOx_Parameter data structure that contains data specific to the SOx model.


  • POLLUT_EQN(Pollut_Par) returns the index of the pollutant equation currently being solved. The indices are EQ_SO2 for and EQ_SO3 for , and so on.

  • MOLECON(Pollut, SPE) returns the molar concentration of a species specified by SPE. SPE is either the name of the species or IDX(i) when the species is a pollutant (like ). For example, for molar concentration you should call MOLECON(Pollut, O2), whereas for molar concentration the call should be MOLECON(Pollut, IDX(SO2)).

  • ARRH(Pollut,K) returns the Arrhenius rate calculated from the constants specified by K. K is defined using the Rate_Const data type and has three elements - A, B, and C. The Arrhenius rate is given in the form of

    where T is the temperature.

    Note that the units of must be in m-mol-J-s.

  • POLLUT_CTMAX(Pollut_Par) can be used to modify the value used as the upper limit for the integration of the temperature PDF (when temperature is accounted for in the turbulence interaction modeling). You must make sure not to put this macro under any conditions within the UDF (for example, IN_PDF or OUT_PDF).

3.2.8.4. Dynamic Mesh Macros

The macros listed in Table 3.36: Macros for Dynamic Mesh Variables Defined in dynamesh_tools.h are useful in dynamic mesh UDFs. The argument dt is a pointer to the dynamic thread structure, and time is a real value. These macros are defined in the dynamesh_tools.h.

Table 3.36:  Macros for Dynamic Mesh Variables Defined in dynamesh_tools.h

Name (Arguments)

Argument Types

Returns

DT_THREAD(dt)

Dynamic_Thread *dt

pointer to a thread

DT_CG(dt)

Dynamic_Thread *dt

center of gravity vector

DT_VEL_CG(dt)

Dynamic_Thread *dt

cg velocity vector

DT_OMEGA_CG(t)

Dynamic_Thread *dt

angular velocity vector

DT_THETA(dt)

Dynamic_Thread *dt

orientation of body-fixed axis vector

DYNAMESH_CURRENT_TIME

N/A

current dynamic mesh time

TIME_TO_ABSOLUTE_CRANK_ANGLE (time)

real time

absolute value of the crank angle


See DEFINE_GRID_MOTION for an example UDF that utilizes DT_THREAD.


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