CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   UDF growth rate, unsteady state (

roca March 8, 2011 05:04

UDF growth rate, unsteady state

I have a code for determining the growth rate of a crystal in terms of the supersaturation. However, I have realized that this code works only when I run the iterations in steady state. When I run iterations in unsteady state, I get an error message.

Does anyone have any idea about what I need to change?

Please see below the code


roca March 8, 2011 05:06

growth rate code
/************************************************** **********************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.;
G = Kg*pow((S-1),Ng); }

return G;

aliyah May 18, 2011 22:33

UDF cell growth
Where do you linked your UDF code?
I'm basically doing the same where i wish to determine the growth rate of cells in a reactor. However, im still in the process of learning how to do it.
Anyone who can give some tips or infos related to this would is highly appreciated.

All times are GMT -4. The time now is 11:12.