|
使用DEFINE_DPM_BC宏来实现。记得hook。
#include "udf.h"
DEFINE_DPM_BC(usr_bc_reflect,p,t,f,f_normal,dim)
{
real cos_angle,angle;
cos_angle=NV_DOT(f_normal,P_VEL(p))/MAX(NV_MAG(P_VEL(p)),DPM_SMALL);
cos_angle=MIN(1.0,MAX(-1.0,cos_angle));
angle=90.0-acos(cos_angle)/M_PI*180.0;
Message0("particle id=%d,angle between particle velocity and wall face=%f degree\n",p->part_id,angle);
Reflect_Particle(p,f_normal,dim,f,t,t,f); //if "trap" condition, then use "Trap_Particle(p);"
return PATH_ACTIVE; // if "trap" condition, then use "return PATH_END;"
}