?
NOX_RRATE(NOx) is used to return the reduction rate of the pollutant species being solved.
Activating a NOx Rate UDF in FLUENT
Once you have compiled and linked your NOx rate UDF, you can activate it by selecting it in the NOx Model panel in FLUENT. See Section 8.2.3 for more details. 4.3.5 DEFINE_PROFILE 功能和使用方法的介绍
你可以使用DEFINE_PROFILE macro to define a custom boundary profile that varies as a function of spatial coordinates or time. Some of the variables you can customize at a boundary are
? ? ? ? ?
velocity, pressure, temperature, turbulent kinetic energy, turbulent dissipation rate
volume fraction (multiphase)
species mass fraction (species transport) wall thermal conditions wall stress conditions
Macro: DEFINE_PROFILE ( name, t, i) Argument types: Thread *t
There are three arguments to DEFINE_PROFILE: name, t, and i. name is the name of the UDF, specified by you. 当你的UDF编译和连接时,你为函数所选择的名字会在FLUENT图形用户界面中变得可见,且可被选择。 t and i are variables that are passed by the FLUENT solver to your UDF.
t is a pointer to the thread on which the boundary condition is to be applied. i is an index that identifies the variable that is to be defined. i is set when you associate (hook) the UDF with a variable in a boundary condition panel through the graphical user interface. This index is subsequently passed to your UDF by the FLUENT solver, so that your function knows which variable to operate on.
int i Function returns: void While DEFINE_PROFILE is usually used to specify a profile condition on a boundary face zone, it can also be used to specify, or fix, flow variables that are held constant during computation in a cell zone. See Section 6.26 of the User's Guide for more information on fixing values in a cell zone boundary condition. The arguments of the macro will change accordingly. There are three arguments to DEFINE_PROFILE for a cell zone: name, thread, and np. name is the name of the UDF, specified by you. thread and np are variables that are passed by the FLUENT solver to your UDF.
Note that unlike source term and property UDFs, profile UDFs (defined using DEFINE_PROFILE) are not called by FLUENT from within a loop on threads in the boundary zone. The solver only passes the DEFINE_PROFILE macro the pointer to the thread associated with the boundary zone. Your UDF will need to do the work of looping over all of the faces in the thread, compute the face value for the boundary variable, and then store the value in memory. Fluent has provided you with a face looping macro to loop over all faces in a thread ( begin_f_loop...). See Chapter 6 for details about face looping macro utilities.
F_PROFILE is typically used along with DEFINE_PROFILE, and is a predefined macro provided by Fluent. F_PROFILE stores a boundary condition in memory for a given face and index and is nested within the face loop in the 例子:s below. It is important to note that the index i that is an argument to DEFINE_PROFILE is the same argument to F_PROFILE. F_PROFILE uses the thread pointer t, face identifier f, and index i to set the appropriate boundary face value in memory. See Section 6.4 for a description of F_PROFILE. 例子: 1
下面的UDF名字为pressure_profile, generates a parabolic pressure profile according to the equation
Note that this UDF assumes that the grid is generated such that the origin is at the geometric center of the boundary zone to which the UDF is to be applied. y is 0.0 at the center of the inlet and extends to at the top and bottom of the inlet. This function can be executed as an interpreted or compiled UDF in FLUENT. /***********************************************************************/
/* UDF for specifying steady-state parabolic pressure profile boundary */
/* profile for a turbine vane */ /***********************************************************************/
#include \
DEFINE_PROFILE(pressure_profile, t, i) {
real x[ND_ND]; /* this will hold the position vector */ real y; face_t f;
begin_f_loop(f, t) {
F_CENTROID(x,f,t); y = x[1];
F_PROFILE(f, t, i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5; }
end_f_loop(f, t) }
The function named pressure_profile has two arguments: t and i. t is a pointer to the face's thread, and i is an integer that is a numerical label for the variable being set within each loop.
Within the function body, variable f is declared as a face. A one-dimensional array x and variable y are declared as real data types. Following the variable declarations, a looping macro is used to loop over each face in the zone to create a profile, or an array of data. Within each loop, F_CENTROID returns the value of the face centroid (array x) for the face with index f that is on the thread pointed to by t. The y coordinate stored in x[1] is assigned to variable y, and is then used to calculate the pressure. This value is then assigned to F_PROFILE, which uses the integer i (passed to it by the solver, based on your selection of the UDF as the boundary condition for pressure in the Pressure Inlet panel) to set the pressure face value in memory. 例子: 2
在下面的例子中,:, DEFINE_PROFILE is used to generate profiles for the x velocity, turbulent kinetic energy, and dissipation rate, respectively, for a 2D fully-developed duct flow. Three separate UDFs named x_velocity, k_profile, and dissip_profile are defined. These functions are concatenated in a single C source file which can be executed as interpreted or compiled in FLUENT. The 1/7th power law is used to specify the x velocity component:
A fully-developed profile occurs when is one-half the duct height. In this 例子:, the mean x velocity is prescribed and the peak (free-stream) velocity is determined by averaging across the channel.
The turbulent kinetic energy is assumed to vary linearly from a near-wall value of
to a free-stream value of
The dissipation rate is given by
where the mixing length is the minimum of Karman constant = 0.41.)
The friction velocity and wall shear take the forms
and 0.085 . ( is the von
The friction factor is estimated from the Blasius equation:
/**********************************************************************/
/* Concatenated UDFs for fully-developed turbulent inlet profiles */
/**********************************************************************/
#include \
#define YMIN 0.0 /* constants */ #define YMAX 0.4064 #define UMEAN 1.0 #define B 1./7.
#define DELOVRH 0.5 #define VISC 1.7894e-05 #define CMU 0.09 #define VKC 0.41
/* profile for x-velocity */
DEFINE_PROFILE(x_velocity, t, i) {
real y, del, h, x[ND_ND], ufree; /* variable declarations */ face_t f;
h = YMAX - YMIN; del = DELOVRH*h; ufree = UMEAN*(B+1.);
begin_f_loop(f, t) {
F_CENTROID(x,f,t); y = x[1];
if (y <= del)
F_PROFILE(f,t,i) = ufree*pow(y/del,B); else
F_PROFILE(f,t,i) = ufree*pow((h-y)/del,B);