Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Changing viscous and inertial resistance coefficients UDF

    • Max4
      Subscriber

      Hi everyone,


      I want to change the viscous and inertial resistance coefficients in a porous zone (Cell Zone) as function of time using an UDF.



      In the manuel, I found this UDF to define a viscous resistance profile in a porous zone.




      I want to define the coefficients in each direction and as function of time. How can I define this parameters in the UDF?


      Have anyone any UDF-Code to change the coefficients as function of time?


       


      Regards,


      Maxime

    • Rob
      Forum Moderator

      You've found the DEFINE_PROFILE example, now look in the UDF Manual for a time dependent UDF and combine the two. As a hint, the macro for the current solution time is    RP_Get_Real("flow-time")

    • Max4
      Subscriber

      Thank you for your answer.


      In this UDF, there is just one parameter "a". How do I know what this term means? In addition, this function induces an isotropic porous media.


      By a 2D-Case for exemple, there can be up to 4 different terms.



      Should I juste use "F_PROFILE(c, t, i)" to define the parameter?


      I want to modell the closing of a valve using a porous media like the exemple below.



       

    • Amine Ben Hadj Ali
      Ansys Employee

      You can use the same udf for each field. Any you need it at cell level that is why C_PROFILE. In a testing DEFINE_PROFILE Just print "i" to know which integer will be reported and based on that you can then create a single dEFINE_PROFILE for each hook at "i" position.

    • Max4
      Subscriber

      Thank you for your reply.


      Sorry but I don´t understand what you mean. How can I define in a UDF each of the 4 coefficients?


      Moreoever, I don´t understand why a DEFINE_PROFILE is needed for this kind of UDF.


       


      Maxime

    • Amine Ben Hadj Ali
      Ansys Employee
      In define profile call there the integer "i". This will get a value based on the fueld you want to hook the macro. Saying That if you print for a test that integer you can then easily know the values of all places it fields.

      Why DEFINE PROFILE: Why not?
    • Max4
      Subscriber

      Hi,


      I have then to use this UDF and change the "User Input" with the value of the coefficient?



      For each coefficients I have to create an UDF with the value of the coefficient?



      Regards,


      Maxime


       

    • Max4
      Subscriber

      Hi,


      By using a multiphase flow, we can just change the value of the Porosity:



      May I use the same UDF with DEFINE_PROFILE that utilises C_PROFILE?


      Regards,


      Maxime

    • Amine Ben Hadj Ali
      Ansys Employee
      Yes. The losses to be provided phasewise.

      Regarding the "i" in the macro it just tell Fluent on which "i" place it has been used. You can incorporate this in smart if statement.
      That were my last hints here.
    • Rob
      Forum Moderator

      Porosity in the last post is the amount of "solid" in the fluid region. It's used for heat transfer and is not related to the resistance coefficients. 


      If you need the porosity to vary in each direction, then yes you'll need a section of UDF for each direction. The "porosity_function" is the label for that profile, just repeat the whole DEFINE_PROFILE part (with a different name) for each value you need/want. 


      You can use a C_PROFILE but I don't think you need it as the whole porous region changes at the same rate (based on what you've said so far). 

    • Max4
      Subscriber

      Thank you for your reply and informations.


      If I have a multiphase flow, I have then to write a DEFINE_SOURCE UDF (Source Terms) in order to have porosity in any region?


       


      For a single phase flow, I can use the UDF following UDF.



      The parameter "a" in the UDF defines for exemple the viscous resistance in the direction-1 if I hook the UDF as follow.



      It´s better to use then F_PROFILE instead of C_PROFILE ?


      Regards,


      Maxime

    • Amine Ben Hadj Ali
      Ansys Employee

      In multiphase you provide the inertial coefficient and inverse permeability for each phase. You can use the profile macro there.

    • Max4
      Subscriber

      Thank you for your answer.


      If I doesn´t study heat transfer, should I set the porosity of the mixture of 1 (full open) or 0 ?



      Regards,


      Maxime

    • Amine Ben Hadj Ali
      Ansys Employee

      To avoid any later issues please use the right porosity. Also consider that the transient term does contain the porosity. I guess now all questions are answered and it would be kind of you if you set this as "Is Solved".

    • Max4
      Subscriber

      Hi,


      With multiphase flow, I can just select "porous zone" for the mixture and not the each phase. For the simulaton, I want to provide the inertial coefficient and inverse permeability for each phase




       

    • Amine Ben Hadj Ali
      Ansys Employee

      It has to show off. Which version are u using and which models are activated?

    • Max4
      Subscriber

      Hi,


      I´m using Fluent 19.2. As turbulence modell I´m using the Reliazable k epsilon modell with the Scalable Wall Functions.


      I am using the Mixture Multiphase Flow with the Schnerr and Sauer Model.



      Regards,


      Maxime

    • Amine Ben Hadj Ali
      Ansys Employee

      Yes you should be able to access them phase-wise. Start from a dummy case and verify it please.

    • Max4
      Subscriber

      I have read a mesh file and set the following parameter:


      - Realizable k-epsilon Model


      - Energy Equation ON


      - Mutliphase -> Mixture -> Schnerr and Sauer


      I have then define the both phases (water liquid and water vapor) and the interactions. By defining the phases, I have seen the parameter "Diameter". What is this parameter?



      The definition of "porous zone" is always grayed out for each phase.


      Regards,


      Maxime


       


       

    • Rob
      Forum Moderator

      Turn on the Porous Media under Mixture, and then go to each Phase to set the coefficients. It's intended to stop you setting a model where only one phase sees a porous zone. 

    • Max4
      Subscriber

      Thank your for the answer.


      Regards,


      Maxime

Viewing 20 reply threads
  • The topic ‘Changing viscous and inertial resistance coefficients UDF’ is closed to new replies.