You can use DEFINE_IGNITE_SOURCE to
customize the ignition time source term in the autoignition model.
DEFINE_IGNITE_SOURCE (name, c, t, source)
|
Argument Type |
Description |
|---|---|
|
|
UDF name |
|
|
Cell index |
|
|
Pointer to cell thread on which the ignition source term is to be applied |
|
|
Pointer to the ignition source term |
Function returns
void
There are four arguments to DEFINE_IGNITE_SOURCE: name, c, t, and source. You supply name, the name of the UDF. c, t and source are
variables that are passed by the ANSYS Fluent solver to your UDF. Your
UDF will need to set the value referenced by the source pointer as shown in the example below.
The following UDF, named ign_udf_src, specifies a custom source term in the ignition model. The source
code must be executed as a compiled UDF in ANSYS Fluent.
In the standard ignition model in ANSYS Fluent, the source term for the ignition progress variable is given by a Livengood-Wu integral [7]:
(2–5) |
where is the flow time step and
is the correlation between spark time and knock,
by Douaud and Eyzat [3]:
(2–6) |
Here, is the octane number of the fuel,
is the absolute pressure in atmospheres and
is the temperature in Kelvin.
In the following UDF example, the Douaud and Eyzat correlation
is used to calculate an induction time. See Additional Macros for Writing UDFs for details on the NNULLP, C_STORAGE_R, C_PREMIXC_T, C_P, C_R, CURRENT_TIMESTEP and C_IGNITE macros used below.
/*------------------------------------------------------------------
This UDF produces an ignition model source in ANSYS Fluent v12.0 or
later that uses the default parameters for the correlation of Douaud
and Eyzat for knock.
/*------------------------------------------------------------------*/
#include "udf.h"
real A = 0.01768; /* Preexponential */
real Ea = 3800; /* Activation temperature */
real O_N = 90.0; /* Octane number */
real O_E = 3.402; /* Octane number exponent */
real P_E = -1.7; /* Pressure exponent */
static real A1 = 0.0; /* Cached value of A*ON^OE */
static real dt = 0.0; /* Cached time step */
static real p_op = 0.0; /* Cached value of operating pressure */
static cxboolean lit = FALSE; /* Cached burning flag */
DEFINE_IGNITE_SOURCE(ign_udf_src, c, t, source)
{
real rho = C_R(c,t);
real time = 0.0;
real prog = NNULLP(THREAD_STORAGE(t,SV_PREMIXC_M1)) ?
C_STORAGE_R(c,t,SV_PREMIXC_M1) :
C_STORAGE_R(c,t,SV_PREMIXC) ;
real fuel = 1.0 - prog;
real T = C_PREMIXC_T(c,t);
real P = C_P(c,t);
real ipv = C_IGNITE(c,t);
if (c == 0)
{
dt = CURRENT_TIMESTEP;
p_op = RP_Get_Real("operating-pressure");
A1 = A * pow(O_N/100,O_E);
}
if (ipv > 1.0)
lit = TRUE;
P += p_op;
P /= 101325.; /* in atm */
P = MAX(P,0.01); /* minimum pressure for ignition */
if (fuel > 0.99 || lit)
time = A1 * pow(P,P_E) * exp(Ea/T);
if (time > 0.0)
{
real max_source = rho*(5.0-ipv)/dt;
real user_source = rho/time;
*source = MIN(user_source,max_source);
}
else
*source = 0.0;
return;
}
After the UDF that you have defined using DEFINE_IGNITE_SOURCE is compiled (Compiling UDFs), the name
of the argument that you supplied as the first DEFINE macro argument (for example, ign_udf_src) will become visible and selectable in the User-Defined
Function Hooks dialog box in ANSYS Fluent. See Hooking DEFINE_IGNITE_SOURCE UDFs for details.