fluent UDF第四章 DEFINE宏(3)

2019-08-02 00:21

center of motion grid motion gravity DEFINE_CG_MOTION Dynamic Zones DEFINE_GRID_MOTION Dynamic Zones Dynamic Zones NOx Model Iterate geometry deformation DEFINE_GEOM NOx formation rate time step (for time dependent solutions)

DEFINE_NOX_RATE DEFINE_DELTAT ? ? ? ? ? ? ? ? ? ? ? ? ? ?

4.3.1 DEFINE_DELTAT

4.3.2 DEFINE_DIFFUSIVITY 4.3.3 DEFINE_HEAT_FLUX 4.3.4 DEFINE_NOX_RATE 4.3.5 DEFINE_PROFILE 4.3.6 DEFINE_PROPERTY

4.3.7 DEFINE_SCAT_PHASE_FUNC 4.3.8 DEFINE_SOURCE 4.3.9 DEFINE_SR_RATE

4.3.10 DEFINE_TURB_PREMIX_SOURCE 4.3.11 DEFINE_TURBULENT_VISCOSITY 4.3.12 DEFINE_UDS_FLUX

4.3.13 DEFINE_UDS_UNSTEADY 4.3.14 DEFINE_VR_RATE

4.3.1 DEFINE_DELTAT 功能和使用方法的介绍

你可以使用DEFINE_DELTAT宏来控制时间相关问题解的时间步长。This macro can only be used if the adaptive time-stepping method option has been activated in the Iterate panel in FLUENT.

Macro: DEFINE_DELTAT ( name, domain) Argument types: Domain *domain Function returns: real

There are two arguments to DEFINE_DELTAT: name and domain. name is the name of the UDF, specified by you. 当你的UDF编译和连接时,你为函数所选择的名字会在FLUENT图形用户界面中变得可见,且可

被选择。 domain is passed by the FLUENT solver to your UDF. Your UDF will need to return the real value of the physical time step to the solver. 例子:

下面的UDF名字为mydeltat, is a simple function that shows how you can use DEFINE_DELTAT to change the value of the time step in a simulation. First, RP_Get_Real is used to get the value of the current simulation time ( flow_time). Then, for the first 0.5 seconds of the calculation, a time step of 0.1 is set. A time step of 0.2 is set for the remainder of the simulation. The time step variable is then returned to the solver. See Section 6.9 for details on RP_Get_Real.

/***********************************************************************/ /* UDF that changes the time step value for a time-dependent solution */

/***********************************************************************/ #include \

DEFINE_DELTAT(mydeltat, domain) {

real time_step;

real flow_time = RP_Get_Real(\ if (flow_time < 0.5) time_step = 0.1; else

time_step = 0.2; return time_step; }

Activating an Adaptive Time Step UDF in FLUENT

Once you have compiled and linked the source code for an adaptive time step UDF, you can activate it in the Iterate panel in FLUENT. See Section 8.2.8 for more details. 4.3.2 DEFINE_DIFFUSIVITY 功能和使用方法的介绍

你可以使用DEFINE_DIFFUSIVITY macro to specify the diffusivity for the species transport equations or user-defined scalar (UDS) transport equations.

Macro: DEFINE_DIFFUSIVITY ( name, c, t, i) Argument types: cell_t c Thread *t int i Function returns: real

There are four arguments to DEFINE_DIFFUSIVITY: name, c, and t, and i. name is the name of the UDF, specified by you. 当你的UDF编译和连接时,你为函数所选择的名字会在FLUENT图形用户界面中变得可见,且可被选择。 c, t, and i are variables that are passed by the FLUENT solver to your UDF.

c is an index that identifies a cell within the given thread. t is a pointer to the thread on which the diffusivity function is to be applied. i is an index that identifies the species or user-defined scalar. Your UDF will need to return the real value of diffusivity to the solver.

Note that diffusivity UDFs (defined using DEFINE_DIFFUSIVITY) are called by FLUENT from within a loop on cell threads. Consequently, your UDF will not need to loop over cells in a thread since FLUENT is doing it outside of the function call. Your UDF will be required to compute the diffusivity only for a single cell and return the real value to the solver. 例子:

下面的UDF名字为mean_age_diff, computes the diffusivity for the mean age of air using a user-defined scalar. Note that the mean age of air calculations do not require that energy, radiation, or species transport calculations have been performed. You will need to set uds-0 = 0.0 at all inlets and outlets in your model. This function can be executed as an interpreted or compiled UDF.

/**********************************************************************/ /* UDF that computes diffusivity for mean age using a user-defined */

/* scalar. */ /**********************************************************************/

#include \

DEFINE_DIFFUSIVITY(mean_age_diff, c, t, i) {

return C_R(c,t) * 2.88e-05 + C_MU_EFF(c,t) / 0.7; }

Activating a Diffusivity UDF in FLUENT

Once you have compiled and linked your diffusivity UDF, you can activate it by selecting it as the mass or UDS diffusivity in the Materials panel in FLUENT. See Section 8.2.4 for more details. 4.3.3 DEFINE_HEAT_FLUX 功能和使用方法的介绍

In spite of its name, the DEFINE_HEAT_FLUX macro is not to be used to explicitly set the heat flux along a wall. FLUENT computes the heat flux along a wall based on currently selected models to account for the diffusive and radiative energy fluxes (if any). You must only use a DEFINE_HEAT_FLUX UDF when you want to employ some other heat transfer mechanism that is not currently being modeled. The total heat flux at the wall will be the sum of the currently computed heat flux (based on the activated models) and the heat flux defined by the UDF.

Macro: DEFINE_HEAT_FLUX ( name, f, t, c0, t0, cid, cir) Argument types: face_t f Thread *t cell_t c0 Thread *t0 real cid[] real cir[] Function returns: void

There are seven arguments to DEFINE_HEAT_FLUX: name, f, t, c0, t0, cid, and cir. name is the name of the UDF, specified by you. 当你的UDF编译和连接时,你为函数所选择的名字会在FLUENT图形用户界面中变得可见,且可被选择。 f, t, c0, t0, cir[], and cid[] are variables that are passed by the FLUENT solver to your UDF.

f is an index that identifies a wall face within the given thread. t is a pointer to the thread on which the heat flux function is to be applied. c0 is an index that identifies the cell next to the wall, and t0 is a pointer to the adjacent cell's thread.

cid[] and cir[] are real arrays that need to be computed by your UDF. Array cid[] stores the fluid-side diffusive heat transfer coefficients, while array cir[] stores radiative heat transfer coefficients. With these inputs provided to the function, the diffusive heat flux ( qid) and radiative heat flux ( qir) are computed by FLUENT according to the following equations:

qid = cid[0] + cid[1]*C_T(c0,t0) - cid[2]*F_T(f,t) - cid[3]*pow(F_T(f,t),4) qir = cir[0] + cir[1]*C_T(c0,t0) - cir[2]*F_T(f,t) - cir[3]*pow(F_T(f,t),4)

The sum of qid and qir defines the total heat flux from the fluid to the wall (this direction being positive flux), and, from an energy balance at the wall, equals the heat flux of the surroundings (exterior to the domain). Note that heat flux UDFs (defined using DEFINE_HEAT_FLUX) are called by FLUENT from within a loop over wall faces.

!! In order for the solver to compute C_T and F_T, the values you supply to cid[1] and cid[2] should never be zero. 例子:

Section 10.5.2 provides an 例子: of the P-1 radiation model implementation through a user-defined scalar. An 例子: of the usage of the DEFINE_HEAT_FLUX macro is included in that implementation. Activating a Heat Flux UDF in FLUENT

Once you have compiled and linked your heat flux UDF, you can activate it by selecting it in the User-Defined Function Hooks panel in FLUENT. See Section 8.2.2 for more details. 4.3.4 DEFINE_NOX_RATE

功能和使用方法的介绍

你可以使用DEFINE_NOX_RATE macro to calculate NOx production and reduction rates in FLUENT. The UDF rate that you specify is independent of the standard NOx model options. You can deselect the standard NOx options in your simulation, and choose the UDF rate instead.

Macro: DEFINE_NOX_RATE ( name, c, t, NOx) Argument types: cell_t c Thread *t NOx_Parameter *NOx Function returns: void

There are four arguments to DEFINE_NOX_RATE: name, c, t, and NOx. name is the name of the UDF, specified by you. 当你的UDF编译和连接时,你为函数所选择的名字会在FLUENT图形用户界面中变得可见,且可被选择。 c, t, and NOx are variables that are passed by the FLUENT solver to your UDF. c is an index that identifies a cell within the given thread. t is a pointer to the thread on which the NOx rate is to be applied. NOx is a pointer to the NOx structure. A DEFINE_NOX_RATE function does not return a value. The calculated NOx rates are returned through the NOx structure.

Note that, although the data structure is called NOx, the DEFINE_NOX_RATE macro can be used to calculate the rates of any of the pollutant species (i.e., NO, HCN, and NH 3), depending on which of the pollutant species equations is being solved. 例子:

下面编译的UDF名字为user_nox, computes NOx production and reduction rates based on the forward and reverse rates of NO defined as

(4.3.1)

and

(4.3.2)

where the rate coefficients, which have units of m 3/mol-s, are defined as k 1

=

(4.3.3)


fluent UDF第四章 DEFINE宏(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:OMT中使用的缩略词

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: