没有合适的资源?快使用搜索试试~ 我知道了~
首页Fluent的UDF官方案例(含代码)
资源详情
资源评论
资源推荐
Advanced User Defined Function (UDF) Tutorials
1. Position Dependent Porous Media
2. Sinusoidal Wall Temperature Variation
3. Temperature Dependent Viscosity
4. UDFs for a User Defined Scalar
5. Modeling Uniform Fluidization in a Two Dimensional Fluidized Bed
6. Calculation of Flow Uniformity
7. Modeling the Effect of Sedimentation Concentration in a Secondary
Clarifier using a UDF
8. Using a UDF to Control the Dynamic Mesh of a Flexible Oscillating
Membrane
Position Dependent Porous Media
1. Introduction
The purpose of this tutorial is to illustrate the modeling of a position dependent porous plug in a two
dimensional channel flow with the help of a user-defined function (UDF).
This tutorial demonstrates how to do the following:
• Compile the UDF.
• Use UDF for specifying the source terms.
• Postprocess the resulting data.
2. Prerequisites
This tutorial is written with the assumption that you have completed Tutorial 1 from ANSYS Fluent Tu-
torial Guide, and that you are familiar with the ANSYS Fluent navigation pane and menu structure. Some
steps in the setup and solution procedure will not be shown explicitly.
For more details about user-defined functions (UDF) refer to the ANSYS Fluent UDF Manual.
3. Problem Description
The problem considered in this tutorial is shown schematically in Figure 1: Problem Schematic (p. 1)
Figure 1: Problem Schematic
1
Release 15.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
The domain is divided into two fluid zones. In the fluid-2 cell zone, an X-momentum source term is in-
cluded for each cell using UDF. This source term models the effect of a porous plug on the flow in the
X-direction and is given by:
where C = 100 is a model constant.
Equation source terms are added using the DEFINE_SOURCE macro.
The finite-volume solver of ANSYS Fluent expects the source term to be linearized according to the
following convention:
where the superscript * represents the value at the previous iteration. B (called dS[eqn]} in the UDF
macro) can be coded explicitly by using currently known value of φ, and the entire S is returned by
DEFINE_SOURCE. For the simple source of X-momentum equation in this problem,
For more details, examine the source code (porous plug.c) as shown in the Appendix (p. 9).
4. Preparation
1. Copy the files (porous_plug.msh.gz and porous_plug.c) to the working folder.
2. Use Fluent Launcher to start the 2D version of ANSYS Fluent.
3. Enable Double-Precision in the Options list.
4. Click the UDF Compiler tab and ensure that the Setup Compilation Environment for UDF is enabled.
Note
The path to the .bat fie which is required to compile the UDF will be displayed as soon
as you enable Setup Compilation Environment for UDF.
If the UDF Compiler tab does not appear in the Fluent Launcher dialog box by default,
click the Show More Options button to view the additional settings.
Release 15.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.2
Position Dependent Porous Media
5. Setup and Solution
5.1. Mesh
• Read the mesh file (porous_plug.msh.gz).
File → Read → Mesh...
Note
As the mesh file is read, ANSYS Fluent will report the progress in the console.
Figure 2: Mesh Display
5.2. General Settings
1. Retain the default solver settings.
General
2. Check the mesh.
General → Check
Note
ANSYS Fluent will perform various checks on the mesh and will report the progress in
the console. Ensure that the reported minimum volume is a positive number.
3
Release 15.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Setup and Solution
5.3. Models
• Select the k-epsilon turbulence model.
Models → Viscous → Edit...
Note
You will use the default fluid properties of air for this problem. Hence, you need not
make any changes to the material properties.
5.4. Compile the UDF
Note
The UDF can be compiled as well as interpreted. In this tutorial, use the compiled option.
Compile the UDF (porous plug.c).
Define → User-Defined → Functions → Compiled...
1. Click the Add... button in the Source Files section to open the Select File dialog.
2. Select the file porous_plug.c.
3. Click Build.
Note
A Warning dialog box will appear, warning you to make sure that the UDF source files
are in the same folder that contains the case and data files. Click OK to close the
Warning dialog box.
You can view the compilation history in the log file that is saved in your working folder.
4. Click Load to load the library.
Release 15.0 - © SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.4
Position Dependent Porous Media
剩余120页未读,继续阅读
zx2362
- 粉丝: 10
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1