CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Step-by-Step Procedure for DPM body force (http://www.cfd-online.com/Forums/fluent/86359-step-step-procedure-dpm-body-force.html)

wwt650420 March 21, 2011 05:41

Step-by-Step Procedure for DPM body force
 
hi, everyone.
Now, i am modeling particles deposition on a wall. And at first i use a UDF to add a body force on the particles.
But i really don't know how to do with it for Step-by-Step Procedure?
My UDF is DEFINE_DPM_BODY_FORCE,
after i have compiled my UDF, should I do something with:
define-user defined-scalars
or
define-user defined-memory?

and if not

i add my udf on th panel of define-DPM-UDF-User-defined Functions.
But what is the meaning of User Varibles and Number of Scalars?
What should I do with it.

My UDF is very simple now.

/************************************************** *****/
/**********************thermal_force*************** ********/
/************************************************** *****/
DEFINE_DPM_BODY_FORCE(body_force,p,i)
{
real p_tem,p_dia,p_den,knudsen,viscosity,lamda,pione,al pha,
cv,fai,exponent,p_meanv,fth,uth,uthplus,
relax_time,den_ratio,cunn,d_fenzi;
real renum,prnum,nulam,nuturb,nunum,tau,tau1;
......
FILE *fp;
cell_t c=RP_CELL(&(p->cCell));
Thread *tcell=RP_THREAD(&(p->cCell));
d=Get_Domain(1);

p_tem=C_T(c,tcell);
p_den=P_RHO(p);
p_dia=P_DIAM(p);
p_meanv=sqrt(((8*C_RGAS(c,tcell))*C_T(c,tcell))/pi);
lamda=2*4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667))/C_R(c,tcell)/p_meanv;
knudsen=2.*lamda/p_dia;
......
fth1=0.179021181*knudsen*n*w*1.3806504*p_dia*p_dia *pow(10,12)*wendutidu/q/d_fenzi/d_fenzi;
/*need to * pow(10,-10.5)*/
uth=fth1*pow(10,(-10.5))/P_MASS(p);
uthplus=fth1*pow(10,(-10.5))*relax_time/P_MASS(p)/ujianqie;
return(uth);
}

Then. it i want to use UDF for a new drag coefficient.
What should i pay more attention to while i use fluent, especially for Step-by-Step Procedure?

Amir March 21, 2011 11:04

Hi Mu,
it's enough to hook your UDF in DPM user defined functions.
your UDF add a source term to Lagrangian equation that is solved for particle tracking and the previous drag term will be exist.
you can write particle path with and without your UDF to compare its changes.
the user scalar and variables in DPM panel are just an auxiliary spaces for advanced programming but you didn't use any of them in your UDF so don't set any variables.

wwt650420 March 21, 2011 23:42

DERA Amir:
thank U very much firstly. But when i have complied my UDF, and wanted to iterate my .cas and/or .dat, just after one iteration of DPM, it stops and shows that:
Advancing DPM injections ....
Injecting 68 particles
Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()

I really do not know what is wrong with my UDF. You know it is a just simple UDF to add a body force to particle motion equation. At the same time for the continuous phase i have added material property and it iterates well, but just DPM, it is really troublesome.

Amir March 22, 2011 03:26

Hi,
I'll help you if you post your UDF completely. in this part, you have not defined some parameters like ujianqie or relax_time, also some functions need specific headers that I don't know you've included them or not!

wwt650420 March 22, 2011 04:29

Quote:

Originally Posted by Amir (Post 300466)
Hi,
I'll help you if you post your UDF completely. in this part, you have not defined some parameters like ujianqie or relax_time, also some functions need specific headers that I don't know you've included them or not!

Hi Amir:
Thank you very very much for your warmheartedness.
And my udf is as followed which included several simple programs.
Among them, gas thermal conductivity and gas viscosity works. But drag_coefficient and thermal force dose not work.

#include "udf.h"
#include "dpm.h"
#include "sg_mphase.h"
#include "mem.h"
#include "sg.h"
#include "surf.h"
#include "cxiface.h"
# define pi 3.1415926535
# define diam2 3.e-4
# define sn 1.
# define st 1.
# define boltzmann 1.3806504e-23
# define tshift -536.
# define vgas 11.69
# define dtube 51.e-3
# define twall 488
# define nu_s 0.27
# define nu_p 0.27
# define NUM_UDM 7
# define a 3.3333
# define b 2.4510
# define omiga 0.7644
# define fa 1.272
Domain *d;

/************************************************** *****/
/******initializes particle injection properties********/
/************************************************** *****/
DEFINE_DPM_INJECTION_INIT(inj_vel,I)
{
Particle *p;
loop(p,I->p)
{
cell_t c=RP_CELL(&(p->cCell));
Thread *tcell=RP_THREAD(&(p->cCell));
P_VEL(p)[0]=C_U(c,tcell);
P_VEL(p)[1]=C_V(c,tcell);
P_T(p)=C_T(c,tcell);
}
}
/************************************************** *****/
/************gas thermal conductivity*******************/
/************************************************** *****/
DEFINE_PROPERTY(gas_conduct,c,t)
{
real conduct;
conduct=4.8*(pow(10,-4))*(pow(C_T(c,t),0.717));
return conduct;
}
/************************************************** *****/
/*****************gas viscosity*************************/
/************************************************** *****/
DEFINE_PROPERTY(gas_vis,c,t)
{
real vis;
vis=4.4184*(pow(10,-7))*(pow(C_T(c,t),0.66666667));
return vis;
}
/************************************************** *****/
/******thermophoretic coefficient(kgm2/s2)**************/
/************************************************** *****/
/*DEFINE_DPM_PROPERTY(thermo_coeff,c,tcell,p)
/* c index that identifies the cell where the particle is located in the given thread*/
/* *t pointer to the thread where the particle is located*/
{
real p_tem,p_dia,p_den,knudsen,viscosity,lamda,pione,al pha,
cv,fai,exponent,p_meanv,fth,uth,
relax_time,den_ratio,cunn,d_fenzi;
real renum,prnum,nulam,nuturb,nunum,tau,tau1;
real ujianqie,wendutidu_a,wendutidu_b,wendutidu;
real prt;
real sudu;
real f1,f2,f3,f4,f5;
real l,m,n,o,w,q,fth1;
FILE *fp;
/* cell_t c=RP_CELL(&(p->cCell));
Thread *tcell=RP_THREAD(&(p->cCell));*/
d=Get_Domain(1);
p_meanv=sqrt(((8*C_RGAS(c,tcell))*C_T(c,tcell))/pi);
lamda=2*4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667))/C_R(c,tcell)/p_meanv;
knudsen=2.*lamda/P_DIAM(p);
pione=0.5816;
fai=1.9*(718.+0.1167*C_R(c,tcell))/C_RGAS(c,tcell);
alpha=0.22*sqrt((fai*pi/6.)/(1+0.5*pione*knudsen));
/* molecular diameter */
/*f1=4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667));
f2=1/f1;
f3=pow(f2,0.5);
f4=4.6407*1.3806504*C_T(c,tcell)/pi;
f5=pow(f4,0.25);
d_fenzi=0.559016994*f3*f5;
/*need to * pow(10,-10.25)*/
l=-alpha/knudsen;
m=exp(l);
n=1-m;
o=fai*knudsen;
w=pow(o,0.5);
q=1+pione*knudsen/2;
fth1=0.13174159*knudsen/alpha/q*n*w*1.3806504*P_DIAM(p)*P_DIAM(p)*P_MASS(p)*C_T( c,tcell)/d_fenzi/d_fenzi;
/*need to * pow(10,-10.5)*/
uth=-fth1*pow(10,(-10.5));
fp=fopen("wuxingcanshu.txt","a");
fprintf(fp,"%f %f %f %f %f %f \n",C_RGAS(c,tcell),C_CP(c,tcell),C_U(c,tcell),C_M U_EFF(c,tcell),C_R(c,tcell),C_T(c,tcell));
fp=fopen("thermo.txt","a");
fprintf(fp,"%f %f \n",fth1,uth);
fp=fopen("num.txt","a");
fprintf(fp,"%f %f %f %f %f %f \n",knudsen,pione,alpha,fai,d_fenzi,C_T(c,tcell) );
fp=fopen("thermo1.txt","a");
fprintf(fp,"%f %f %f %f %f %f %f \n",l,m,n,o,w,q,fth1);
fp=fopen("thermo2.txt","a");
fprintf(fp,"%f %f %f %f %f %f \n",f1,f2,f3,f4,f5,d_fenzi);
return uth;
}
/************************************************** *****/
/*****************drag_coefficient***************** *****/
/************************************************** *****/
DEFINE_DPM_DRAG(particle_drag_coeff,Re,p)
{
real cc,freepath,dp,gas_viscosity,cd,drag_coeff;
FILE *fp;
cell_t c=RP_CELL(&(p->cCell));
Thread *tcell=RP_THREAD(&(p->cCell));
/*d=Get_Domain(1);*/
gas_viscosity=4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667));
freepath=0.013745*gas_viscosity/C_R(c,tcell)*pow(27.95/C_T(c,tcell),0.5);
cc=1+2*freepath/P_DIAM(p)*(1.257+0.4*pow(2.71828,-0.55*P_DIAM(p)/freepath));
if(Re<1)
{
cd=24/Re;
drag_coeff=18*cd*Re/cc/24;
fp=fopen("dragcoeff1.txt","a");
fprintf(fp,"%f %f %f %f %f %f \n",gas_viscosity,freepath,cc,cd,drag_coeff,Re);
return drag_coeff ;
}
else
{
cd=24/Re*(1+0.15*pow(Re,0.687));
drag_coeff=18*cd*Re/cc/24;
fp=fopen("dragcoeff2.txt","a");
fprintf(fp,"%f %f %f %f %f %f \n",gas_viscosity,freepath,cc,cd,drag_coeff,Re);
return drag_coeff ;
}
}
/************************************************** *****/
/*******************thermal_force****************** *****/
/************************************************** *****/
DEFINE_DPM_BODY_FORCE(body_force,p,i)
{
real p_tem,p_dia,p_den,knudsen,viscosity,lamda,pione,al pha,
cv,fai,exponent,p_meanv,fth,uth,uthplus,
relax_time,den_ratio,cunn,d_fenzi;
real renum,prnum,nulam,nuturb,nunum,tau,tau1;
real ujianqie,wendutidu_a,wendutidu_b,wendutidu;
real prt;
real sudu;
real f1,f2,f3,f4,f5;
real l,m,n,o,w,q,fth1;

FILE *fp;
cell_t c=RP_CELL(&(p->cCell));
Thread *tcell=RP_THREAD(&(p->cCell));
d=Get_Domain(1);

p_tem=C_T(c,tcell);
p_den=P_RHO(p);
p_dia=P_DIAM(p);
p_meanv=sqrt(((8*C_RGAS(c,tcell))*C_T(c,tcell))/pi);
lamda=2*4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667))/C_R(c,tcell)/p_meanv;
knudsen=2.*lamda/p_dia;
pione=0.18*36./pi/((2-sn+st)*4./pi+sn);
fai=0.25*(9.*1.4-5)*(718.+0.1167*C_R(c,tcell))/C_RGAS(c,tcell);
alpha=0.22*sqrt((fai*pi/6.)/(1+0.5*pione*knudsen));
f1=4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667));
f2=1/f1;
f3=pow(f2,0.5);
f4=4.6407*1.3806504*C_T(c,tcell)/pi;
f5=pow(f4,0.25);
d_fenzi=0.559016994*f3*f5;
/*need to * pow(10,-10.25)*/
/*d_fenzi=pow((0.3125/4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667))),0.5)*(pow(4.6 407*(pow(10.,(-26.)))*boltzmann*C_T(c,tcell)/pi,0.25));*/
den_ratio=p_den/C_R(c,tcell);
cunn=1+knudsen*(1.257+0.4*pow(2.718282,(-1.1)*knudsen));
relax_time=den_ratio*p_dia*p_dia*cunn*C_R(c,tcell)/18./f1;
renum=C_R(c,tcell)*C_U(c,tcell)/omiga*(dtube*pi/2)/(4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667)));
/* Reynolds number */
prt=0.7;
/*prnum=C_CP(c,tcell)*C_MU_EFF(c,tcell)/C_K_EFF(c,tcell,prt);*/
prnum=C_CP(c,tcell)*9.2047*(pow(10,(-4)))*(pow(C_T(c,tcell),-0.050333333));
/* Pr number */
nulam=1/pow(pi,0.5)*pow(renum,0.5)*pow(prnum,0.5)/pow((1+9.73*pow(prnum,0.272)+21.29*prnum),(1/6));
nuturb=0.037*pow(renum,0.8)*prnum/(1+2.443*pow(renum,(-0.1))*(pow(prnum,(2/3))-1));
nunum=pow((nulam*nulam+nuturb*nuturb),0.5)*fa;
/*Hans Dieter Baehr, Karl Stephan. Heat and Mass Transfer(Second, revised Edition). Springer, 2006.*/
sudu=pow((C_U(c,tcell)*C_U(c,tcell)+C_V(c,tcell)*C _V(c,tcell)),0.5);
tau=nunum*C_R(c,tcell)*sudu*sudu/renum/prnum;
tau1=nunum*C_R(c,tcell)*vgas*vgas/renum/prnum;
ujianqie=pow(tau/C_R(c,tcell),0.5);
wendutidu_a=ujianqie*ujianqie*(C_R(c,tcell)-twall)*C_R(c,tcell)/(4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667)))/(vgas-5*ujianqie);
if (wendutidu_a>0)
{
wendutidu=wendutidu_a;
}
else if (wendutidu_a<0)
{
wendutidu=0-wendutidu_a;
}
l=-alpha/knudsen;
m=exp(l);
n=1-m;
o=fai*knudsen;
w=pow(o,0.5);
q=1+pione*knudsen/2;
fth1=0.179021181*knudsen*n*w*1.3806504*p_dia*p_dia *pow(10,12)*wendutidu/q/d_fenzi/d_fenzi;
/*need to * pow(10,-10.5)*/
/*fth=1.15*knudsen/(4.*pow(2.,0.5)/(1+pione*knudsen/2))*(1-exp(-alpha/knudsen))*pow(4*fai*pione*knudsen/3./pi,0.5)*boltzmann*p_dia*p_dia*wendutidu/d_fenzi/d_fenzi;*/
uth=fth1*pow(10,(-10.5))/P_MASS(p);
uthplus=fth1*pow(10,(-10.5))*relax_time/P_MASS(p)/ujianqie;
return uth ;
}

Amir March 22, 2011 14:32

Hi,
first make sure that your energy model is activated in GUI. I made some changes and it work without errors if you disable writing to files : (drag coeff. and body force macros)
Code:

#include "udf.h"
#include "dpm.h"
#include "sg_mphase.h"
#include "mem.h"
#include "sg.h"
#include "surf.h"
#include "cxiface.h"
# define pi 3.1415926535
# define diam2 3.e-4
# define sn 1.
# define st 1.
# define boltzmann 1.3806504e-23
# define tshift -536.
# define vgas 11.69
# define dtube 51.e-3
# define twall 488
# define nu_s 0.27
# define nu_p 0.27
# define NUM_UDM 7
# define a 3.3333
# define b 2.4510
# define omiga 0.7644
# define fa 1.272
Domain *d;
/************************************************** *****/
/******initializes particle injection properties********/
/************************************************** *****/
//DEFINE_DPM_INJECTION_INIT(inj_vel,I)
//{
//Particle *p;
//loop(p,I->p)
//{
//cell_t c=RP_CELL(&(p->cCell));
//Thread *tcell=RP_THREAD(&(p->cCell));
//P_VEL(p)[0]=C_U(c,tcell);
//P_VEL(p)[1]=C_V(c,tcell);
//P_T(p)=C_T(c,tcell);
//}
//}
///************************************************** *****/
///************gas thermal conductivity*******************/
///************************************************** *****/
//DEFINE_PROPERTY(gas_conduct,c,t)
//{
//real conduct;
//conduct=4.8*(pow(10,-4))*(pow(C_T(c,t),0.717));
//return conduct;
//}
///************************************************** *****/
///*****************gas viscosity*************************/
///************************************************** *****/
//DEFINE_PROPERTY(gas_vis,c,t)
//{
//real vis;
//vis=4.4184*(pow(10,-7))*(pow(C_T(c,t),0.66666667));
//return vis;
//}
///************************************************** *****/
///******thermophoretic coefficient(kgm2/s2)**************/
///************************************************** *****/
//DEFINE_DPM_PROPERTY(thermo_coeff,c,tcell,p)
///* c index that identifies the cell where the particle is located in the given thread*/
///* *t pointer to the thread where the particle is located*/
//{
//real p_tem,p_dia,p_den,knudsen,viscosity,lamda,pione,al pha,
//cv,fai,exponent,p_meanv,fth,uth,
//relax_time,den_ratio,cunn,d_fenzi;
//real renum,prnum,nulam,nuturb,nunum,tau,tau1;
//real ujianqie,wendutidu_a,wendutidu_b,wendutidu;
//real prt;
//real sudu;
//real f1,f2,f3,f4,f5;
//real l,m,n,o,w,q,fth1;
//FILE *fp;
///* cell_t c=RP_CELL(&(p->cCell));
//Thread *tcell=RP_THREAD(&(p->cCell));*/
//d=Get_Domain(1);
//p_meanv=sqrt(((8*C_RGAS(c,tcell))*C_T(c,tcell))/pi);
//lamda=2*4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667))/C_R(c,tcell)/p_meanv;
//knudsen=2.*lamda/P_DIAM(p);
//pione=0.5816;
//fai=1.9*(718.+0.1167*C_R(c,tcell))/C_RGAS(c,tcell);
//alpha=0.22*sqrt((fai*pi/6.)/(1+0.5*pione*knudsen));
///* molecular diameter */
///*f1=4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667));
//f2=1/f1;
//f3=pow(f2,0.5);
//f4=4.6407*1.3806504*C_T(c,tcell)/pi;
//f5=pow(f4,0.25);
//d_fenzi=0.559016994*f3*f5;
///*need to * pow(10,-10.25)*/
//l=-alpha/knudsen;
//m=exp(l);
//n=1-m;
//o=fai*knudsen;
//w=pow(o,0.5);
//q=1+pione*knudsen/2;
//fth1=0.13174159*knudsen/alpha/q*n*w*1.3806504*P_DIAM(p)*P_DIAM(p)*P_MASS(p)*C_T( c,tcell)/d_fenzi/d_fenzi;
///*need to * pow(10,-10.5)*/
//uth=-fth1*pow(10,(-10.5));
//fp=fopen("wuxingcanshu.txt","a");
//fprintf(fp,"%f %f %f %f %f %f \n",C_RGAS(c,tcell),C_CP(c,tcell),C_U(c,tcell),C_M U_EFF(c,tcell),C_R(c,tcell),C_T(c,tcell));
//fp=fopen("thermo.txt","a");
//fprintf(fp,"%f %f \n",fth1,uth);
//fp=fopen("num.txt","a");
//fprintf(fp,"%f %f %f %f %f %f \n",knudsen,pione,alpha,fai,d_fenzi,C_T(c,tcell) );
//fp=fopen("thermo1.txt","a");
//fprintf(fp,"%f %f %f %f %f %f %f \n",l,m,n,o,w,q,fth1);
//fp=fopen("thermo2.txt","a");
//fprintf(fp,"%f %f %f %f %f %f \n",f1,f2,f3,f4,f5,d_fenzi);
//return uth;
//}
/************************************************** *****/
/*****************drag_coefficient***************** *****/
/************************************************** *****/
DEFINE_DPM_DRAG(particle_drag_coeff,Re,p)
{
real cc,freepath,dp,gas_viscosity,cd,drag_coeff;
//FILE *fp;
cell_t c=RP_CELL(&(p->cCell));
Thread *tcell=RP_THREAD(&(p->cCell));
/////*d=Get_Domain(1);*/
gas_viscosity=4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667));
freepath=0.013745*gas_viscosity/C_R(c,tcell)*pow(27.95/C_T(c,tcell),0.5);
cc=1+2*freepath/P_DIAM(p)*(1.257+0.4*pow(2.71828,-0.55*P_DIAM(p)/freepath));
if(Re<1)
{
cd=24/Re;
drag_coeff=18*cd*Re/cc/24;
//fp=fopen("dragcoeff1.txt","w");
//fprintf(fp,"%f %f %f %f %f %f \n",gas_viscosity,freepath,cc,cd,drag_coeff,Re);
return drag_coeff ;
}
else
{
cd=24/Re*(1+0.15*pow(Re,0.687));
drag_coeff=18*cd*Re/cc/24;
//fp=fopen("dragcoeff2.txt","a");
//fprintf(fp,"%f %f %f %f %f %f \n",gas_viscosity,freepath,cc,cd,drag_coeff,Re);
return drag_coeff ;
}
}
/************************************************** *****/
/*******************thermal_force****************** *****/
/************************************************** *****/
DEFINE_DPM_BODY_FORCE(body_force,p,i)
{
Domain *d=Get_Domain(1);
Thread *tcell=RP_THREAD(&(p->cCell));
cell_t c=RP_CELL(&(p->cCell));
real p_tem,p_dia,p_den,knudsen,viscosity,lamda,pione,alpha,
cv,fai,exponent,p_meanv,fth,uth,uthplus,
relax_time,den_ratio,cunn,d_fenzi;
real renum,prnum,nulam,nuturb,nunum,tau,tau1;
real ujianqie,wendutidu_a,wendutidu_b,wendutidu;
real prt;
real sudu;
real f1,f2,f3,f4,f5;
real l,m,n,o,w,q,fth1;
//FILE *fp;
p_tem=C_T(c,tcell);
p_den=P_RHO(p);
p_dia=P_DIAM(p);
p_meanv=sqrt(((8*C_RGAS(c,tcell))*C_T(c,tcell))/pi);
lamda=2*4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667))/C_R(c,tcell)/p_meanv;
knudsen=2.*lamda/p_dia;
pione=0.18*36./pi/((2-sn+st)*4./pi+sn);
fai=0.25*(9.*1.4-5)*(718.+0.1167*C_R(c,tcell))/C_RGAS(c,tcell);
alpha=0.22*sqrt((fai*pi/6.)/(1+0.5*pione*knudsen));
f1=4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667));
f2=1/f1;
f3=pow(f2,0.5);
f4=4.6407*1.3806504*C_T(c,tcell)/pi;
f5=pow(f4,0.25);
d_fenzi=0.559016994*f3*f5;
/*need to * pow(10,-10.25)*/
/*d_fenzi=pow((0.3125/4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667))),0.5)*(pow(4.6 407*(pow(10.,(-26.)))*boltzmann*C_T(c,tcell)/pi,0.25));*/
den_ratio=p_den/C_R(c,tcell);
cunn=1+knudsen*(1.257+0.4*pow(2.718282,(-1.1)*knudsen));
relax_time=den_ratio*p_dia*p_dia*cunn*C_R(c,tcell)/18./f1;
renum=C_R(c,tcell)*C_U(c,tcell)/omiga*(dtube*pi/2)/(4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667)));
/* Reynolds number */
prt=0.7;
/*prnum=C_CP(c,tcell)*C_MU_EFF(c,tcell)/C_K_EFF(c,tcell,prt);*/
prnum=C_CP(c,tcell)*9.2047*(pow(10,(-4)))*(pow(C_T(c,tcell),-0.050333333));
/* Pr number */
nulam=1/pow(pi,0.5)*pow(renum,0.5)*pow(prnum,0.5)/pow((1+9.73*pow(prnum,0.272)+21.29*prnum),(1/6));
nuturb=0.037*pow(renum,0.8)*prnum/(1+2.443*pow(renum,(-0.1))*(pow(prnum,(2/3))-1));
nunum=pow((nulam*nulam+nuturb*nuturb),0.5)*fa;
/*Hans Dieter Baehr, Karl Stephan. Heat and Mass Transfer(Second, revised Edition). Springer, 2006.*/
sudu=pow((C_U(c,tcell)*C_U(c,tcell)+C_V(c,tcell)*C_V(c,tcell)),0.5);
tau=nunum*C_R(c,tcell)*sudu*sudu/renum/prnum;
tau1=nunum*C_R(c,tcell)*vgas*vgas/renum/prnum;
ujianqie=pow(tau/C_R(c,tcell),0.5);
wendutidu_a=ujianqie*ujianqie*(C_R(c,tcell)-twall)*C_R(c,tcell)/(4.4184*(pow(10,(-7)))*(pow(C_T(c,tcell),0.66666667)))/(vgas-5*ujianqie);
if (wendutidu_a>0)
{
wendutidu=wendutidu_a;
}
else if (wendutidu_a<0)
{
wendutidu=0-wendutidu_a;
}
l=-alpha/knudsen;
m=exp(l);
n=1-m;
o=fai*knudsen;
w=pow(o,0.5);
q=1+pione*knudsen/2;
fth1=0.179021181*knudsen*n*w*1.3806504*p_dia*p_dia *pow(10,12)*wendutidu/q/d_fenzi/d_fenzi;
/*need to * pow(10,-10.5)*/
/*fth=1.15*knudsen/(4.*pow(2.,0.5)/(1+pione*knudsen/2))*(1-exp(-alpha/knudsen))*pow(4*fai*pione*knudsen/3./pi,0.5)*boltzmann*p_dia*p_dia*wendutidu/d_fenzi/d_fenzi;*/
uth=fth1*pow(10,(-10.5))/P_MASS(p);
uthplus=fth1*pow(10,(-10.5))*relax_time/P_MASS(p)/ujianqie;
return uth ;
}


wwt650420 March 22, 2011 22:13

Hi.
Dear Amir.
Thank you for Ur help. With Ur advise for my UDF, it works when i disable writing to files.
Maybe now i am nor sure whether the result is right or not, while at least it iterats.
So thank you again!

cdf_user April 25, 2011 01:13

Thermophoretic force
 
I am trying to look for a formula for thermophoretic force on a particle in liquid for discrete phase modelling. I was wondering if you could explain where you got the formula (book or peer reviewed articles) for "fth" in thermal force section of your udf? Is this force relevant to particles in liquid or gas domain? In one of the comments, it mentions this book Hans Dieter Baehr, Karl Stephan. Heat and Mass Transfer(Second, revised Edition). Springer, 2006, could you specify which section or chapter of the book. I dont have the book but I will get it once I am sure this book has the formula for thermophoretic force on the particle.
Thank You

chmurillor January 6, 2012 21:06

DPM body force help
 
Hi everybody

I need to include forces related to interacions between solid particles. However, the ANSYS Fluent help establishes that an UDF for a body force receives parameters for one particle only. However, I need to include a force parameter that depends on the distance between two particles. For this specific force, the only option I have seen so far is a body force.

I would like to know if it's possible to adjust this type of UDF to receive information (position, velocity and diameter) for more than 1 particle.

Thanks in advance for your help


All times are GMT -4. The time now is 20:17.