You can use DEFINE_SPLASHING_DISTRIBUTION to customize the diameter, number in parcel, and velocity distribution
for the splashed particles.
DEFINE_SPLASHING_DISTRIBUTION (name, tp, rel_dot_n, f_normal, n_splash, splashing_distribution_t *s)
|
Argument Type |
Description | |||
|---|---|---|---|---|
|
|
UDF name. | |||
|
|
Pointer to the | |||
|
|
The particle impingement velocity magnitude | |||
|
| Array that contains the unit vector which is normal to the face | |||
int n_splash
| Number of splashed particle parcels. | |||
splashing_distribution_t *s
| Array of pointers to structure s of size n_splash, containing
the splashed particle variables distribution defined by the following
macros:
|
Function returns
void
There are six arguments to DEFINE_SPLASHING_DISTRIBUTION: name, tp, real_dot_n, f_normal, n_splash, and s. You supply
the name of your user-defined function. tp, real_dot_n, f_normal, and n_splash are
passed by the ANSYS Fluent solver to your UDF. Note that n_splash is the
value entered for Number of Splashed Drops in
the DPM tab of the boundary condition dialog
box when Boundary Cond. Type is set to wall-film. The output of your function is the array of
pointers to the structure *s containing the
distribution of the n_splash particle parcels.
The following UDF applies the O’Rourke & Amsden splashing model [10]. This function must be run as a compiled UDF.
#include "udf.h"
#define NUKIYAMA_TANASAWA_TABLE_SIZE 15
static double nukiyama_tanasawa_table[NUKIYAMA_TANASAWA_TABLE_SIZE][2] =
{
{0.000000000000, 0.000000000000},
{0.081108621634, 0.500000000000},
{0.193908811137, 0.700000000000},
{0.266112345561, 0.800000000000},
{0.345136495805, 0.900000000000},
{0.427593287415, 1.000000000000},
{0.510077497807, 1.100000000000},
{0.589500744183, 1.200000000000},
{0.663337543595, 1.300000000000},
{0.729766711799, 1.400000000000},
{0.787709698251, 1.500000000000},
{0.877181682854, 1.700000000000},
{0.934793421924, 1.900000000000},
{0.953988295926, 2.000000000000},
{1.000000000000, 4.000000000000},
};
double get_interpolated_value(double table[][2], int table_size, double inval)
{
/* table is table[tableSize][1] with table[i][0] being the lookup values
and table[i][1] the return values */
int lowerindex, upperindex, midindex, jump;
double lowerval, upperval, midval, ratio;
lowerindex = 0;
upperindex = table_size-1;
lowerval = table[lowerindex][0];
upperval = table[upperindex][0];
jump = (upperindex-lowerindex)/2;
/* Find values for Interpolation */
while (jump)
{
midindex = lowerindex + jump;
midval = table[midindex][0];
if (inval > midval)
{
lowerval = midval;
lowerindex = midindex;
}
else
{
upperval = midval;
upperindex = midindex;
}
jump /= 2;
}
ratio = (inval-lowerval)/(upperval - lowerval);
lowerval = table[lowerindex][1];
upperval = table[upperindex][1];
return lowerval + ratio*(upperval - lowerval);
}
double nukiyama_tanasawa_random()
{
return get_interpolated_value(nukiyama_tanasawa_table, NUKIYAMA_TANASAWA_TABLE_SIZE, uniform_random());
}
double nabor_reitz_random(double beta)
{
double exp_beta;
double rand;
double angle_range;
angle_range = M_PI;
rand = 1.0 - 2.0*uniform_random(); /* -1.0 < rand <= 1.0 */
if (beta == 0.0)
return angle_range * rand;
if (rand < 0.0)
{
angle_range = -M_PI;
rand = -rand; /* 0.0 <= rand <= 1.0 */
}
exp_beta = exp(beta);
return angle_range*(beta - log(exp_beta + rand*(1.0 - exp_beta)))/beta;
}
/* O'Rourke & Amsden splashing model BC definition */
#define E_2_CRIT 3329.29 /* O'Rourke & Amsden critical energy squared (57.7^2) */
DEFINE_SPLASHING_DISTRIBUTION(splash, tp, rel_dot_n, norm, n_splashes, s)
{
int i;
real p_diam, p_v_mag; /* Particle properties */
real w0, v0, v_t; /* Particle condition */
real E_2;
real sin_alpha;
real e_t[ND_ND], e_p[ND_ND];
/* Splashed particle properties */
real weber;
real d_max, w_dash, v_dash;
real beta, psi, component;
real total_volume = 0.;
p_diam = TP_DIAM(tp);
/* norm into wall and TP_VEL should be so w0 >= 0.0 */
w0 = NV_DOT(TP_VEL(tp),norm);
/* Particle impingement energy */
E_2 = TP_IMPINGEMENT_PARAMETER(tp);
/* Calculate new splash stream droplet diameters */
weber = TP_WEBER_IMP(tp);
d_max = MAX(MAX((E_2_CRIT/E_2),(6.4/weber)),0.06)*p_diam;
for (i=0;i<n_splashes;i++)
{
SPLASH_DIAM(s,i) = d_max * nukiyama_tanasawa_random();
}
/* Calculate droplet velocities */
NV_CROSS(e_p,TP_VEL(tp),norm);
p_v_mag = NV_MAG(TP_VEL(tp));
NV_S(e_p,/=,p_v_mag);
sin_alpha = NV_MAG(e_p);
/* If particle hits exactly normal to surface tilt slightly */
sin_alpha = MAX(1.E-6, sin_alpha);
NV_S(e_p,/=,sin_alpha);
beta = M_PI*sqrt(sin_alpha/MAX(DPM_SMALL,(1.0-sin_alpha)));
NV_CROSS(e_t,norm,e_p);
v0 = NV_DOT(TP_VEL(tp),e_t); /* Tangential to wall */
v_t = 0.8*v0;
for (i=0;i<n_splashes;i++)
{
w_dash = -0.2 * w0 * nukiyama_tanasawa_random();
NV_VS(SPLASH_VEL(s,i),=,norm,*,w_dash);
v_dash = 0.1 * w0 * fabs(gauss_random()); /* O'Rourke and Amsden: delta = 0.1 w0 */
v_dash += 0.12*w0;
psi = nabor_reitz_random(beta);
component = v_dash * cos(psi);
NV_VS(SPLASH_VEL(s,i),+=,e_t,*,component);
component = v_dash * sin(psi);
NV_VS(SPLASH_VEL(s,i),+=,e_p,*,component);
NV_VS(SPLASH_VEL(s,i),+=,e_t,*,v_t);
}
/* The flow rate for each diameter will be proportional to its mass (=volume as density equal) */
for (i=0;i<n_splashes;i++)
{
total_volume += CUB( SPLASH_DIAM(s,i));
}
for (i=0;i<n_splashes;i++)
{
SPLASH_N(s,i) = TP_SPLASHED_FRACTION(tp)*CUB(SPLASH_DIAM(s,i))/total_volume*TP_N(tp);
}
}
After the UDF that you have defined using DEFINE_SPLASHING_DISTRIBUTION is compiled (Compiling UDFs) the name
that you supplied as the first DEFINE macro
argument will become visible and selectable in the Discrete
Phase Model dialog box in ANSYS Fluent. See Hooking DEFINE_SPLASHING_DISTRIBUTION UDFs for details on how to hook
your DEFINE_SPLASHING_DISTRIBUTION UDF to ANSYS Fluent.