Back to all tutorials

Oblique Shock - CFD Simulation SimFlow Tutorial

1. Introduction

In this tutorial, you will learn how to perform a 2D analysis of a supersonic flow past a 15-degree inclined wedge in a tunnel. It uses a density-based solver (Rho Central) and as a result, you will obtain plots similar to Schlieren’s photography presenting the shock wave.

2. Download SimFlow

SimFlow is a general purpose CFD Software

To follow this tutorial, you will need SimFlow free version, you may download it via the following link:
Download SimFlow

3. Create Case

Open SimFlow and create a new case named oblique_shock

  1. Go to New panel
  2. Provide name oblique_shock
  3. Click Create Case
image

4. Import Geometry

Firstly, we need to Download GeometryOblique_shock and save it to the hard drive. Then:

  1. Click Import Geometry
  2. Select already downloaded geometry file oblique_shock.stl
  3. Click Open
image

5. Imported Geometry Units

The STL format does not contain the unit information which are defined during the geometry export. If we do not know the exported unit, we can estimate it based on the total size of the model. It is displayed next to Geometry size label. In our case, the default unit meter is correct.

  1. To confirm default unit meter, press OK
os 2 unit

6. Geometry

After import, the tunnel geometry will be displayed in the graphics window.

  1. Click Fit View to zoom the geometry
image

7. Creating Face Group - Inlet

We are dealing with an internal flow problem. The imported geometry determines the bounds of the fluid domain. To inform the program where different boundaries should be created, we will create appropriate face groups.

  1. Select the inlet face by holding CTRL key and clicking on the geometry face in a 3D view. The selection should be marked in red
  2. Click on the Face Group button in the graphics context toolbar
  3. Press Esc key to clear the selection
image

8. Creating Face Group - Outlet

Rotate the view in a way you will be able to see the second end of the tunnel.

  1. Select the outlet face by holding CTRL key and clicking on the geometry face
  2. Click on the Face Group button in the graphics context toolbar
  3. Press Esc key to clear the selection
image

9. Creating Face Group - Top

Now, select the top face of the tunnel.

  1. Select the top face by holding CTRL key and clicking on the geometry face
  2. Click on the Face Group button in the graphics context toolbar
image

10. Rename Face Groups

In the Geometry Panel , under the oblique_shock geometry we can find four face groups. The first group, named default , contains all non-selected surfaces. These surfaces will form the bottom walls of the tunnel. The next two groups represent the inlet and outlet of the fluid domain respectively. The last one represents the top wall of the tunnel. We will rename these groups to make the resulting boundary names more readable.

  1. Select oblique_shock geometry
  2. Expand Geometry Faces
  3. Change face groups names accordingly (double click on its name and start editing)
    group_1 \(\rightarrow\) inlet
    group_2 \(\rightarrow\) outlet
    group_3 \(\rightarrow\) top
image

11. Meshing Parameters - Geometry

When geometry is ready we can move to the meshing step. We will define the boundary layer on the bottom and top wall of the tunnel.

  1. Go to Hex Meshing panel
  2. Select the oblique_shock component
  3. Enable Mesh Geometry
  4. Enable Create Boundary Layer Mesh
  5. Mark top face group to be inflated with a boundary layer
image

12. Base Mesh - Domain

In order to create a 2D mesh, we will use a Plate base mesh type.

  1. Go to Base tab
  2. Select Plate as a Base Mesh Type
  3. Click on Autosize
  4. Define the number of divisions
    Division320100
image

13. Solid Mesh - Material Point

Material Point tells the meshing algorithm on which side of the geometry the mesh is to be retained. Since we are considering flow inside the tunnel we need to place the material point inside the geometry.

  1. Go to Point tab
  2. Specify location inside the tunnel
    Material Point00.60
image

14. Start Meshing

Everything is now ready for meshing.

  1. Switch to Mesh tab
  2. Start the meshing process with Mesh button
image

15. Mesh

After the meshing process is finished the mesh should appear on the screen.

  1. Set the XY orientation View XZ
  2. Click Fit View
image

16. Boundaries

To be able to assign inlet and outlet boundary conditions we have to adjust the mesh boundary types.

  1. Define boundary types accordingly
    empty Empty
    oblique_shock Wall
    oblique_shock_inlet Patch
    oblique_shock_outlet Patch
    oblique_shock_top Wall
image

17. Select Solver

We want to analyze high-speed compressible flow inside the tunnel. For this purpose, we will use the Rho Central (rhoCentralFoam) solver.

  1. Go to SETUP panel
  2. Select Transient type
  3. Select Compressible flow filter
  4. Select Rho Central (rhoCentralFoam) solver
  5. Select solver
image

18. Parameters - Velocity

SimFlow allows users to create parameters that can be used instead of numbers. This allows to easily change a single property without the need to edit all inputs where a given property is used. In this tutorial, we will create a velocity parameter equal to 3 times the Mach number. The speed of sound for \(0^{\circ}C \; (273.15K)\) is \(331.5\; m/s\). To compute its value for temperature 300K we will use the following formula:
\(c_{air}=331.5 \cdot \sqrt{300/273.15}\)

  1. Go to Parameters panel
  2. Define the new parameter name and formula and press Enter
    Nameu
    Formula3*331.5*sqrt(300/273.15)
  3. The newly created parameter will be shown in the parameters list.
image

19. Boundary Conditions - Inlet - Flow

Now, we will define the inlet and outlet boundary conditions. At the inlet, we will set constant fluid velocity using parameter u .

  1. Go to Boundary Conditions panel
  2. Select oblique_shock_inlet boundary
  3. Set the Velocity Inlet character
  4. Set the inlet velocity
    U Reference Value \({\sf [m/s]}\)u
image

20. Boundary Conditions - Inlet - Thermal

  1. Switch to Thermal tab
  2. Set constant temperature at the inlet
    T Type Fixed Value
    T Value \({\sf [K]}\)300
image

21. Boundary Conditions - Outlet

At the outlet, we are going to apply the Wave Transmissive boundary condition. This type allows the pressure waves to freely escape the domain and prevents reflecting them from the outlet boundary.

  1. Select oblique_shock_outlet
  2. Set the pressure type
    p Type Wave Transmissive
image

22. Monitors – Sampling

During calculation, we can observe intermediate results on a section plane. To add sampling data on a plane we need to define the plane and also select fields that will be sampled. Note that runtime post-processing can only be defined before starting calculations and can not be changed later on.

  1. Go to Monitors panel
  2. Switch to Sampling tab
  3. Select Create Slice
  4. Expand Fields list
  5. Select pressure p , velocity U and Temperature T
image

23. Run - Time Control

For any simulation, it is very convenient to let the solver automatically determine the proper time step value. To use this option we need to define time step constraints by providing the initial time step (adjusted by the solver during computations), maximal time step value and the Courant number.

  1. Go to RUN panel
  2. Set the Simulation Time [s] to 0.1
  3. Change Time Stepping to Automatic
  4. Set initial time step, maximum time step and the Courant number accordingly
    Initial \(\Delta t\) \({\sf [s]}\)1e-05
    (solver will start computation with this value and adjust it in the next iterations)
    Max \(\Delta t\) \({\sf [s]}\)1e-04
    Max Co \({\sf [-]}\)0.5
image

24. Run - Output

We can control how often results should be saved on the hard drive. Only this data will be available for postprocessing.

  1. Switch to Output tab
  2. Set the Interval [s] to 1e-03
image

25. Run - CPU

To speed up calculation process increase the number of CPUs basing on your PC capability. We recommend using 4 cores for this tutorial. If you are using a free version you can use the contact form to Request 30-day Trial

Estimated computation time for the free version (2 processors): 20 minutes

  1. Switch to CPU tab
  2. Change the solver to parallel
  3. Define the number of processors
  4. Click Run Simulation button
image

26. Residuals

When the calculation is finished you should see a similar residual plot.

image

27. Slice - Velocity Field

During computation Slices tab will appear next to the Residuals. Under this tab, we can preview results on the section plane.

  1. Change tab to Slices
  2. Select the pressure p
  3. Click Adjust range to data
image

28. Calculate Vorticity

The Mach number is not being computed by default during solver computations. In order to visualize it, we will compute the Mach number using the existing data.

  1. Go to Calculate panel
  2. Set the Time Rnge to Full Time Range
  3. Set the Field to Mach Number
  4. Click on Calculate
image

29. Postprocessing – ParaView

Start ParaView to visualize the shock wave.

  1. Go to POSTPROCESSING panel
  2. Click on Run ParaView
image

30. ParaView - Load Results

Load the results into the program.

  1. Select oblique_shock
  2. Uncheck Skip Zero Time
  3. Click Apply to load results into ParaView
  4. Click Refresh
  5. Select Mach number Ma from the list
image

31. ParaView - Vorticity

The Mach number contour plot will be displayed in the graphic window.

  1. Play with animation buttons to track the flow history
image

32. ParaView - Pressure Gradient (I)

In order to see shock waves more clearly we will display gradients of pressure p which will indicate the discontinuity region.

  1. While holding the Ctrl key push the Spacebar
  2. Start typing Gradient of Unstructured DataSet and press Enter to select this command
image

33. ParaView - Pressure Gradient (II)

Now we will display the magnitude of the pressure gradient in the 3d view. We can adjust the coloring scheme to see the shock waves more clearly.

  1. Click Apply to display Pressure Gradient
  2. Select Gradients from the Coloring list
  3. Click Choose preset
image

34. ParaView - Coloring

We would like to have similar plots to the Schlieren photography which is often used in experiments to visualize density variation. For this purpose we will use X Ray preset.

  1. Select X Ray preset.
  2. Apply changes
  3. Close window
image

35. Paraview - Shock Wave - Results

Shock waves can be identified at the locations of the largest pressure gradient, which corresponds to the dark color in the image. The shock wave angle depends on the wedge angle and Mach Number.
In our case, the shock wave angle equals 31 degrees and is very close to the theoretical value. The analytical solution of this problem is well known and for instance, it can be found in:
Anderson J. Modern Compressible Flow: With Historical Perspective. McGraw-Hill Series in Aeronautical and Aerospace Engineering. McGraw-Hill, 2004. ISBN 9780071241366

image

36. Advanced Postprocessing with ParaView

This concludes the tutorial, covering all the aspects we intended to showcase. For a finely tuned presentation of the results, you may take advantage of the more advanced features.

In ParaView, you can display streamlines, contour plots, vector fields, line or time plots, calculating volume or surface integrals and create animations.

To familiarize yourself with the ParaView capabilities, it’s worth checking out our video tutorial, Paraview CFD Tutorial - Advanced Postprocessing in ParaView, in which we demonstrate some of the most commonly used post-processing techniques.