77范文网 - 专业文章范例文档资料分享平台

FLUENT udf中文资料ch4(5)

来源:网络收集 时间:2019-04-17 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

?

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);

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库FLUENT udf中文资料ch4(5)在线全文阅读。

FLUENT udf中文资料ch4(5).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/607046.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: