Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

UDF cell initialization using by material library and/or mixture

    • keunsoo2
      Subscriber

      Hello,


      I would like to cell initialization using UDF. I am trying to make a model for shock-tube.


      Geometry is 2D rectangular (1m * x cm). and I want to initialize the cell as the following


      -Left 30% (Driver section): 20bar, (30% N2 and 70% He)


      -Right 70% (Driven section):1 bar, 100% Air


       


      I looked over the UDF manual, but I am not sure how to set a mixture.


      The following is the UDF that I made.


      I used centroid and loop function to define pressure of each side of the cell.


       


      #include "udf.h"


      DEFINE_INIT(ks_shock_tube_init,d)


      {


         cell_t c;


         Thread *t;


         real xc[ND_ND];


         


         thread_loop_c(t,d)


         {


            /* loop over all cells */


            begin_c_loop_all(c,t)


            {


               C_CENTROID(xc,c,t);


               if (xc[0] < 0.3 )


               {


                  C_P(c,t) = 2000000.;


               }


               else


               {


                  C_P(c,t) = 100000.;


               }


            }


            end_c_loop_all(c,t)


         }


      } 


       


      Would someone help me define the mixture and property for the cell?


       


      Thanks,


      Keunsoo

    • Rob
      Forum Moderator

      You're looking for a species macro, there are a few examples in the UDF manual. 


      To add, I'd also suggest looking up the Patch operation as part of initialisation: there's no need for a UDF here unless you really like writing code. 

    • keunsoo2
      Subscriber

      Thanks for your suggestion.


      I am trying to initialize with Patch and it looks good now.


      Would you give me a specific example to initialize two different gas conditions with a species macro?


      I am not sure which one is related to my problem.

    • DrAmine
      Ansys Employee

      Please check the Cell Macros form the Customization Manual.

    • keunsoo2
      Subscriber

      Still I don't know which one is proper for my case.


      Would you let me know exact section number?and It would be helpful if you have an example.


       


      I have another question.


      According to other papers, it looks like shock-tube modeling is feasible with Fluent.
      Do you have a shock-tube tutorial or example?

    • DrAmine
      Ansys Employee
      No we do not have official tutorial for that.
      Again check the customization manual and look after C_YI.
      Again you do not require UDF for patching. Possible with inbuilt features.
Viewing 5 reply threads
  • The topic ‘UDF cell initialization using by material library and/or mixture’ is closed to new replies.
[bingo_chatbox]