我用fluent模拟气固管流冲蚀,得到了壁面的冲蚀速率:
1、问题:fluent导出壁面数据后,缺乏颗粒对壁面的平均碰撞速度(轴向、径向、切向)和平均角度(入射角、反射角)这五个变量。 一个壁面位置受多次颗粒撞击,速度和角度有多个,需要统计一下平均。
2、UDF刚接触,按照模板修改了一点点,不知道怎么继续写下去,求高人指路!
#include "udf.h"
DEFINE_DPM_BC(bc_reflect,p,t,f,f_normal,dim)
{
real alpha; /* angle of particle path with face normal */
real vn=0.;
real nor_coeff = 0.;
real tan_coeff = 0;
real normal[3];
int i, idim = dim;
real NV_VEC(x);
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_VEL(p))/
MAX(NV_MAG(P_VEL(p)),DPM_SMALL))));
if ((NNULLP(t)) && (THREAD_TYPE(t) == THREAD_F_WALL))
F_CENTROID(x,f,t);
/* 定义壁面反射系数 */
nor_coeff=0.993-0.0307*alpha+4.75e-4*alpha*alpha-2.61e-6*alpha*alpha*alpha
tan_coeff=0.998-0.029*alpha+6.43e-4*alpha*alpha-3.56e-6*alpha*alpha*alpha
/* calculate the normal component, rescale its magnitude by
the coefficient of restitution and subtract the change */
/* Compute normal velocity. */
for(i=0; i<idim; i++)
vn += P_VEL(p)[i]*normal[i];
/* Subtract off normal velocity. */
for(i=0; i<idim; i++)
P_VEL(p)[i] -= vn*normal[i];
/* Apply tangential coefficient of restitution. */
for(i=0; i<idim; i++)
P_VEL(p)[i] *= tan_coeff;
/* Add reflected normal velocity. */
for(i=0; i<idim; i++)
P_VEL(p)[i] -= nor_coeff*vn*normal[i];
/* Store new velocity in P_VEL0 of particle */
for(i=0; i<idim; i++)
P_VEL0(p)[i] = P_VEL(p)[i];
return PATH_ACTIVE;
}
return PATH_ABORT;
}