Vous êtes sur la page 1sur 10

Chapter 5.

5.1

UDFs for Population Balance Modeling

Population Balance Variables


The macros listed in Table 5.1.1 can be used to return real variables associated with
the population balance model. The variables are available in both the pressure-based
and density-based solvers. The macros are defined in the sg pb.h header file, which is
included in udf.h.
Table 5.1.1: Macros for Population Balance Variables Defined in sg pb.h
Macro
C PB DISCI
C
C
C
C
C
C
C

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

Population Balance DEFINE Macros


This section contains descriptions of DEFINE macros for the population balance model.
Definitions of each DEFINE macro are contained in the udf.h header file.
DEFINE PB BREAK UP RATE
DEFINE PB COALESCENCE RATE
DEFINE PB NUCLEATION RATE
DEFINE PB GROWTH RATE

c Fluent Inc. July 19, 2006


5-1

UDFs for Population Balance Modeling

5.2.1 DEFINE PB BREAK UP RATE


You can use the DEFINE PB BREAK UP RATE macro if you want to define your own particle
breakage kernel. The function is executed at the beginning of every time step.

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


72L8 72L5 18L2


6 + 3
9

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

c Fluent Inc. July 19, 2006


5.2 Population Balance DEFINE Macros

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.;

func = f_1 + ((1.-C/2.)/pow(lambda,3.))*(f_2 + f_3 + f_4);


/*freq returns the number of d_1s breaking up*/
*freq = 1; /*units are 1/s*/
/*pdf returns the daughter distribution*/
*pdf = func; /*units are i/m3*/
}

c Fluent Inc. July 19, 2006


5-3

UDFs for Population Balance Modeling

5.2.2 DEFINE PB COALESCENCE RATE


You can use the DEFINE PB COALESCENCE RATE macro if you want to define your own
particle aggregation kernel. The function is executed at the beginning of every time step.

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

where 0 = 1 1017 m3 /s.

5-4

c Fluent Inc. July 19, 2006


5.2 Population Balance DEFINE Macros

/************************************************************************
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;
}

5.2.3 DEFINE PB NUCLEATION RATE


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
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.

c Fluent Inc. July 19, 2006


5-5

UDFs for Population Balance Modeling

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);

/* Temperature of primary phase in Kelvin */

solubility = 0.0005*T-0.0794;
/* Solubility Law relating equilibrium solute mole fraction to Temperature*/

5-6

c Fluent Inc. July 19, 2006


5.2 Population Balance DEFINE Macros

S = solute_mol_frac/solubility; /* Definition of Supersaturation */


if (S <=
{
J
}
else
{
J
}
return
}

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.

5.2.4 DEFINE PB GROWTH RATE


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
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.

c Fluent Inc. July 19, 2006


5-7

UDFs for Population Balance Modeling

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;

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);

5-8

/* Temperature of primary phase in Kelvin */

c Fluent Inc. July 19, 2006


5.3 Hooking a Population Balance UDF to FLUENT

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.

Hooking a Population Balance UDF to FLUENT


After the UDF that you have defined using DEFINE PB BREAK UP RATE, DEFINE PB
COALESCENCE RATE, DEFINE PB NUCLEATION RATE, or DEFINE PB GROWTH RATE is interpreted or compiled, the name that you specified in the DEFINE macro argument (e.g.,
agg kernel) will become visible and selectable in the appropriate drop-down list under
Phenomena in the Population Balance Model panel (Figure 3.3.1).

c Fluent Inc. July 19, 2006


5-9

UDFs for Population Balance Modeling

5-10

c Fluent Inc. July 19, 2006

Vous aimerez peut-être aussi