The Non-Premixed and Partially-Premixed models in ANSYS Fluent employ look-up tables that store the convolution of state-relations with assumed-shape PDFs as described by Equation 8–16 to Equation 8–19, Equation 8–24 and Equation 8–25 in the Theory Guide. ANSYS Fluent solves transport equations for lower moments, such as the mean mixture fraction and the mean enthalpy, and interpolates the PDF table for the required variables:
Mean temperature
Mean density
Mean specific heat
Mean mixture molecular weight
Mean species mole fractions
You can use DEFINE_PDF_TABLE to customize
the above variables.
When using DEFINE_PDF_TABLE, you must use ANSYS Fluent's transport equations for mixture fraction;
for non-adiabatic cases, you must use mean enthalpy.
The model settings and options that apply to your user-defined PDF Table must be set through the standard ANSYS Fluent interface and a valid PDF table with the same settings and options must be generated or read into ANSYS Fluent before you can use your UDF table. For example, if your PDF Table is a two-mixture fraction non-adiabatic table, you first generate/read a valid two-mixture fraction non-adiabatic PDF file. The reason for doing this is that ANSYS Fluent will need to access some information about your system, such as the species order and the boundary compositions and temperatures through this default PDF table.
When generating your default ANSYS Fluent PDF file, you must use the same thermodynamic database file as you used to create your UDF table.
You must ensure that the species order in your default ANSYS Fluent PDF file is identical to the order in your PDF table. The default ANSYS Fluent species order is in the material structure pdf-mixture, which is passed to the UDF.
DEFINE_PDF_TABLE must use
the identical fuel and oxidizer boundary compositions and temperatures
as in the corresponding default ANSYS Fluent PDF file. If you are using
the two mixture fraction model, the same applies for the secondary
stream.
When you are using the Partially-Premixed or the Inert
models, the DEFINE_PDF_TABLE UDF must return
the properties of the burnt mixture.
The UDF cannot currently be used for calculation of pollutant rates. Instead, ANSYS Fluent will perform these calculations.
Your UDF can access and use the variables and functions in the default PDF table, such as boundary composition values and the adiabatic enthalpy function, listed in the header files pdf_props.h and pdf_table.h, which you would need to include in your UDF.
The UDF is called for all fluid cells and boundary faces, every iteration, and care should be taken to efficiently interpolate your table.
DEFINE_PDF_TABLE (name, m, c, t, fmean, fvar, fmean2, fvar2, cmean, cvar
h, what, prop, x, s_pollut)
Note that all the arguments of a DEFINE macro need to be placed on the same line in your source code. Splitting
the DEFINE statement into several lines will
result in a compilation error.
DEFINE_PDF_TABLE functions
can be executed only as compiled UDFs.
|
Argument Type |
Description |
|---|---|
|
|
UDF name. |
|
|
Pointer to the mixture material pdf-mixture. |
|
|
Cell or face index. |
|
|
Pointer to the cell or face thread. |
|
|
Mean mixture fraction. |
|
|
Mixture fraction variance. |
|
|
Secondary mean mixture fraction. |
|
|
Secondary mixture fraction variance. |
|
|
Mean progress variable (used with the partially premixed flamelet model). |
|
|
Progress variable variance (used with the partially premixed flamelet model). |
|
|
Mean enthalpy. |
|
|
Integer indicating the variables that the ANSYS Fluent solver is expecting to be computed by the UDF as follows: 0 calculate the thermodynamic properties in array prop 1 calculate the thermodynamic properties and the species mole fractions x 2 calculate the thermodynamic properties, the species mole fractions and the pollutant rates in array s_pollut |
|
|
Thermodynamic variables as follows: prop[0] temperature prop[1] density prop[2] specific heat prop[3] mean molecular weight |
|
|
Species mole fractions. |
|
|
Array of pointers to structure
of mean pollutant rates for s_pollut[ ]->fwdrate forward rate gmol/m3/s s_pollut[ ]->revrate reverse rate gmol/m3/s s_pollut[ ]->quasirate quasi-steady concentration gmol/m3 s_pollut[ ]->rate[ ] array of overall rates of individual pollutant models (used in postprocessing) |
Function returns
void
There are thirteen arguments to DEFINE_PDF_TABLE. You supply name, the name of the UDF. The variables m, c, t, fmean, fvar, fmean2, fvar2, cmean, cvar, h, what are passed by the ANSYS Fluent solver to your UDF. The output of the function are the array of thermodynamic variables prop and the array of mole fractions x.
The following example is a source code template where the DEFINE_PDF_TABLE function is used to calculate properties and mole fractions from the PDF file loaded by the user for an adiabatic partially premixed flamelet case.
/*********************************************************************
Example UDF that demonstrates the use of DEFINE_PDF_TABLE to replace the default PDF table
**********************************************************************/
#include <udf.h>
#include "pdf_props.h"
#include "pdf_table.h"
DEFINE_PDF_TABLE(pdf_table, m, c, t, fmean, fvar, fmean2, fvar2, cmean, cvar, h, what, prop, x, s_pollut)
{
#define DEN_MIN 1E-4
real sum_x =1.;
int i;
Table_Point value ;
cxboolean do_species = FALSE;
cxboolean Pdf_Interpolation_Method_Linear_Save =
Pdf_Interpolation_Method_Linear;
if NULLP(pf)
Error("Please generate or read a Fluent PDF file first\n");
if(what < 0) /*special call to return the FGM flame speed source*/
{
do_species = 2;/*set this to get the progress variable finite rate source terms*/
Pdf_Interpolation_Method_Linear = FALSE;
/* premix adiabatic flamelet */
if (PdfModel.premix_flamelet_ad )
{
int Pdf_Interp_Vars[MAX_PDF_VARS]={0}, Num_Pdf_Interp_Vars=0;
value = Interpolate_multi_table(fmean, fvar, cmean, cvar, h, ALL,
do_species, Num_Pdf_Interp_Vars,
Pdf_Interp_Vars);
}
prop[TEMP_UDF] = value.temp;/*This is the value of progress variable source term */
}
else if( what==2)
{
Error("Pollutant UDF not supported\n");
}
else if( what==1)
{
do_species = TRUE;
Pdf_Interpolation_Method_Linear = FALSE;
/* premix adiabatic flamelet */
if (PdfModel.premix_flamelet_ad )
{
int Pdf_Interp_Vars[MAX_PDF_VARS]={0}, Num_Pdf_Interp_Vars=0;
value = Interpolate_multi_table(fmean, fvar, cmean, cvar, h, ALL,
do_species, Num_Pdf_Interp_Vars,
Pdf_Interp_Vars);
}
if (value.temp>1.0)
{
prop[TEMP_UDF] = value.temp;
prop[CP_UDF] = value.cp;
prop[DEN_UDF] = MAX(DEN_MIN,value.den);
prop[MOL_WT_MIX_UDF] = value.mol_wt ;
for (i = 0; i < n_spe_pdf - 1; i++)
{
x[i] = value.xmol[i];
if (x[i] < 0)
x[i] = 0;
sum_x -= x[i];
}
x[n_spe_pdf - 1] = (sum_x > 0) ? sum_x : 0;
}
}
else /*no_species*/
{
do_species = FALSE;
Pdf_Interpolation_Method_Linear = FALSE;
/* premix adiabatic flamelet */
if (PdfModel.premix_flamelet_ad )
{
int Pdf_Interp_Vars[MAX_PDF_VARS]={0}, Num_Pdf_Interp_Vars=0;
value = Interpolate_multi_table(fmean, fvar, cmean, cvar, h, ALL,
do_species, Num_Pdf_Interp_Vars,
Pdf_Interp_Vars);
}
if (value.temp > 1.0)
{
prop[TEMP_UDF] = value.temp;
prop[CP_UDF] = value.cp;
prop[DEN_UDF] = MAX(DEN_MIN,value.den);
prop[MOL_WT_MIX_UDF] = value.mol_wt ;
}
}
Pdf_Interpolation_Method_Linear = Pdf_Interpolation_Method_Linear_Save;
FREETP (value);
}
In the following example, the DEFINE_PDF_TABLE function is used to modify the default PDF table output for a non-adiabatic
single mixture fraction case. The use of the default ANSYS Fluent functions
to access the PDF table data is demonstrated. For this example the
modification applied is to limit the density value to the value DEN_MIN.
/*********************************************************************
Example UDF that demonstrates the use of DEFINE_PDF_TABLE to access and modify
the data of the default PDF table
**********************************************************************/
#include "udf.h"
#include "pdf_props.h"
#include "pdf_table.h"
#define DEN_MIN 1
DEFINE_PDF_TABLE(default_table,m,c,t,fmean,fvar,fmean2,fvar2, cmean, cvar, h,what,prop,x,s_pollut)
{
real y[MAX_PDF_SPECIES],fldim,h_adiab,hbar;
int hstate,limit=0,i;
Table_Point value;
int Pdf_Interp_Vars[MAX_PDF_VARS], Num_Pdf_Interp_Vars;
cxboolean do_species = TRUE ;
if(NULLP(pf))
Error("Please generte or read a Fluent PDF file first\n");
if(do_species)
Num_Pdf_Interp_Vars = 4 + n_spe_pdf;
else
Num_Pdf_Interp_Vars = 4 ; /*T,rho,Cp and MW*/
pdf_interp_vars_loop(i)
Pdf_Interp_Vars[i] = i;
fldim = Scaled_fvar (fmean, fvar);
h_adiab = Pdf_Adiabatic_Enthalpy (fmean);
get_hbar_hstate(h,h_adiab,fmean,pv->hbot_curve,pv->htop_curve,&hstate,&hbar,&limit);
value = Pdf_Interpolate_3D_Table(fmean, fldim, h, h_adiab, pf->nonadia1mf, do_species,
hstate, hbar, Num_Pdf_Interp_Vars, Pdf_Interp_Vars, &limit);
prop[TEMP_UDF] = value.temp;
prop[CP_UDF] = value.cp;
prop[DEN_UDF]= MAX(DEN_MIN,value.den);
prop[MOL_WT_MIX_UDF]= value.mol_wt;
if(do_species)
spe_loop(i,n_spe_pdf)
x[i] = value.xmol[i];
}
After you have enabled the Non-Premixed or Partially-Premixed models, generated or
read a valid PDF table, and compiled (Compiling UDFs) the DEFINE_PDF_TABLE UDF, the name of the argument that you supplied as the first DEFINE macro argument will become visible and selectable
in the User-Defined Function Hooks dialog box
in ANSYS Fluent. See Hooking DEFINE_PDF_TABLE UDFs for details.