Source Macro, UDF, Momentum Source Term CFD Simulation

$100.00 Student Discount

  • The problem numerically simulates the porous medium with momentum source term using ANSYS Fluent software.
  • We design the 3-D model with the Design Modeler software.
  • We mesh the model with ANSYS Meshing software.
  • The mesh is Structured, and the element number equals 256,000.
  • We use the User-Defined Function (UDF) to define a pressure profile.
  • We use the Source Macro for UDF.
Click on Add To Cart and obtain the Geometry file, Mesh file, and a Comprehensive ANSYS Fluent Training Video.

To Order Your Project or benefit from a CFD consultation, contact our experts via email ([email protected]), online support tab, or WhatsApp at +44 7443 197273.

There are some Free Products to check our service quality.
If you want the training video in another language instead of English, ask it via [email protected] after you buy the product.

Special Offers For Single Product

If you need the Geometry designing and Mesh generation training video for one product, you can choose this option.
If you need expert consultation through the training video, this option gives you 1-hour technical support.
The journal file in ANSYS Fluent is used to record and automate simulations for repeatability and batch processing.
editable geometry and mesh allows users to create and modify geometry and mesh to define the computational domain for simulations.
The case and data files in ANSYS Fluent store the simulation setup and results, respectively, for analysis and post-processing.
Geometry, Mesh, and CFD Simulation methodologygy explanation, result analysis and conclusion
The MR CFD certification can be a valuable addition to a student resume, and passing the interactive test can demonstrate a strong understanding of CFD simulation principles and techniques related to this product.
Enhancing Your Project: Comprehensive Consultation and Optimization Services
Collaborative Development of a Conference Paper on Cutting-Edge Topics with MR CFD
Collaborative Publication Opportunity: Contribute to an ISI Article and Get Featured in Scopus and JCR-Indexed Journals
If you want training in any language other than English, we can provide you with a subtitled video in your language.



In this project, we performed a numerical simulation using ANSYS Fluent software’s User-Defined Function (UDF). For this CFD product, we used Source Macro to write UDF programming.

This product is the 5th chapter of the User-Defined Function (UDF) Training Course.

We considered a simple channel in which water flows. We assume a porous medium is in the middle of this channel.

A porous medium consists of voids in which the fluid passes through its empty spaces. This porous material can have significant effects on fluid behavior. One of the uses of porous media is to create a pressure drop in the flowing fluid. To apply the porous medium, we considered a separate zone in the interior space of the channel to define the porous medium for that zone.

Fluent software has a porous option; we can activate it for our modeling. However, we aim to use another method to define the porous medium. We know that during the solution process by Fluent, various equations, such as momentum equations, are solved. We want to influence the behavior of the fluid by defining a source term to the momentum equation as if there is a porous medium in the fluid flow path. First, we modeled the geometry in 3D with Design Modeler software. Then, we meshed the model with ANSYS Meshing software. Meshing is Structured, and 256,000 cells are created. Finally, we numerically simulated the current model based on the CFD method by ANSYS Fluent software.

Methodology (UDF)

In this project, we need to define a source term for the momentum equation in the z-direction. Since the direction of the fluid flow is along the z-axis, we use the source term for the momentum-z equation. Since this source term is added as an additional term to the solver’s momentum equation, we need to define a User-Defined Function (UDF) to define the source term.

We must use the Source Macro (DEFINE_SOURCE macro) for this UDF. The Source Macro has many applications in simulations. Source macro defines any source term in various equations, including momentum, energy, etc., which the Fluent solver solves.

The source term relation we use is defined as follows. According to this relation, the source term is defined by the velocity along the z-axis and the location (y-component). Also, when we define the term source macro, we must define the source term’s derivative to the transport equation’s dependent variable.

F 5

Conclusion (UDF)

After completing the calculation, we will review the results. To analyze the results, we obtain some contours and some plots. We obtained the pressure and pressure gradient contour in 2D and 3D and the plot of pressure changes in the longitudinal direction of the channel. The results correctly show that the pressure in the longitudinal direction of the channel, and precisely after passing through the zone for which we have defined the source term, has a significant decrease. We conclude that we performed the current numerical simulation and our UDF correctly.


  1. Avatar Of Haylie Armstrong

    Haylie Armstrong

    Is it necessary to have programming experience to use the Source Macro in ANSYS Fluent for applying momentum source terms, or is it user-friendly for beginners as well?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      Though it can be helpful to have some programming experience, ANSYS Fluent is designed with user-friendliness in mind. Beginners can benefit from training materials and documentation that guide through the process of using UDF’s and Source Macros to apply momentum source terms effectively.

  2. Avatar Of Alexie Stroman

    Alexie Stroman

    In the project description, you mention the Source Macro deals heavily in simulations, could you elaborate on that? How does it precisely affect the simulation, and is this approach more efficient compared s to the standard settings in Fluent for porous media?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      The Source Macro in ANSYS Fluent allows for specific source terms to be added to governing equations, modifying the behavior of the fluid based on user-defined criteria. This direct manipulation can model complex phenomena, like the resistance offered by a porous medium. Compared to standard settings, a UDF with Source Macro offers greater flexibility and the potential for more targeted adjustments. Efficiency can depend on the problem’s exact requirements – for detailed or atypical behaviors, UDFs can be more efficient in achieving the desired outcomes.

  3. Avatar Of Mabel Ryan Iii

    Mabel Ryan III

    Is it possible to adjust the intensity of the source term without changing the UDF code to save time when testing different levels of porous medium resistance?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      To adjust the intensity of the source term in ANSYS Fluent without changing the UDF’s actual code, you may use compiled UDFs and UI which can include user inputs. This way, the interaction through a GUI allows for changes in parameters without reprogramming the UDF. Alternatively, you will need to modify the UDF code itself with new parameters for different levels of porous medium resistance and recompile each time you wish to change this setting.

  4. Avatar Of Fleta Rice

    Fleta Rice

    In the UDF, do we need to manually input the velocity at each timestep, or is it automatically adjusted based on the solution at every step?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      When using a Source Macro in UDF, the velocity is not manually input at each timestep; rather, it is computed and adjusted automatically based on the flow solution at every timestep by the solver.

  5. Avatar Of Marilie Sipes

    Marilie Sipes

    What are the physical properties and conditions assumed for the water flow when simulating the porous medium?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      In the simulation involving the porous media using UDF, the water is assumed to follow the standard fluid properties under normal conditions. These properties typically include density, viscosity, and flow velocity, similar to the properties it would exhibit under ambient temperature and pressure.

  6. Avatar Of Florian Abernathy

    Florian Abernathy

    What specific applications can benefit from the UDF and porous media model showcased in this chapter?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      The UDF and porous media model showcased can benefit applications like filtration systems, porous flow reactors, heat exchangers, chemical catalytic beds, and groundwater flow simulation where the interaction within porous domains impacts the overall flow dynamics and pressure distribution.

Leave a customer review

Your email address will not be published. Required fields are marked *

Back To Top
Whatsapp Call On WhatsApp