CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for Population Blance Model (PBM) (https://www.cfd-online.com/Forums/fluent-udf/114157-udf-population-blance-model-pbm.html)

 Yanlong Li March 6, 2013 07:41

UDF for Population Blance Model (PBM)

Hi guys,
I'm trying to change the drag law for PBM, I knew there were several bubbles in a cell, but I don't know how to get the diameters, so I write this code to define a equal diameter, but it does not work, the error messages:
"Divergence detected in AMG solver:mp-x-momentum -> Decreasing coarsening group size!"
"Divergence detected in AMG solver:mp-x-momentum -> Increasing relaxation sweep"
"Divergence detected in AMG solver:pressure correction -> Turning off correction scaling!"
"Divergence detected in AMG solver:Pressure correction -> Increasing relaxation sweep!"

my code:
#include "udf.h"
DEFINE_EXCHANGE_PROPERTY(drag_ceofficient,c,t,s_co l,f_col)
{
real Coe,Re,We,Cd,v_slip,d,f,tp,surface_tension = 1.82;
d = pow(6.*C_VOLUME(c,t_g)/M_PI,1./3.);
v_slip = sqrt(pow(C_U(c,t_l) - C_U(c,t_g),2.0) + pow(C_V(c,t_l) - C_V(c,t_g),2.0) + pow(C_W(c,t_l) - C_W(c,t_g),2.0));
Re = C_R(c,t_l)*d*v_slip/C_MU_L(c,t_l);
if (Re < 0.49)
Cd = 16.0/Re;
else if (Re < 100.0)
Cd = 20.68/(pow(Re,0.643));
else if (Re > 100.0)
Cd = 6.3/(pow(Re,0.385));
We = C_R(c,t_l)*d*pow(v_slip,2.0)/surface_tension;
if (Re > 2065.1/pow(We,2.6))
Cd = We/3.0;
else if (We > 8.0)
Cd = 8.0/3.0;
f = Cd*Re/24.0;
tp = C_R(c,t_g)*d*d/18.0/C_MU_L(c,t_l);
Coe = C_VOF(c,t_g)*C_VOF(c,t_l)*C_R(c,t_g)*f/tp;
return Coe;
}