Sie sind auf Seite 1von 2

DEFINE Macros The function assumes an ideal reflection for the normal velocity component (nor_coeff = 1) while the

tangential component is damped (tan_coeff = 0.3). First, the angle of incidence is computed. Next, the normal particle velocity, with respect to the wall, is computed and subtracted from the particles velocity. The reflection is complete after the reflected normal velocity is added. The new particle velocity has to be stored in P_VEL0 to account for the change of particle velocity in the momentum balance for coupled flows. The function returns PATH_ACTIVE for inert particles while it stops particles of all other types.
/* reflect boundary condition for inert particles */ #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 = 1.; real tan_coeff = 0.3; real normal[3]; int i, idim = dim; real NV_VEC(x); #if RP_2D /* dim is always 2 in 2D compilation. Need special treatment for 2d axisymmetric and swirl flows */ if (rp_axi_swirl) { real R = sqrt(P_POS(p)[1]*P_POS(p)[1] + P_POS(p)[2]*P_POS(p)[2]); if (R > 1.e-20) { idim = 3; normal[0] = f_normal[0]; normal[1] = (f_normal[1]*P_POS(p)[1])/R; normal[2] = (f_normal[1]*P_POS(p)[2])/R; } else { for (i=0; i<idim; i++) normal[i] = f_normal[i]; } } else #endif 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); /* 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];
Release 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.

156

Discrete Phase Model (DPM) DEFINE Macros

/* 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; }

2.5.1.4. Example 2
This example shows how to use DEFINE_DPM_BC for a wall impingement model. The function must be executed as a compiled UDF.
#include #include #include #include "udf.h" "dpm.h" "surf.h" "random.h"

/* define a user-defined dpm boundary condition routine * bc_reflect: name * p: the tracked particle * t: the touched face thread * f: the touched face * f_normal: normal vector of touched face * dim: dimension of the problem (2 in 2d and 2d-axi-swirl, 3 in 3d) * * return is the status of the particle, see enumeration of Path_Status * in dpm.h */ #define V_CROSS(a,b,r)\ ((r)[0] = (a)[1]*(b)[2] - (b)[1]*(a)[2],\ (r)[1] = (a)[2]*(b)[0] - (b)[2]*(a)[0],\ (r)[2] = (a)[0]*(b)[1] - (b)[0]*(a)[1]) DEFINE_DPM_BC(bc_wall_jet, p, thread, f, f_normal, dim) { /* Routine implementing the Naber and Reitz Wall impingement model (SAE 880107) */ real normal[3]; real tan_1[3]; real tan_2[3]; real rel_vel[3]; real face_vel[3]; real alpha, beta, phi, cp, sp; real rel_dot_n, vmag, vnew, dum; real weber_in, weber_out; int i, idim = dim; cxboolean moving = (SV_ALLOCATED_P (thread,SV_BND_GRID_V) && SV_ALLOCATED_P (thread,SV_WALL_V)); #if RP_2D if (rp_axi_swirl) { real R = sqrt(P_POS(p)[1]*P_POS(p)[1] + P_POS(p)[2]*P_POS(p)[2]); if (R > 1.e-20) { idim = 3; normal[0] = f_normal[0]; normal[1] = (f_normal[1]*P_POS(p)[1])/R; normal[2] = (f_normal[1]*P_POS(p)[2])/R; } else { for (i=0; i<idim; i++) normal[i] = f_normal[i];
Release 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.

157

Das könnte Ihnen auch gefallen