The Ansys Innovation Space website recently experienced a database corruption issue. While service has been restored there appears to have been some data loss from November 13. We are still investigating and apologize for any issues our users may have as a result.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

UDF Ideal Gas Law for Density

    • Avedistchamitchian
      Subscriber

      My current goal is for the sake of practicing “UDF Define properties”, is to mimic Fluent ideal gas law by writing my own ideal gas UDF and comparing it with fluent Ideal gas version.

      For the UDF and non-UDF ideal gas, the energy equation is on. I am using the same Mesh, case model, and boundary condition for both! (inlet velocity=50m/s, k-e Standart Model, I am using CO2 as a gas, pressure based) The only difference is how the density and speed of sound are defined for the 1st case I choose the ideal gas for density which is provided from Fluent there (in the Material property window) you don't need to define the speed of sound.

      For my 2nd case, I wrote my own ideal gas equation and ideal gas speed of sound calculation which are set in fluent for the density and speed of sound (UDF) in the same material property window. (you need to compile the code....)

      Now we should expect to get similar results for both simulations right! But not so fast! Please check the unexpected results I had below!

      My 2d tunnel has a circle inside ( so we have a flow over a sphere in 2D), at stagnation I expect the static temperature to increase which was true for Fluent ideal gas but not my UDF ideal gas, my cell temperature contour I should expect to get similar results which wasn’t the case for the temperature. (static and Total). Specifically, the static temperature remained constant everywhere unlike the fluent version which varies which is the right behavior/result.

      So why is this happening?? is the energy equation not computed? although it is on?

      I am pretty sure that my ideal gas written UDF equation is right since I monitored the numbers of T and P and got the same answer with my calculator. For me at first sight it looks like the energy equation is not computed?

      I expet Fluent is caling my Defined properties after he solves the momentum, energy, transport equation, like the below skematic table that I retrieved from the UDF manual of Fluent.

    • Rob
      Forum Moderator
    • Avedistchamitchian
      Subscriber
      Hi Mr.Rob, I have read this page but am not sure if it answers my above issue. I have usedDEFINE_PROPERTYto define my own density with the ideal gas equation but yet got different results when comparing Fluent ideal gas results.

    • Rob
      Forum Moderator
      The key part is the "temperature dependent". Using pressure messes with the core numerics so is restricted to the pre-set options.
    • Avedistchamitchian
      Subscriber
      They write the following in the manual.
      density (as a function of temperature)
      But it wasn't clear enough for me that writing it a function of pressure is not possible.
      So by your reply, I can disclose this topic that writing my own ideal gas is not possible and that is a sort of a limitation? (since i need to use the pressure of a cell)
      Is there a way to bypass this issue or its embedded?
      Thank you Mr.Rob for this comment!
      Best!
    • Rob
      Forum Moderator
      It's a limitation, so you're a little stuck. There are user defined routines for real gases so you may be able to work around it that way. What are you trying to do?
    • Avedistchamitchian
      Subscriber
      Hi Mr.Rob Yes, I see what you mean, it was for me actually experimenting with UDF especially with Define Properties.
      Maybe implementing my own real gas model or Soave-Redlich-Kwong Equation of State later on...
      I found another way to do this, which is by defining the principle set of functions by which my thermodynamic property data including the returned density are transferred to the ANSYS Fluentsolver.

      I was too optimistic with DEFINE_PROPERTY macro. Greatfull for your previous answer it at least made me realize the limitation of DEFINE_PROPERTY.
      Greetings from Munich!
      Avedis

    • sanjay22bharani
      Subscriber

      Greetings,

      I have been trying to define the ideal gas equation using UDF similar to your case and I find that I face a similar issue. Could you please share the other way which you have mentioned?

      Thank you in advance

    • Rob
      Forum Moderator

      You need to decide if you need to use a UDF for a real gas; otherwise if you want a function of pressure you need to review the Real Gas models. I would think very carefully before deciding to do that. 

Viewing 8 reply threads
  • The topic ‘UDF Ideal Gas Law for Density’ is closed to new replies.