A Riemann Problem is specified by the state of the material to the left and right of the interface. In this hydrodynamic problem, the state is fully determined by an equation of state and the variables
$$ {\bf U} = \begin{pmatrix} \rho_0 \\ v_x \\ v_t \\ \epsilon \end{pmatrix}, $$where $\rho_0$ is the rest-mass density, $v_x$ the velocity normal to the interface, $v_t$ the velocity tangential to the interface, and $\epsilon$ the specific internal energy.
In r3d2
we define a state from an equation of state and the values of the key variables:
In [1]:
from r3d2 import eos_defns, State
In [2]:
eos = eos_defns.eos_gamma_law(5.0/3.0)
U = State(1.0, 0.1, 0.0, 2.0, eos)
Inside the notebook, the state will automatically display the values of the key variables:
In [3]:
U
Out[3]:
Adding a label to the state for output purposes requires an extra keyword:
In [4]:
U2 = State(10.0, -0.3, 0.1, 5.0, eos, label="L")
U2
Out[4]:
In [5]:
q_available = 0.1
t_ignition = 10.0
Cv = 1.0
eos_reactive = eos_defns.eos_gamma_law_react(5.0/3.0, q_available, Cv, t_ignition, eos)
U_reactive = State(5.0, 0.1, 0.1, 2.0, eos_reactive, label="Reactive")
U_reactive
Out[5]:
In [6]:
print("Left wavespeed of first state is {}".format(U.wavespeed(0)))
print("Middle wavespeed of second state is {}".format(U2.wavespeed(1)))
print("Right wavespeed of reactive state is {}".format(U.wavespeed(2)))
A state will return the key primitive variables ($\rho, v_x, v_t, \epsilon$):
In [7]:
print("Primitive variables of first state are {}".format(U.prim()))
A state will return all the variables it computes, which is $\rho, v_x, v_t, \epsilon, p, W, h, c_s$: the primitive variables as above, the pressure $p$, Lorentz factor $W$, specific enthalpy $h$, and speed of sound $c_s$:
In [8]:
print("All variables of second state are {}".format(U.state()))