# Step-by-step tutorial for Session 2 of CFD Master Class

## Exercise

Choosing the right numerical settings can help to greatly decrease the computational effort required to run a simulation. However, there are a trade-offs between stability and speed of the numerical calculation.

The aim of this exercise is to investigate the impact of different numerical settings on the overall simulation time.

## Step-by-Step Instructions

• For this project we will use an imported mesh for our simulation. Click here to import the project. The project contains one mesh which will be used for this session.

• For settings up the simulation switch to the Simulation Designer tab.

• Next, click New simulation to create a new simulation item in the Project Tree.

• From the middle column set the Analysis Type to Fluid dynamics and Incompressible. For this analysis we will select K-omega SST for our turbulence model with Steady-state behavior and the SIMPLE solver. Click Save to preserve this selection. You will then see the Project Tree expand with the full setting in the left column.

• In the Project Tree move to the domain and assign the respective mesh to the simulation and press Save.

• Move to the Materials item in the Project Tree and click New.

• Import the Air from the material library and assign it to the entire volume.

• Move to the Boundary Conditions item in the Project Tree to set the boundary conditions.

• Click New to add a new boundary condition.

• First add a boundary condition by the name âInletâ. Set the Type to Velocity Inlet/Fixed Value with an x value of 25m/s and assign it to the face inlet.

• Add another boundary condition and rename it to âOutletâ. Set the type to Pressure Outlet with a value of 0 and assign it to the face outlet.

• Next, add another boundary condition and rename it to âBoundsâ. Set the type to Symmetry and assign it to the face topAndBottom.

• Since we want to investigate numerical settings, we will run a 2D simulation. For a 2d case, it is necessary to add a specific boundary condition to the surrounding walls. Add another boundary condition and rename it to 2D Dummy. Set the type to Custom and assign it to the face defaultFaces.

• Finally, add the last boundary condition and rename it to âAirfoilâ. Set the type to Wall (no slip / wall function) and assign it to the face airfoil.

• Now move to the Simulation Control and set the parameters accordingly and then Save

• Click on the Simulation Runs item. Create a new run and name it. Finally click Start to run the simulation.

• Once the simulation is finished, you can check the run time and number of iterations which were needed for the convergence criteria to be reached.

• To see this information, click on theâSolver Log item in the project tree. This will open the log file of the solver.

• We will now change numerical settings and examine the effect on the calculation time and number of iterations till convergence.

## Relaxation

Relaxation and Convergence Criteria

Numerical methods used to solve the equations for fluid flow and heat transfer most often employ one or more iteration procedures. By their nature, iterative solution methods require a convergence criteria that is used to decide when the iterations can be terminated.

In many cases, iteration methods are supplemented with relaxation techniques. For example, over-relaxation is often used to accelerate the convergence of pressure-velocity iteration methods, which are needed to satisfy an incompressible flow condition. Under-relaxation is sometimes used to achieve numerically stable results when all the flow equations are implicitly coupled together.

Choosing Relaxation Criteria

The amount of over or under-relaxation used can be critical. Too much leads to numerical instabilities, while too little slows down convergence. Similarly, a poorly chosen convergence criteria can lead to either poor results (when too loose) or excessive computational times (when too tight).

Selecting proper relaxation and convergence criteria can be a difficult and frustrating experience for users of computational fluid dynamics software. The criteria depend on the specifics of the problem being solved, which may change during the evolution of a problem. Unfortunately, there are no universal guidelines for selecting criteria because they depend not only on the physical processes being approximated, but also on the details of the numerical formulation. Many CFD programs have a standard set of recommended criteria, but users must often resort to trial-and-error adjustments to get good results.

source: Flow3D

• We will now change all relaxation factors for p, U, k and omega to a uniform value. In addition, we will change the solver for pressure from GAMG to PCG. Then create a new simulation run and start it.

• Please create a simulation run for following relaxation values:
0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.,7

## Solver Tolerances

Just like the simulation result, the single steps the simulation are calculated with iterative methods. So called âlinear solversâ are used to calculate the solution of linear equation system. You can find some information about that in the recording of the session. A good example for such a linear solver which is also used on the SimScale platform can be found here:

• We will now change the tolerance settings of the linear solver for pressure according following values and create a new simulation run.

• Create a simulation run for following settings (Absolute Tolerance/Relative Tolerance)
(1e-5/0.01), (1e-6/0.01), (1e-7/0.01)

• Note: You need to change back the other values to the initial state manually!

## Schemes

Numerical schemes are used to calculate derivatives etc. This topic was also covered during the webinar session. You can find additional information here:

• We will now change all schemes to high order schemes according to the image below. Please create a simulation run for these specific settings.

It total you should have created 1 simulation with 12 different simulation runs as shown in the table below. After the runs are finished you can compare the computation time for different numerical settings.

Table courtesy of: Mario Larreta

4 Likes

the link is for the project 1.

thanks

Luca

1 Like

Hello,

When I openend the link it contained the Geometry of the First Session of the CFD Master Class.
I just wanted to let you know.

Good bye,

Tim

1 Like

Thank yoĐł so much for this session, itâs just what was missed in general webinars on CFD here on SImscale

1 Like

Hey,

Sorry for that confusion. I just corrected the link!

Have fun!

Cheers,

3 Likes

HI there
I am getting an error âFloating point exceptionâ when I use 0.7 as a relaxation value. I used the help and I am lost a bit in the description. So, is there something to vary in order to get the simulation done ?

1 Like

I got the same error with 0.7 valueâŚnow Iâm investigatingâŚ
cheers

Luca

1 Like

Hi Milad, I exhausted my computing core hours in the first assignment. Now, I have no hours left, but I have to do my second assignment of CFD Master Class. What can I do now?

1 Like

Hi everyone,

I did a table to help me doing all the configurations (currently computing), hope it helps you too:

6 Likes

1 Like

Did anybody figure out the problem with the âfloating pointâ error? How can it be fixed?

1 Like

@dxraf - Iâve updated your account, you should be able to proceed with simulating!

Best,
Anna

3 Likes

Thank you very much, Anna. You are too good.

1 Like

Could you guys solve the problem? Iâve been changing some values but I didnât get anything.
I have been searching through internet and apparently the only way to fix it is changing the mesh.

Esteban

1 Like

Hi @Esteban9044 @AhmedRiyadh @l_trefiletti for this particular case at the high relaxation factor simulation is diverging. As per the given task try to find the highest relaxation factor which works. If it is diverging at 0.7 then try lowering it a bit and see if that one is stable.

Cheers

4 Likes

Hi Anna,

I think IÂ´m going to be in the same situation like dxraf. I only have 23% hours left of my computing core hours and I wonÂ´t be able to work on this assignment. Besides, IÂ´ve been working on other tasks and the simulationÂ´s steps are going on so slowly. Thanks.

Cheers
Alex

1 Like

@Alexor, You should be all set now

Best,
Anna

1 Like

Hello,
for the additional raffle, i have some questions:

1. for which discretization should we find the maximum relaxation factors? (default values, or higher order discretization )
2. the second question is to find the optimum / maximum relaxation factors but what is the objective function?
e.g. somebody get for p,U,k,omega 0.5 0.6 0.6 0.5 and somebody get 0.6 0.5 0.6 0.5. which one is better?
I would define the objective function as sum of al relations factors.