Shock tube simulation project
AIM:
The aim of this project is to simulate the flow through a shock flow transient case in Converge Studio.
OBJECTIVES OF THE PROJECT:
- Setup a transient shock tube simulation.
- Plot the pressure and temperature history in the entire domain.
- Plot the cell count as a function of time.
THEORY:
What is a shock tube?
A shock tube is an experimental device that is used to study the flow of high temperature and high-velocity compressible gas.
The experimental setup is as shown
The diaphragm will be made to open/ burst. When this happens, flow from the high-pressure region enters the low-pressure region and its aftereffects are observed.
The shock tube is used in many fields such as
- Astrophysics/ comets
- Blast waves (e.g., nuclear explosions)
- Chemical kinetics
- Gas dynamics/ aerodynamics
- Heat transfer (radiation + convection)
- Spectroscopy
PROCEDURE:
SETTING UP THE CASE
Cleaning the geometry
We start with creating geometry in SolidWorks. In this case, the geometry was already created.
- As we open a new project, we import the geometry by dragging it from the file explorer and dropping it on the converge screen or by importing it from the file menu.
- Once the geometry appears, we need to check the geometry units. We can do this by going to the Left-side geometry panel > Options > check the boundary box.
- If the boundary size is in the range of 100meters we can scale it by geometry panel > Transform > Scale > give a scaling factor of 0.001. And the geometry will come to a range of 0.1 m
- Once the Geometry is created, we select the boundaries. Go to geometry tab > Boundary > Find/clean > Find. This will find the triangle orientation and identifies the boundaries.
- Once that is done. We can see that there is a wall that is separating the HP region and LP region. This wall is constructed for understanding the concept of disconnect triangles. But in the simulation a wall like this is undesirable hence we delete these triangles.
- In the “Boundary” options select flag and press “+” select 1 boundary and press ok. We keep the geometry in standard orientation.
- 2 boundaries will be shown, we rename them as
Boundary 1 > “High pressure” (Select all the triangles on the one-half rectangle.)
Boundary 2 > “Low pressure” (select all the triangles on the other half)
- Now left-click on a boundary name and select the triangles on the geometry to assign those triangles to the boundary. Repeat this process for both the boundaries created.
- We can make sure that all the boundaries are assigned by checking the Not Assigned (Boundary ID 0), If the triangles in this boundary are none then all the triangles are assigned to the created boundaries.
Since the geometry in converge is made of triangles, the above steps will assign triangles to boundaries.
- On the left side of the geometry tab, there are some icons. Click on the icon with a blue triangle with a yellow normal pointing outward. This will show the normal of each boundary on the geometry created. If these normal are facing outward they must point inward.
- To do so on the tool on the left there is another tab called Transform > Normal.
- In this tab make sure the propagate change from a single triangle is checked and click on any triangle on the geometry and click Apply. This will change the normal direction to inward.
The normal in geometry should point towards the fluid domain. The above steps will invert the normal towards the inside where the fluid is flowing.
- On the right side of the GUI, there is another toolbox. At the bottom of this toolbox, there are three tabs. Go to the diagnosis tab and with the default options click on find. This will generate a report if all the boxes shown above are checked green select clear.
- Go to the case setup tab and click Begin Case Setup.
- A new window will pop up (If it does not, click on application type) select Time based, and click on apply, and then done.
- Now on the right side, we can see many sections which is where we can set up the simulation.
- Click on the Materials tab and then select the predefined mixture as Air, Uncheck the reaction mechanism and check the species option, and press ok.
- A new message will pop up asking Do you really want to overwrite gas.dat, mech.dat, and therm.dat by loading predefined mixture as air? Click on yes.
We selected the type of fluid flowing inside the geometry to air in the above steps
- In the Gas simulation option with the default settings click apply and done
- Same for the global transport parameters with the default settings click on apply and done.
- On the species mechanism click on add and type O2 and N2 and add them from the suggestions/manual entry.
- In the run parameters in the solver: select the Transient solver to make sure the simulation mode is set to full hydrodynamic Gas flow solver: Compressible.
- In the miscellaneous tab uncheck the use shared memory option and click on ok.
The type of solver will be set to transient in the transient condition and a steady-state monitor is not necessary for the transient case.
This selects the type of solver to be used for our case.
- In the Simulation time parameters enter the following values.
Start time: 0 s
End time: 0.003 s
Initial time step: 1e-9
Minimum time step: 1e-9
Maximum time step: 1s
Maximum convective CFL: 0.8 clicks on ok.
- In the solver parameters section select the Density-based option for Transient.
- Now before we go into the boundaries option click on regions and initialization. Click on add new region. Right-click on region 0 and rename it to high pressure. On the left side near the species click on + and add N2 and select the temperature as 300k and pressure as 600000pa.
- Add another new region with the name low pressure and add O2 with temperature as 300K and pressure as 101325pa and click on ok.
- Now in the boundaries tab assign the following to each boundary.
High pressure > wall
Low pressure > wall
- In the High-pressure boundary select the Temperature Boundary condition to a specified value of 300 K. And the option next to UDF in velocity boundary condition as slip. The Turbulent Kinetic energy (tke) boundary and the Turbulent dissipation (eps) boundary are default values.
- In the Low-pressure boundary select the Temperature Boundary condition to zero normal gradient. And the option next to UDF in velocity boundary condition as slip. The Turbulent Kinetic energy (tke) boundary and the Turbulent dissipation (eps) boundary are default values.
- Now set the regions in the left panel next to boundaries as Low-pressure region for low-pressure boundary and high-pressure region for high-pressure boundary.
The above steps are to be followed to set the boundary conditions.
- In the initial conditions and events, tab check the events option.
- Since the breaking of the diaphragm is a one-time process, we select the sequential tab and add two conditions to it.
- Add the time for the first condition as 0s and select event by regions and select region A as the high pressure and region B as low-pressure region and select close.
- Add the time for the second condition as 0.001s and select event by regions and select region A as the high pressure and region B as low-pressure region and select Open.
- In the physical models > Turbulence modeling select the RANS option and select RNG-kƐ and press ok.
We select the type of flow (laminar/turbulent in the above steps)
These steps will tell converge to observe the given values, changes in them, and note them for post-processing.
- In the Grid control select the Adaptive mesh refinement option and press ok. A new option appears in grid control called “Adaptive mesh refinement”
- In the Grid Control > Base Grid > set the x, y, z sizes to 2e-4m and click ok.
- In the Adaptive mesh refining option. Select the minimum number of cells to 1 and the maximum number of cells to 2,00,000. And add the High pressure and low-pressure regions to active regions. In the bottom, species tab select the Default embedding level: 3.
- Select the Species name as N2; timing type: Permanent and select the SGS embed to 0.001; start s(GSV)and end s can be left blank, select the Period scale to 0s and embed scale to 3; embed (0) and embed (1) can be left blank and embed type should be set to SGS.
- In the Output/Post-processing section> post variable selection > In the species tab check the mass fraction tab and add N2, O2, and press ok.
- In the Output/Post-processing section > Output files > writing time intervals tab > set the time interval for writing 3d output files to 100cycles this will make sure that the files are written for every 100 cycles thereby we have more data and more clear curves.
- For the transient state, the inputs are as follows: set the time interval for writing 3d output files to 1e-5s this will make sure that the files are written very frequently thereby we have more data and more smooth animations. Set the time interval for writing the text output to 1e-5s. This way output will be printed on the terminal very frequently, and we can observe every calculation.
- The time interval for writing the restarting output file. The restart file can be used to restart the simulation from a particular moment without having to start the simulation from the starting in case of any unexpected events like power loss, Out of memory, etc. But writing it every time step takes time and energy so for our convenience, we write it every 0.001s. Press ok.
Save the case setup, upon pressing ctrl+S we save the case setup file which has a .cvg extension.
EXPORTING THE FILES
Now since the case is set, we need to run the simulation. Save this case file on the local computer and then go to the “taskbar on the top left” > file > export > export input files. We should see total of 12files. The usual location is set to the same directory where the case file is saved. Set the location and export the files.
RUNNING THE SIMULATION
Open the Cygwin terminal as administrator and navigate to the location where the case files are stored using the cd command. Then we execute the following command.
mpiexec.exe -n 4 converge.exe restricted
mpiexec.exe is the message passing interface executive file.
-n 4 represents the number of cores to be used for running the simulation.
converge.exe is the converge file that runs the simulation.
restricted limits the total number of cells to 5,00,000
Now we can see many lines being printed on the Cygwin terminal. We can stop this process by pressing Ctrl + C in the Cygwin terminal. We go to the “inputs” file in the case directory, In the outputs control > log level > 0. Now run the above command again in the terminal. This should reduce the amount of output being printed in the Cygwin terminal.
This is done to know the control of the level of output that is being printed on the Cygwin terminal. Once the simulation is finished, we need to post-process the files.
POST-PROCESSING
We open converge > on the bottom left there are some options like postprocessing, lines, etc. We select the post-processing and that will take us to a new window. Here we select the location of the output file which is created in the same directory in which we stored the input files. Once the output file is selected a list appears in the window below the file location option > click on select all and the below the cell variables will be listed > click on select all. Above the file location option, there is space for naming the post-processed file we give a proper name (preferably without spaces/special characters). And then select the output format as “Para-view vtk inline binary”. Once we do this the click convert. And the files will be post-processed.
Once the post-processing is done open Para-view > open file select the output file location > select the converted file _..vtm – group file. This will load the results in Para-view. Click on apply to view the case we set up.
In the top panel select the surface with edges to view the mesh and we might see that with the mesh there are some diagonal lines visible on the mesh. This is because the triangle converge created. So, we create a slice of this geometry. This slice will have the normal in the Z direction. For this in the top panel in the bottom-most line of the top panel there is an option called slice we select that and then click on Z-normal and apply. This will create a slice of the geometry. In the top toolbar, there is an option called surface with edges select it. This will show the mesh
The mesh on the slice would look like this
Now for the slice to the left of the surface option, there is another option which might be something like vtkblockcolors or idreg or solidcolor. Here, select the velocity option this will show the velocity contour at each time. Click the play button on the top. Upon selecting the pressure, we can see the pressure contour. If we delete the slice option in the left panel, we can see the same contours in 3d.
The animation of all the time steps can be saved using the save animation option
We can also look at how the concentration of N2 changes with time
We can also use some of the converge features to compare results. In converge on the bottom left beside the post-processing, there is another tab called line plotting. Upon clicking this it will take us into another window. Here we select the same location where we saved the case setup file. This is because the converge takes the .out files as the input upon selecting the file location some variables are displayed in the window below. We select the file as thermo.out. The x-axis will be cycles and on the y axis, we can select Min, Max pressure, Min, Max temp, and all the variables.
These are the graphs we generated using the converge line plotting module.
Pressure

Temperature

Total cell count

CONCLUSION:
From the above results, the following observations have been made.
- As the diaphragm breaks the gas from the high-pressure region tried to enter the low-pressure region. But since the low-pressure region already had another gas, The high-pressure gas has been pushed behind to its original region during which we can see shock waves produced. This is because when both the gases were pushed to one side high pressure developed due to which these shock waves are formed.
- As the high-pressure gas gets pushed back into its original region. It gets pushed forward to the low-pressure region by the molecules that are in the high-pressure region. These actions are repeated until the pressure gets stabilized.
- A similar profile can be seen for the temperature as well but the physics behind this "spring action differs". The temperature oscillates until the system reaches thermal equilibrium which got disturbed by the bursting of the diaphragm.
- In the video that captured the mesh, we can see that from the point where the diaphragm has broken the mesh seemed to be refined and travels with the flow. This is also the same point from where the cell count has increased drastically compared to before the event.