![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Description
You can use DEFINE_DPM_VP_EQUILIB to specify the equilibrium vapor pressure of vaporizing components of multicomponent particles.
Usage
DEFINE_DPM_VP_EQUILIB( name, p, cvap_surf, Z) |
Argument Type | Description |
symbol name | UDF name. |
Tracked_Particle *p | Pointer to the Tracked_Particle data structure which |
contains data related to the particle being tracked. | |
real *cvap_surf | Array that contains the equilibrium vapor concentration |
*Z | Compressibilty, Z |
over the particle surface. | |
Function returns | |
void | |
There are three arguments to DEFINE_DPM_VP_EQUILIB: name, p, and cvap_surf. You supply the name of your user-defined function. p is passed by the ANSYS FLUENT solver to your UDF. Your UDF will need to compute the equilibrium vapor concentrations and store the values in cvap_surf.
Example
The following UDF named raoult_vpe computes the equilibrium vapor concentration of a multicomponent particle using the Raoult law. The vapor pressure in the law is proportional to the molar fraction of the condenses material. DEFINE_VP_EQUILIB is called several times every particle time step in ANSYS FLUENT and requires a significant amount of CPU time to execute. For this reason, the UDF should be executed as a compiled UDF.
/*********************************************************************** UDF for defining the vapor particle equilibrium for multicomponent particles ***********************************************************************/ #include <udf.h> DEFINE_DPM_VP_EQUILIB(raoult_vpe,p,cvap_surf,Z) { int is; real molwt[MAX_SPE_EQNS]; Thread *t0 = P_CELL_THREAD(p); /* cell thread of particle location */ Material *gas_mix = THREAD_MATERIAL(t0); /* gas mixture material */ Material *cond_mix = P_MATERIAL(p); /* particle mixture material */ int nc = TP_N_COMPONENTS(p); /* number of particle components */ real Tp = P_T(p); /* particle temperature */ real molwt_cond = 0.; /* reciprocal molecular weight of the particle */ for (is = 0; is < nc; is++) { int gas_index = TP_COMPONENT_INDEX_I(p,is); /* index of vaporizing component in the gas phase */ if (gas_index >= 0) { /* the molecular weight of particle material */ molwt[gas_index] = MATERIAL_PROP(MIXTURE_COMPONENT(gas_mix,gas_index),PROP_mwi); molwt_cond += TP_COMPONENT_I(p,is) / molwt[gas_index]; } } /* prevent division by zero */ molwt_cond = MAX(molwt_cond,DPM_SMALL); for (is = 0; is < nc; is++) { /* gas species index of vaporization */ int gas_index = TP_COMPONENT_INDEX_I(p,is); if( gas_index >= 0 ) { /* condensed material */ Material * cond_c = MIXTURE_COMPONENT( cond_mix, is ); /* condensed component molefraction */ real xi_cond = TP_COMPONENT_I(p,is)/(molwt[gas_index]*molwt_cond); /* particle saturation pressure */ real p_saturation = DPM_vapor_pressure(p, cond_c, Tp); if (p_saturation < 0.0) p_saturation = 0.0; /* vapor pressure over the surface, this is the actual Raoult law */ cvap_surf[is] = xi_cond * p_saturation / UNIVERSAL_GAS_CONSTANT / Tp; } } /* compressibility for ideal gas */ *Z = 1.0; } |
Hooking a DPM Vapor Equilibrium UDF to
ANSYS FLUENT
After the UDF that you have defined using DEFINE_DPM_VP_EQUILIBRIUM is interpreted (Chapter 4) or compiled (Chapter 5), the name of the argument that you supplied as the first DEFINE macro argument will become visible and selectable in the Create/Edit Materials dialog box in ANSYS FLUENT. Note that before you hook the UDF, you'll need to create particle injections in the Injections dialog box with the type Multicomponent chosen. See Section 6.4.15 for details on how to hook your DEFINE_DPM_VP_EQUILIB UDF to ANSYS FLUENT.