|
|
You can use the DEFINE_PB_GROWTH_RATE macro if you want to define your own particle growth rate. The function is executed at the beginning of every time step.
Usage
| DEFINE_PB_GROWTH_RATE(name, cell, thread,d_i) |
| Argument Type | Description |
| char name | UDF name |
| cell_t cell | Cell index |
| Thread *thread | Pointer to the secondary phase thread |
| real d_i | Particle diameter or length |
| Function returns | |
| real |
There are four arguments to DEFINE_PB_GROWTH_RATE: name, cell, thread, and d_i. You will supply name, the name of the UDF. cell, thread, and d_i are variables that are passed by the ANSYS FLUENT solver to your UDF. Your UDF will need to return the real value of the growth rate.
Example
Potassium chloride can be crystallized from water by cooling. Its solubility decreases linearly with temperature. Assuming power-law kinetics for the growth rate,
where
m/s and
.
/************************************************************************
UDF that computes the particle growth rate
*************************************************************************/
#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"
DEFINE_PB_GROWTH_RATE(growth_rate, cell, thread,d_1)
{
/* d_1 can be used if size-dependent growth is needed */
/* When using SMM, only size-independent or linear growth is allowed */
real G, S;
real Kg = 2.8e-8; /* growth constant */
real Ng = 1.; /* growth 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.)
{
G = 0.;
}
else
{
G = Kg*pow((S-1),Ng);
}
return G;
}
|
|
|
Note that the solubility and the chemistry could be defined in a separate routine and simply called from the above function.
|