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.

Parametric Study in Ansys Fluent

    • nicemarkind
      Subscriber

      Hello everyone,

      I’d like to share my experience conducting parametric calculations in Ansys Fluent. Previously, I used Ansys Fluent with constant flow parameters, but I needed to calculate the dependence of the drag force (Fx) on the inlet flow velocity.

      First, I found that there isn’t much information online about performing such parametric studies, and many people, like myself, encounter errors during the calculation process. I decided to describe the main solutions I found, compare the results, share them with others, and perhaps discuss some aspects. Someone might even suggest a more efficient solution.

      Let’s start with the problem. The task was quite complex, and the solution process is time-consuming, so I decided to consider a simplified version: supersonic flow around a sphere in a 3D setting. The sphere’s radius is 5 mm. To accelerate the calculations, half of the computational domain was considered. The geometry is shown in Figure 1, and the mesh in Figure 2.

      rich text editor image

      Figure 1

      rich text editor image

      Figure 2

       

      Method 1 (Benchmark)

      The first, most obvious, most stable, and 100% correct method (which we’ll take as the benchmark) is to calculate each case separately, as shown in Figure 3.

      rich text editor image

      Figure 3

       

      This method requires setting up one calculation case and then copying it, changing the flow velocity (Mach number). The initialization method is Standard, Compute from Inlet (Figure 4).

      rich text editor image

      Figure 4

       

      To speed up the calculation process, the convergence absolute criteria was set to 0.01 (Figure 5).

      rich text editor image

      Figure 5

       

      For clarity, I created a table with the drag force (Fx) values for each case, as well as the number of iterations. The table for the first method is shown below.

      Mach Number

      Fx, N

      Number of Iterations

      1,2

      3,966

      364

      1,4

      5,557

      395

      1,6

      7,439

      357

      1,8

      9,504

      299

      2,0

      11,606

      259

       

      The disadvantages of this method are obvious: it requires regular human intervention (copying, changing the velocity, restarting), which is time-consuming, especially when a single calculation takes several hours and/or dozens or hundreds of such calculations are required. In short, this method is not suitable if you want to simply press a “start” button and go about your business while the entire process completes automatically. However, it remains the most reliable.

       

      Method 2 (Bad)

      The second method uses input and output parameters.

      To set the input parameter (Mach number) in Ansys Fluent, go to Setup -> Boundary Conditions -> Inlet, select Type – pressure-far-field, then next to the Mach Number field, open the drop-down list and select New Input Parameter (Figure 6).

      rich text editor image

      Figure 6

       

      To set the output parameter (Fx), go to Solution -> Report Definitions -> New -> Force Report -> Force (Figure 7).

      rich text editor image

      Figure 7

       

      In the opened window, enter the parameter name, select the zone, and check the "Create Output Parameter" box (Figure 8).

      rich text editor image

      Figure 8

       

      Next, run the initialization and close Fluent; further settings will be made directly in the Workbench window. In the Solution tab settings, leave the Initialization Method field as Program Controlled (Figure 9).

      rich text editor image

      Figure 9

       

      In the Parameter Set tab settings, leave the Design Point Initialization field as From Current (Figure 10).

      rich text editor image

      Figure 10

       

      Next, open the Parameters tab and add new Design Points; in each row, check the Retain box, then click the Update All Design Points button (Figure 11).

      rich text editor image

      Figure 11

       

      The calculation runs automatically without user intervention. However, using this method often leads to errors (I’ve experienced this myself). However, this time I was lucky, and the calculation finished without errors for all Design Points. The results are presented in the table below.

      Mach Number

      Fx, N

      Number of Iterations

      1,2

      3,966

      364

      1,4

      5,028

      629

      1,6

      6,737

      682

      1,8

      8,613

      761

      2,0

      11,298

      1748

       

      In the first Design Point, all values match the benchmark. However, for other cases, there’s almost a twofold increase in the number of iterations; in the last case, the number of iterations reached 1748! The Fx values also do not match the benchmark; the difference reaches 10%. This is caused by the default initialization method; the program attempts to initialize each design point with the solution of the first one (or the one selected when starting the calculation), which causes errors.

      In conclusion, I strongly discourage using this method for such tasks.

       

      Method 3 (Also Bad)

      This method differs from the second only in one aspect. In the Parameter Set tab settings, the Design Point Initialization field is set to From Previous Updated (Figure 12).

      rich text editor image

      Figure 12

       

      Honestly, the problem persists because we haven’t changed the initialization approach (we’d like each Design Point to be initialized separately), but I still decided to consider this method out of interest. The results are presented in the table below.

      Mach Number

      Fx, N

      Number of Iterations

      1,2

      3,966

      364

      1,4

      5,028

      629

      1,6

      6,881

      885

      1,8

      8,825

      1139

      2,0

      10,948

      1405

       

      As expected, this method didn’t improve the results; in some cases, it even worsened them. The difference from the benchmark remained at around 10%.

       

      Method 4 (Better)

      You may have already guessed what I’m going to change this time. In the Solution tab settings, the Initialization Method field is set to Solver Controlled (Figure 13).

      rich text editor image

      Figure 13

       

      This forces the program to calculate each Design Point from scratch, without using the solution of any other Design Point, which is what we need. Let’s look at the results in the table below.

      Mach Number

      Fx, N

      Number of Iterations

      1,2

      3,966

      364

      1,4

      5,153

      472

      1,6

      6,728

      487

      1,8

      8,474

      468

      2,0

      10,412

      471

       

      The number of iterations is significantly lower than in the previous methods. However, the discrepancies in the force values compared to the benchmark are still around 10%, which I believe is due to the inability to finely tune the initialization method for each Design Point. I assume that in this case, the program chooses Standard Initialization as the initialization method, as it was chosen for the zero Design Point, but it does not consider the Compute From parameter during initialization, and this can create additional problems during the solution. I also note that the Scaled Residuals graphs behave somewhat differently compared to the benchmark solutions; when solving my main (complex) problem using this method, several points did not converge at all!

       

      Method 5 (Better)

      I also found online information stating that a parametric study can be launched directly in Fluent, but to do this, it must be launched as a separate application, not through Workbench.

      First, export the computational mesh to a separate file, open Fluent as a standalone program, and import the mesh file. Then, perform the usual calculation setup and define the input and output parameters.

      After that, open the Parametric tab and click the Initialize button (Figure 14).

      rich text editor image

      Figure 14

       

      You will be prompted to save the project, and a table similar to the one in Workbench will open. Click Add Design Point, change the input parameter value, select the Write Data checkboxes, and click Update All (Figure 15).

      rich text editor image

      Figure 15

       

      The results of this calculation are presented in the table below.

      Mach Number

      Fx, N

      Number of Iterations

      1,2

      3,923

      394

      1,4

      5,285

      415

      1,6

      6,794

      443

      1,8

      8,531

      468

      2,0

      10,471

      484

       

      This method seems similar to the previous one but requires extra steps like exporting the geometry, opening Fluent as a separate program, and importing the results back into Workbench.

       

      Method 6 (Good)

      This method, which I also read about online, I decided to test last because it initially seemed quite difficult. However, upon closer examination, it turned out to be very simple and, spoiler alert, the most stable and accurate!

      In this case, we need to follow the same steps as in Method 2, but without clicking Update All Design Points.

      Select the first Design Point and start recording a script by opening File -> Scripting -> Record Journal (Figure 16).

      rich text editor image

      Figure 16

       

      Next, click the Setup tab (open Fluent), select the Standard initialization method, Compute from – Inlet, click the Initialize button, and then run the calculation (Run Calculation -> Calculate). After the calculation is complete, close Fluent, go to the Parameters tab, and select the next design point as current.

      Then, click File -> Scripting -> Stop Recording Journal. This records a script of our actions; the code is shown in Figure 17.

      rich text editor image

      Figure 17

       

      We are particularly interested in the last two lines, which perform the transition to the new Design Point. We can copy these commands as many times as needed, only changing the number of the next point for the transition. A loop could certainly simplify this, but that’s not the main point.

      Now, run the script by clicking File -> Scripting -> Run Script File. All points will be calculated, and the final table in Workbench will look like Figure 18.

      rich text editor image

      Figure 18

       

      Notice that the program deleted the results of all Design Points except the last one calculated. However, the output parameter (Fx) column retains the calculated force values, which can be used later.

      But what if I need the results of each point, not just the force value? In this case, we need to add to our script the recording of each solution to a separate file. Start Record Journal, right-click on any calculated Design Point, and click Export Selected Design Points (Figure 19).

      rich text editor image

      Figure 19

       

      nd the recording; the program will save the solution as a separate Workbench project in the folder with the main project. The resulting script can be inserted into the main one, adding the saving of the Design Point before moving to the next one.

      The table with the results of the calculation using this method is presented below.

      Mach Number

      Fx, N

      Number of Iterations

      1,2

      3,966

      364

      1,4

      5,558

      394

      1,6

      7,441

      357

      1,8

      9,504

      300

      2,0

      11,606

      259

       

      As I mentioned earlier, this method is the most stable and accurate in relation to the benchmark! It allowed for almost complete agreement of results, but it is not without its drawbacks, as it requires additional steps to record the script and additional saving of each point.

       

      Conclusion

      In summary, the most preferable method for conducting a Parametric Study is the last one (using a Python script file). Methods 4 and 5 might work well with Hybrid Initialization, as this initialization method lacks additional parameters. I hope this information will be helpful to someone.

    • Supreetha J
      Forum Moderator

      Hello,
      Thank you for sharing!

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
[bingo_chatbox]