# KozCG: Sod's shocktube

This example uses KozCG in Inciter to compute the Sod problem [1], widely used to test numerical methods to model discontinuous solutions. The problem consists of a pipe in which two different states of a gas is initially separated by a diaphragm. When the diaphragm is raptured at t=0, a wave structure is created and propagated in time. While the solution is 1D, we modeled the process in 3D. The available analytic solution enables verification of the accuracy of the numerical method and the correctness of the software implementation.

## Equations solved

The system of equation solved is

detailed at the KozCG page describing its numerical method.

## Problem setup

The problem is modeled as a 3D tube with a circular cross section of unit length with a diameter of 0.05, with the specific heat ratio as 1.4, and the following initial conditions

where is the distance along the length of the tube. Dirichlet boundary conditions were applied on all flow variables sampling their initial values at the end-faces of the domain and symmetry (free-slip) conditions were set along the surface of the tube. The numerical solution was advanced using the CFL number 0.5 using four different meshes whose properties are list in the following table:

Mesh | Points | Tetrahedra | h |
---|---|---|---|

0 | 7,294 | 34,181 | 0.008393 |

1 | 51,794 | 273,448 | 0.004138 |

2 | 389,139 | 2,187,584 | 0.002060 |

3 | 3,014,277 | 17,500,672 | 0.001028 |

Here h is the average edge length along the length of the tube.

## Code revision to reproduce

To reproduce the results below, use code revision fadd412 and the control file below.

## Control file

-- vim: filetype=lua: print "Sod shocktube" term = 0.2 ttyi = 10 cfl = 0.5 solver = "kozcg" fctclip = true fctsys = { 1, 2, 5 } part = "rcb" problem = { name = "sod" } mat = { spec_heat_ratio = 1.4 } bc_sym = { sideset = { 2 } } bc_dir = { { 1, 1, 1, 1, 1, 1 }, { 3, 1, 1, 1, 1, 1 } } fieldout = { iter = 10000 } diag = { iter = 1, format = "scientific" }

## Run using mesh 1 on 4 CPUs

./charmrun +p4 Main/inciter -i tube01.exo -c sod.q

## Visualization

ParaView can be used for interactive visualization of the numerically computed fields as

`paraview out.e-s.0.4.0`

The surface mesh colored by the fluid density at t=0 and t=0.2 on mesh 1 are depicted below.

The numerical solution is also extracted at t=0.2 along the center of the tube. The density, velocity, total energy, and pressure are depicted below for the successively finer meshes together with the analytical solution.