Académique Documents
Professionnel Documents
Culture Documents
5.1
5.2
Argument Types
Returns
cell t c, Thread *t, int i fraction (fi ) of the total volume
fraction for the ith size bin
PB SMMI
cell t c, Thread *t, int i ith moment
PB QMOMI
cell t c, Thread *t, int i ith moment, where i = 0, 1, 2, 3, 4, 5
PB QMOMI L
cell t c, Thread *t, int i abscissa Li , where i = 0, 1, 2
PB QMOMI W
cell t c, Thread *t, int i weight wi , where i = 0, 1, 2
PB DISCI PS cell t c, Thread *t, int i net source term to ith size bin
PB SMMI PS
cell t c, Thread *t, int i net source term to ith moment
PB QMOMI PS cell t c, Thread *t, int i net source term to ith moment
5-1
Usage
DEFINE PB BREAK UP RATE(name, cell, thread, d 1, d 2, freq, pdf)
Argument Type
char name
cell t cell
Thread *thread
real d 1
real d 2
real *freq
real *pdf
Description
UDF name
Cell index
Pointer to the secondary phase thread
Parent particle diameter or length
Diameter of one of the daughter particles after breakage;
the second daughter particle diameter is calculated by
conservation of particle volume
Pointer to the breakage frequency
Pointer to the breakage distribution function (PDF)
Function returns
real
There are seven arguments to DEFINE PB BREAK UP RATE: name, cell, thread, d 1, d 2,
freq, and pdf. You will supply name, the name of the UDF. cell, thread, d 1, d 2,
freq, and pdf are variables that are passed by the FLUENT solver to your UDF.
Example
Included below is a example UDF for a parabolic breakage kernel (see Section 2.2.2: Particle Birth and Death Due to Breakage and Aggregation) that has been formulated in
terms of a numeric constant C [4]. In this example, the breakage frequency g(V ) = 1
and the breakage PDF is defined as
3CL2
C
(L | ) =
+
1
3
2
The PDF respects the constraints in Section 2.2.2: Particle Birth and Death Due to
Breakage and Aggregation. Depending on the value of C, different behaviors are observed.
For example, if C = 2, the particle breakage has a uniform distribution. If 0 < C < 2,
a concave parabola is obtained, meaning that it is more likely to obtain unequally sized
fragments than equally sized fragments. The opposite of this is true for 2 < C < 3.
5-2
Values outside of the range of 0 to 3 are not allowed because the PDF cannot have a
negative value.
In the UDF example below, the breakage PDF has been converted from
the length-based kernel to the volume-based kernel as follows:
(V | V 0 ) =
(L | )
3L2
where V = Kv L3 and V 0 = Kv 3 .
/************************************************************************
UDF that computes the particle breakage rate
*************************************************************************/
#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"
DEFINE_PB_BREAK_UP_RATE(break_up_kernel, cell, thread, d_1, d_2, freq, pdf)
{
/*d_1 is the particle breaking into d_2 and its complementary diameter
d_2 such that d_13 = d_23 + d_23*/
/*parabolic kernel is symmetric about v = 0.5*/
real C=1., f_1, f_2, f_3, f_4, func;
real lambda = d_1;
real v = pow(d_2,3.)/pow(d_1,3.);
f_1
f_2
f_3
f_4
=
=
=
=
C/(pow(lambda,3.));
24.*pow(v,2.);
-24.*v;
6.;
5-3
Usage
DEFINE PB COALESCENCE RATE(name, cell, thread, d 1, d 2)
Argument Type
char name
cell t cell
Thread *thread
real d 1, d 2
Description
UDF name
Cell index
Pointer to the secondary phase thread
Diameters of the two colliding particles
Function returns
real
There are five arguments to DEFINE PB COALESCENCE RATE: name, cell, thread, d 1,
and d 2. You will supply name, the name of the UDF. cell, thread, d 1, and d 2 are
variables that are passed by the FLUENT solver to your UDF. Your UDF will need to
return the real value of the aggregation rate.
Example
Included below is a example UDF for a Brownian aggregation kernel. In this example,
the aggregation rate is defined as
a(L, ) = a(V, V 0 ) = 0
(L + )2
L
5-4
/************************************************************************
UDF that computes the particle aggregation rate
*************************************************************************/
#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"
DEFINE_PB_COALESCENCE_RATE(aggregation_kernel,cell,thread,d_1,d_2)
{
real agg_kernel;
real beta_0 = 1.0e-17 /* aggregation rate constant */
agg_kernel = beta_0*pow((d_1+d_2),2.0)/(d_1*d_2);
return agg_kernel;
}
Usage
DEFINE PB NUCLEATION RATE(name, cell, thread)
Argument Type
char name
cell t cell
Thread *thread
Description
UDF name
Cell index
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 FLUENT solver to your UDF. Your UDF will need to return the real
value of the nucleation rate.
5-5
Example
Potassium chloride can be crystallized from water by cooling. Its solubility decreases
linearly with temperature. Assuming power-law kinetics for the nucleation rate,
n 0 = Kn (S 1)Nn
where Kn = 4 1010 particles/m3 -s and Nn = 2.77.
/************************************************************************
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);
solubility = 0.0005*T-0.0794;
/* Solubility Law relating equilibrium solute mole fraction to Temperature*/
5-6
1.)
= 0.;
= Kn*pow((S-1),Nn);
J;
Note that the solubility and the chemistry could be defined in a separate
routine and simply called from the above function.
Usage
DEFINE PB GROWTH RATE(name, cell, thread,d i)
Argument Type
char name
cell t cell
Thread *thread
real d i
Description
UDF name
Cell index
Pointer to the secondary phase thread
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 FLUENT solver to your UDF. Your UDF will need to return the real value
of the growth rate.
5-7
Example
Potassium chloride can be crystallized from water by cooling. Its solubility decreases
linearly with temperature. Assuming power-law kinetics for the growth rate,
G = Kg (S 1)Ng
where Kg = 2.8 108 m/s and Ng = 1.
/************************************************************************
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
real
real
real
real
G, S;
Kg = 2.8e-8; /* growth constant */
Ng = 1.; /* growth law power index */
T,solute_mass_frac,solvent_mass_frac, solute_mol_frac,solubility;
solute_mol_wt, solvent_mol_wt;
5-8
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;
}
i
5.3
Note that the solubility and the chemistry could be defined in a separate
routine and simply called from the above function.
5-9
5-10