|
|
You can use the DEFINE_PB_NUCLEATION_RATE macro if you want to define your own particle nucleation rate. The function is executed at the beginning of every time step.
Usage
| DEFINE_PB_NUCLEATION_RATE(name, cell, thread) |
| Argument Type | Description |
| char name | UDF name |
| cell_t cell | Cell index |
| Thread *thread | Pointer to the secondary phase thread |
| Function returns | |
| real |
There are three arguments to DEFINE_PB_NUCLEATION_RATE: name, cell, and thread. You will supply name, the name of the UDF. cell and thread are variables that are passed by the ANSYS FLUENT solver to your UDF. Your UDF will need to return the real value of the nucleation rate.
Example
Potassium chloride can be crystallized from water by cooling. Its solubility decreases linearly with temperature. Assuming power-law kinetics for the nucleation rate,
where
particles/m
-s and
.
/************************************************************************
UDF that computes the particle nucleation rate
*************************************************************************/
#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"
DEFINE_PB_NUCLEATION_RATE(nuc_rate, cell, thread)
{
real J, S;
real Kn = 4.0e10; /* nucleation rate constant */
real Nn = 2.77; /* nucleation law power index */
real T,solute_mass_frac,solvent_mass_frac, solute_mol_frac,solubility;
real solute_mol_wt, solvent_mol_wt;
Thread *tc = THREAD_SUPER_THREAD(thread); /*obtain mixture thread */
Thread **pt = THREAD_SUB_THREADS(tc); /* pointer to sub_threads */
Thread *tp = pt[P_PHASE]; /* primary phase thread */
solute_mol_wt = 74.55; /* molecular weight of potassium chloride */
solvent_mol_wt = 18.; /* molecular weight of water */
solute_mass_frac = C_YI(cell,tp,0);
/* mass fraction of solute in primary phase (solvent) */
solvent_mass_frac = 1.0 - solute_mass_frac;
solute_mol_frac = (solute_mass_frac/solute_mol_wt)/
((solute_mass_frac/solute_mol_wt)+(solvent_mass_frac/solvent_mol_wt));
T = C_T(cell,tp); /* Temperature of primary phase in Kelvin */
solubility = 0.0005*T-0.0794;
/* Solubility Law relating equilibrium solute mole fraction to Temperature*/
S = solute_mol_frac/solubility; /* Definition of Supersaturation */
if (S <= 1.)
{
J = 0.;
}
else
{
J = Kn*pow((S-1),Nn);
}
return J;
}
|
|
|
Note that the solubility and the chemistry could be defined in a separate routine and simply called from the above function.
|