Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

liquid fraction calculation using UDF

    • sumeet94
      Subscriber

      I want to calculate the liquid fraction for a specific domain using UDF at the end of each time step. So, I wrote a UDF, which is shown below.

      To confirm whether it is providing the correct result or not, I also display the liquid fraction value of this domain using Fluent report definition. But, the above UDF gives me a very high value in return as shown below. 

      Can anyone please suggest what is wrong with the UDF?

      Thank you 

    • Rob
      Forum Moderator

      If you sum the liquid fraction in each cell why would you get the volume fraction or volume of liquid in the domain? 

    • sumeet94
      Subscriber

      Previously, I was not summing the liquid fraction for each cell. However, the results show that the liquid fraction value equals 1, even when the whole domain doesn't change its phase. The result is shown below,

      That is why I summed the liquid fraction for each cell.

    • sumeet94
      Subscriber

      I calculated the liquid fraction value for the PCM domain as the volume-weighted average liquid fraction, and it seems as if the results obtained from the UDF are almost correct. However, there is a difference between the liquid fraction value obtained from UDF and the Fluent Report definition, as can be observed from the data shown below.

      Any idea why this difference is occurring? The modified UDF is given below.

       

    • Rob
      Forum Moderator

      If you want the total volume of liquid, why are you working out volume fraction * cell volume then summing it and dividing that by the zone volume? Think carefully what you're doing. 

    • sumeet94
      Subscriber

      I have used the volume-weighted average approach as provided in the Ansys Fluent theory guide, to find the liquid fraction value.

      Can you please give me a hint regarding how this value should be calculated?

    • Rob
      Forum Moderator

      Do you want the liquid fraction or liquid mass? Consider that Fluent will use the cell values, and not all cell volumes are equal. 

    • sumeet94
      Subscriber

      Sir, I want the value of the liquid fraction. 

    • Rob
      Forum Moderator

      Liquid fraction against domain volume total? Or against a specific zone? You may be better off finding the liquid volume (or mass) and calculating the fraction based on whatever volume you wish to define. 

Viewing 8 reply threads
  • You must be logged in to reply to this topic.