ppmpy.riemann_exact module#

An exact Riemann solver for the Euler equations with a gamma-law gas. The left and right states are stored as State objects. We then create a RiemannProblem object with the left and right state:

rp = RiemannProblem(left_state, right_state)

Next we solve for the star state:

rp.find_star_state()

Finally, we sample the solution to find the interface state, which is returned as a State object:

q_int = rp.sample_solution()

class RiemannProblem(left_state, right_state, *, gamma=1.4)[source]#

Bases: object

a class to define a Riemann problem. It takes a left

and right state. Note: we assume a constant gamma.

Parameters:
  • left_state (State) – primitive variable state to the left of the interface.

  • right_state (State) – primitive variable state to the right of the interface.

  • gamma (float) – ratio of specific heats.

find_star_state(p_min=0.001, p_max=1000.0)[source]#

root find the Hugoniot curve to find ustar, pstar.

Parameters:
  • p_min (float, optional) – minimum possible pressure.

  • p_max (float, optional) – maximum possible pressure.

rarefaction_solution(sgn, state)[source]#

return the interface solution considering a rarefaction wave.

Parameters:
  • sgn (float) – a sign, -1 or +1, indicating whether it is “+” or “-” in the rarefaction expression (this depends on left or right jump).

  • state (State) – the Riemann state on the non-star side of the rarefaction.

Returns:

the star state across the rarefaction.

Return type:

State

sample_solution()[source]#

given the star state (ustar, pstar), find the state on the interface

shock_solution(sgn, state)[source]#

return the interface solution considering a shock.

Parameters:
  • sgn (float) – a sign, -1 or +1, indicating whether it is “+” or “-” in the shock expression (this depends on left or right jump).

  • state (State) – the Riemann state on the non-star side of the shock.

Returns:

the star state across the shock.

Return type:

State

u_hugoniot(p, side)[source]#

define the Hugoniot curve, u(p).

Parameters:
  • p (float) – pressure

  • side (str) – “left” or “right” to indicate which state to use.

Returns:

the velocity on the Hugoniot curve for the input pressure

Return type:

float

class State(*, p=1.0, u=0.0, rho=1.0)[source]#

Bases: object

a simple object to hold a primitive variable state

Parameters:
  • p (float) – pressure

  • u (float) – velocity

  • rho (float) – density

plot_hugoniot(riemann_problem, p_min=0.0, p_max=1.5, N=500)[source]#

plot the Hugoniot curves.

Parameters:
  • riemann_problem (RiemannProblem) – the Riemann problem object.

  • p_min (float) – the minimum pressure to plot.

  • p_max (float) – the maximum pressure to plot.

  • N (int) – number of points to use in the plot.

Return type:

matplotlib.pyplot.Figure