V&V » RieCG: Sod's shocktube

This example uses RieCG 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

\[ \begin{split} \frac{\partial U}{\partial t} + \frac{\partial F_j}{\partial x_j} = 0,\qquad U = \begin{Bmatrix} \rho \\ \rho u_i \\ \rho E \end{Bmatrix}, \enskip F_j = \begin{Bmatrix} \rho u_j \\ \rho u_iu_j + p\delta_{ij} \\ u_j(\rho E + p) \end{Bmatrix} \end{split} \]

detailed at the RieCG 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

\[ \begin{split} u_i & = 0.0 \\ \rho(x_1) & = \left\{ \begin{array}{cc} 1.0 & x_1 < 0.5 \\ 0.125 & x_1 \ge 0.5 \end{array} \right. \\ p(x_1) & = \left\{ \begin{array}{cc} 1.0 & x_1 < 0.5 \\ 0.1 & x_1 \ge 0.5 \end{array} \right. \end{split} \]

where $x_1$ 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:

MeshPointsTetrahedrah
07,29434,1810.008393
151,794273,4480.004138
2389,1392,187,5840.002060
33,014,27717,500,6720.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 965089c and the control file below.

Control file

-- vim: filetype=lua:

print "Sod shocktube"

term = 0.2
ttyi = 10
cfl = 0.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.

Image Image

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.

Image Image Image Image

Numerical errors and convergence rate

The table below shows the numerical L1 errors of the flow quantities computed. The L1 error is computed as

\[ \left| \left| \varepsilon \right| \right|_1 = \frac{\sum_{v=1}^n V^v \left| \hat{U}^v - U^{v} \right|} {\sum_{v=1}^n V^v} \]

where n is the total number of points of the mesh, $\hat{U}^v$ and $U^v$ are the exact and computed solutions at mesh point v, and $V^v$ denotes the volume associated to mesh point v. The order of convergence is estimated as

\[ p = \frac{ \log \left| \left| \varepsilon \right| \right|_1^{m+1} - \log \left| \left| \varepsilon \right| \right|_1^m}{ \log h^{m+1} - \log h^m} \]

where m is a mesh index. The following table summarizes the L1 errors in all flow variables at t=0.2.

MeshhL1(r)L1(u)L1(p)L1(E)
00.0083936.14e-31.01e-24.82e-32.47e-2
10.0041383.53e-35.24e-32.77e-31.38e-2
20.0020602.12e-32.79e-31.67e-38.12e-3
30.0010281.31e-31.67e-31.05e-34.88e-3
p0.690.730.670.73

Here r, u, p, and E are the fluid density, velocity along the tube, pressure, and total energy, respectively. The data is also plotted in the folloowing figure

Image

Since the solution contains discontinuities, the error is dominated by their vicinity and thus the order of accuracy is expected to be approximately 1.0 or lower.

References

[1] J.R. Kamm, Enhanced verification test suite for phyics simulation codes, LA-14379, SAND2008-7813, 2008.