-
-
June 5, 2019 at 2:13 pm
keunsoo2
SubscriberHello,
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
-
June 5, 2019 at 3:22 pm
Rob
Forum ModeratorYou'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.Â
-
June 10, 2019 at 6:59 pm
keunsoo2
SubscriberThanks 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.
-
June 11, 2019 at 10:00 am
DrAmine
Ansys EmployeePlease check the Cell Macros form the Customization Manual.
-
June 16, 2019 at 3:14 am
keunsoo2
SubscriberStill 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? -
June 17, 2019 at 5:00 am
DrAmine
Ansys EmployeeNo 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.
-
- The topic ‘UDF cell initialization using by material library and/or mixture’ is closed to new replies.
-
5834
-
1906
-
1420
-
1305
-
1021
© 2026 Copyright ANSYS, Inc. All rights reserved.