CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   question on udf reflect boundary condition (https://www.cfd-online.com/Forums/fluent/67598-question-udf-reflect-boundary-condition.html)

panyd August 20, 2009 04:38

question on udf reflect boundary condition
 
hi all
resently, i study the particle deposition on tube surface. but during the interation with my defined reflect boundary,fluent display "Error:divergence detected in AMG solver: x-momentum" .my Define_dpm_bc is as follows:
#include "udf.h"
#include "dpm.h"
#include "mem.h"
#include <stdlib.h>
#include <math.h>
#include <iostream.h>
#include <time.h>
#define p_Ela_mol 3.6e11
#define p_sur_vos 0.15
#define p_den 1550
#define angle_cri 1.27
#define p_po 0.23
#define vn_y 7.5
DEFINE_DPM_BC(bc_reflect,p,t,f,f_normal,dim)
{
real alpha,alpha_a; /* angle of particle path with face normal */
real vn=0.;
real vt=0.;
real nor_coeff,tan_coeff;
real vn_cri,vnm_cri;
real fs_coeff=0.4;
real normal[3];
real c_num,c_xsh,poro;
int i, idim = dim;
int num_acc;
real NV_VEC(x);
real Eeff;
Thread *t0;
cell_t c0;

Eeff=p_Ela_mol/(1-p_po*p_po);
num_acc = F_UDMI(f,t,1);
c_num=num_acc*F_UDMI(f,t,2)/(0.0508*angle_cri/2);
c_xsh=pow((c_num/20),-0.282);
poro=pow(c_xsh,3)/(pow(c_xsh,3)+0.852);
if (poro<0.55)
vn_cri=0.0445+0.0074*exp(5.8828*poro);
else
vn_cri=0.2692+2.0303*pow(10,-7)*exp(20.8835*poro);
srand( (unsigned)time( NULL ) );
for (i=0; i<idim; i++)
normal[i] = f_normal[i];
if(p->type==DPM_TYPE_INERT)
{
alpha = M_PI/2. - acos(MAX(-1.,MIN(1.,NV_DOT(normal,p->state.V)/
MAX(NV_MAG(p->state.V),DPM_SMALL)))); alpha_a=alpha+5*M_PI*gaussrand()/180;
for(i=0; i<idim; i++)
vn +=p->state.V[i]*normal[i];
if ((NNULLP(t)) && (THREAD_TYPE(t) == THREAD_F_WALL))
F_CENTROID(x,f,t);

if (alpha>angle_cri )
{
nor_coeff=1;
tan_coeff=1-fs_coeff*(1+nor_coeff)/tan(alpha_a);
}
else if (vn<=vn_cri)
{
nor_coeff=0;
tan_coeff=0;
}
else if (vn>vn_cri && vn<=vn_y)
{
nor_coeff=sqrt(1-pow(vn_cri/vn,2.0));
tan_coeff=1-fs_coeff*(1+nor_coeff)/tan(alpha_a);
}
else
{
nor_coeff=sqrt(1.2*sqrt(3)*(1-pow(vn_y/vn,2.0)/6)*sqrt((vn_y/vn)/((vn_y/vn)+2*sqrt(1.2-0.2*pow(vn_y/vn,2.0))))-pow(vn_cri/vn,2.0));
tan_coeff=1-fs_coeff*(1+nor_coeff)/tan(alpha_a);
}

for(i=0; i<idim; i++)
p->state.V[i] -=vn*normal[i];
for(i=0; i<idim; i++)
p->state.V[i] *=tan_coeff;
for(i=0; i<idim; i++)
p->state.V[i] -=nor_coeff*vn*normal[i];
for(i=0; i<idim; i++)
p->state0.V[i]=p->state.V[i];

if (nor_coeff==0)
{
return PATH_ABORT;
}
else
{
return PATH_ACTIVE;
}
}
return PATH_ABORT;
}

in the programme of DEFINE_DPM_EROSION(), i set F_UDMI(f, t, 1) to store the number of deposited particle and F_UDMI(f, t, 2) to store the mean diameter of deposited particle.

would you please help me to check my programme and point out the mistakes


All times are GMT -4. The time now is 19:41.