Property Macro, UDF, Viscosity Relation CFD Simulation

$100.00 Student Discount

  • The problem numerically simulates the water viscosity exchange based on temperature 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 133,400.
  • We use the User-Defined Function (UDF) to define a viscosity relation.
  • We use the Property 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 Property Macro to write UDF programming.

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

We considered a simple pipe with water fluid flowing inside. The water flow enters the pipe at a low speed and is affected by the thermal boundary condition of the pipe wall.

Water enters the pipe with a temperature of 280 K, and the wall has a constant temperature of 300 K. So the temperature of the water flow inside the pipe changes. Usually, an increase in temperature in fluids causes a decrease in viscosity. So, we must define a relation according to which the viscosity varies with temperature. For this purpose, we use a function describing the viscosity regarding temperature.

We simulated the current model based on the CFD method by ANSYS Fluent software, modeling the geometry in 3D with Design Modeler software.134,400 Structured cells are created by ANSYS Meshing software

Methodology (UDF)

In this project, we need to define a function of viscosity variations in terms of temperature. Since the water viscosity value inside the pipe is not constant, we need to define a User-Defined Function (UDF) to define the viscosity relations. We must use the Property Macro (DEFINE_PROPERTY macro) for this UDF. The Property Macro has many applications in simulations. This macro defines the value of material properties like density, thermal conductivity, viscosity, etc., in terms of some variables.

 The viscosity relations we use are defined as follows. According to these relations, viscosity is considered in three different temperature ranges. If the temperature is less than 285 K, the viscosity equals a constant value of 0.001 kg/m.s. If the temperature exceeds 290 K, the viscosity equals a constant value of 0.0015 0.0015 kg/m.s.But if the temperature is between 285 and 290 K, the following equation must be used to define the viscosity value in terms of temperature.

Property Macro

Conclusion (UDF)

After completing the calculation, we will review the results. To analyze the results, we obtain some contours and some plots. We obtain the dynamic viscosity contour at several passing planes of the model domain. Then, we obtained the plot of dynamic viscosity changes in terms of the temperature at a central plane of the model domain.

The results correctly showed that the changes in viscosity correspond to temperature. The temperature was higher near the pipe walls, and the viscosity decreased. While in the central parts of the pipe, the temperature was lower, and then the viscosity increased.

We conclude that we performed the current numerical simulation correctly, and our UDF worked correctly.


  1. Avatar Of Letha Bashirian Iv

    Letha Bashirian IV

    I was wondering if you could explain a bit more about how exactly the viscosity changes are implemented within the UDF framework. Is there a specific way the conditions are checked within the UDF to assign the right viscosity values based on temperature ranges?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      The viscosity changes are implemented with conditions programmed into the UDF. Checks within the UDF evaluate the local temperature values and apply a predefined equation or value depending on the temperature range. For temperatures below 285 K, a constant viscosity of 0.001 kg/m.s is used, for temperatures above 290 K, it’s 0.0015 kg/m.s, and for temperatures within 285-290 K, an equation is used to define the viscosity linearly dependent on temperature. These conditions ensure that the simulation dynamically updates viscosity based on the fluid temperature at each location within the flow domain.

  2. Avatar Of Yoshiko O'Connell

    Yoshiko O’Connell

    I’m trying to recreate the UDF for viscosity variations based on temperature. Could you provide a sample code snippet or the specific steps that were taken in defining this in ANSYS FLUENT?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      Due to the scope of this platform, I cannot provide an actual code snippet, but generally, to create the UDF, you would start by defining a new function with the DEFINE_PROPERTY macro. Inside this function, you’d establish the temperature conditions. For instance, you’d utilize an ‘if-else’ statement to check the current cell temperature; if it’s below 285 K, you’d return 0.001 kg/m.s as the viscosity; if it’s above 290 K, you’d return 0.0015 kg/m.s; and if in between, you’d include the specific equation linking temperature to viscosity. You’d have to implement it in C programming syntax and compile your UDF in ANSYS Fluent.

  3. Avatar Of Prof. Reba Larkin Md

    Prof. Reba Larkin MD

    The UDF In this project encompasses different viscosity values at variable temperatures. Is it possible to include more customized relations like this for properties other than viscosity?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      Absolutely, the UDF programming in ANSYS Fluent is versatile and you can use the DEFINE_PROPERTY macro not just for viscosity, but to define various temperature-dependent properties such as density, thermal conductivity, specific heat, etc. You can also employ other macros to customize boundary conditions or source terms based on the needs of your specific simulation.

  4. Avatar Of Dr. Louisa Gorczany Iv

    Dr. Louisa Gorczany IV

    I’m glad your UDF function correctly captured the temperature-dependent viscosity changes. It sounds like a critical aspect for mimicking realistic fluid flow behavior in the pipe given the thermal boundary conditions.

    • Avatar Of Mr Cfd Support

      MR CFD Support

      Thank you for your positive feedback about the UDF and viscosity relation CFD simulation tutorial. We are delighted to hear the tutorial met your expectations and provided a clear understanding of how to implement temperature-dependent viscosity changes in fluid simulations. Your satisfaction is our top priority, and we’re here to assist you with any further learning experiences.

  5. Avatar Of Dr. Loraine Marvin Dds

    Dr. Loraine Marvin DDS

    This UDF Course feels quite comprehensive. Just to clarify, does the training cover how to write the code for the Property Macro in C, or is it done in an edit-free environment?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      Yes, the UDF training covers how to write the code for the Property Macro using the C programming language. It shows you how to create the macro in the ANSYS Fluent environment, providing a hands-on experience in defining material properties like viscosity in relation to temperature changes.

  6. Avatar Of Julia Trantow Md

    Julia Trantow MD

    I just finished the ‘Property Macro, UDF, Viscosity Relation CFD Simulation’ and found the materials really enlightening. The relation set in UDF for viscosity with respect to temperature drastically influenced the fluid characteristics along the pipe. The results visualizations clarified the theoretical aspects beautifully!

    • Avatar Of Mr Cfd Support

      MR CFD Support

      We’re thrilled to hear that our ‘Property Macro, UDF, Viscosity Relation CFD Simulation’ was able to provide you with clarity and a comprehensive understanding of how fluid viscosity is affected by temperature changes. We are continuously striving to create materials that are not only informative but also facilitate a deeper grasp of key concepts through practical visualization. Thank you for your positive feedback!

  7. Avatar Of Hal Collier

    Hal Collier

    I am extremely pleased with how effectively the UDF captured the viscosity changes based on temperature variations in the simulation! Does this mean I can apply the same approach using UDF for other fluid properties like density and thermal conductivity adjusted for temperature?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      Yes, the method showcased in this project illustrates the flexibility and power of UDF in ANSYS Fluent. Just as we can define temperature-dependent viscosity relations using UDFs, we can certainly apply the same approach to modify other fluid properties like density and thermal conductivity based on temperature or other relevant variables.

  8. Avatar Of Gianni Lowe Jr.

    Gianni Lowe Jr.

    The UDF application in adjusting viscosity in relation to temperature seems crucial for the accuracy of the simulation. Was implementing UDF for this scenario challenging?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      Implementing the User-Defined Function (UDF) to adjust viscosity in relation to temperature does require proficiency with both fluid dynamics and ANSYS Fluent’s programming capabilities. However, with the comprehensive UDF Training Course provided, users can follow a detailed guide on writing Property Macro (DEFINE_PROPERTY macro) which greatly eases the process.

  9. Avatar Of Kayleigh Goldner Dvm

    Kayleigh Goldner DVM

    I appreciate the comprehensive description of how the UDF and Property Macro are used to define viscosity variations in response to the thermal conditions. It’s interesting to see the complex relationships between temperature and fluid properties being integrated into the CFD analysis.

    • Avatar Of Mr Cfd Support

      MR CFD Support

      Thank you for your kind words! We always strive to provide detailed and informative content that can help our users understand the intricacies of applying advanced CFD techniques, such as UDF and Property Macro, to simulate fluid behaviors accurately. We’re glad that you found the materials thorough and interesting, and we hope it has enriched your knowledge in the field of computational fluid dynamics.

  10. Avatar Of Prof. Anita Goodwin Dvm

    Prof. Anita Goodwin DVM

    What exactly is the equation used when the temperature is between 285 and 290 K in the UDF? Great work, by the way!

    • Avatar Of Mr Cfd Support

      MR CFD Support

      If the temperature is between 285 and 290 K, the UDF uses a temperature-dependent equation to calculate the viscosity. Unfortunately, the exact functional form of this equation is not provided in your input data, so I cannot specify the exact formula used in this case. But generally, this sort of equation links the temperature linearly or through a polynomial to viscosity values. Thank you for your appreciation of the work!

  11. Avatar Of Mrs. Stephanie Feil Iv

    Mrs. Stephanie Feil IV

    What exactly does the Property Macro do in terms of UDF, and can you explain how it interacted with the viscosity relationship in this simulation?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      The Property Macro in UDF allows for the customization of physical properties, like viscosity, based on certain variables – in this case, temperature. In this simulation, the Property Macro was used to program a change in viscosity in response to temperature changes within the fluid flow. This interaction was crucial to accurately model viscosity behavior in various temperature ranges, ensuring the UDF drove the viscosity adjustments exactly as intended.

  12. Avatar Of Irwin Goldner

    Irwin Goldner

    How did you accommodate the varying viscosity in regions where the temperature ranges between 285 K and 290 K?

    • Avatar Of Mr Cfd Support

      MR CFD Support

      In regions where the temperature ranges between 285 K and 290 K, a specific equation is used within the User-Defined Function (UDF) to define the viscosity variation as a function of temperature. The UDF is programmed to adjust viscosity according to the calculated temperature in that range dynamically.

Leave a customer review

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

Back To Top
Whatsapp Call On WhatsApp