![](https://csdnimg.cn/release/download_crawler_static/10934233/bg3.jpg)
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