Simple Sod shock tube calculator

Python module which calculates Sod shock tube analytical solutions for various initial conditions.


I have managed to create the Python module which should calculate Sod shock tube analytical solutions for various initial conditions.

The sources are hosted on gitlab, and the package is available on pypi.

Download the sod.py, put it in your path, or install the package via pip3 install shocktubecalc and you are ready to go.

 

The simplest possible usage is shown below:

import sod

positions, regions, values = sod.solve(left_state=(1, 1, 0), right_state=(0.1, 0.125, 0.),
                                           geometry=(0., 1., 0.5), t=0.2)

If one runs the example, output should look something like this:

Positions:
Shock      : 0.8504311464060357
Contact Discontinuity : 0.6854905240097902
Head of Rarefaction : 0.26335680867601535
Foot of Rarefaction : 0.4859454374877634
Regions:
Region 1   : (1, 1, 0)
Region 2   : RAREFACTION
Region 3   : (0.30313017805064707, 0.42631942817849544, 0.92745262004895057)
Region 4   : (0.30313017805064707, 0.26557371170530725, 0.92745262004895057)
Region 5   : (0.1, 0.125, 0.0)

and produce the following plots:

Copyright 2013 - Department of Fluid Mechanics and Computational Engineering