Peano
Loading...
Searching...
No Matches
exaparty.api.sphtools.riemann.RiemannSolver Class Reference

Exact Riemann solver. More...

Public Member Functions

 __init__ (self, gamma)
 Constructor.
 get_soundspeed (self, rho, P)
 Get the soundspeed corresponding to the given density and pressure.
 fb (self, rho, P, a, Pstar)
 Riemann fL or fR function.
 f (self, rhoL, uL, PL, aL, rhoR, uR, PR, aR, Pstar)
 Riemann f function.
 fprimeb (self, rho, P, a, Pstar)
 Derivative of the Riemann fL or fR function.
 fprime (self, rhoL, PL, aL, rhoR, PR, aR, Pstar)
 Derivative of the Riemann f function.
 gb (self, rho, P, Pstar)
 Riemann gL or gR function.
 guess_P (self, rhoL, uL, PL, aL, rhoR, uR, PR, aR)
 Get an initial guess for the pressure in the middle state.
 solve_brent (self, rhoL, uL, PL, aL, rhoR, uR, PR, aR, Plow, Phigh)
 Find the pressure of the middle state by using Brent's method.
 sample_right_shock_wave (self, rhoR, uR, PR, aR, ustar, Pstar, dxdt=np.array([0.0]))
 Sample the Riemann problem solution for a position in the right shock wave regime.
 sample_right_rarefaction_wave (self, rhoR, uR, PR, aR, ustar, Pstar, dxdt=np.array([0.0]))
 Sample the Riemann problem solution for a position in the right rarefaction wave regime.
 sample_right_state (self, rhoR, uR, PR, aR, ustar, Pstar, dxdt=np.array([0.0]))
 Sample the Riemann problem solution in the right state regime.
 sample_left_shock_wave (self, rhoL, uL, PL, aL, ustar, Pstar, dxdt=np.array([0.0]))
 Sample the Riemann problem solution for a position in the left shock wave regime.
 sample_left_rarefaction_wave (self, rhoL, uL, PL, aL, ustar, Pstar, dxdt=np.array([0.0]))
 Sample the Riemann problem solution for a position in the left rarefaction wave regime.
 sample_left_state (self, rhoL, uL, PL, aL, ustar, Pstar, dxdt=np.array([0.0]))
 Sample the Riemann problem solution in the left state regime.
 sample_right_vacuum (self, rhoL, uL, PL, aL, dxdt=np.array([0.0]))
 Sample the vacuum Riemann problem if the right state is a vacuum.
 sample_left_vacuum (self, rhoR, uR, PR, aR, dxdt=np.array([0.0]))
 Sample the vacuum Riemann problem if the left state is a vacuum.
 sample_vacuum_generation (self, rhoL, uL, PL, aL, rhoR, uR, PR, aR, dxdt)
 Sample the vacuum Riemann problem in the case vacuum is generated in between the left and right state.
 solve_vacuum (self, rhoL, uL, PL, aL, rhoR, uR, PR, aR, dxdt=np.array([0.0]))
 Vacuum Riemann solver.
 solve (self, rhoL, uL, PL, rhoR, uR, PR, dxdt=np.array([0.0]))
 Solve the Riemann problem with the given left and right state.
 solve_middle_state (self, rhoL, uL, PL, rhoR, uR, PR)
 Solve the Riemann problem with the given left and right state for the velocity and pressure (but do not sample the solution).

Protected Attributes

 _gamma = gamma
float _gp1d2g = 0.5 * (gamma + 1.0) / gamma
 related quantities: gamma plus 1 divided by 2 gamma
float _gm1d2g = 0.5 * (gamma - 1.0) / gamma
tuple _gm1dgp1 = (gamma - 1.0) / (gamma + 1.0)
float _tdgp1 = 2.0 / (gamma + 1.0)
float _tdgm1 = 2.0 / (gamma - 1.0)
float _gm1d2 = 0.5 * (gamma - 1.0)
float _tgdgm1 = 2.0 * gamma / (gamma - 1.0)
float _ginv = 1.0 / gamma

Detailed Description

Exact Riemann solver.

Definition at line 37 of file riemann.py.

Constructor & Destructor Documentation

◆ __init__()

exaparty.api.sphtools.riemann.RiemannSolver.__init__ ( self,
gamma )

Constructor.

Parameters
gammaAdiabatic index \(\gamma{}\).

Definition at line 42 of file riemann.py.

Member Function Documentation

◆ f()

exaparty.api.sphtools.riemann.RiemannSolver.f ( self,
rhoL,
uL,
PL,
aL,
rhoR,
uR,
PR,
aR,
Pstar )

Riemann f function.

Parameters
rhoLDensity of the left state.
uLVelocity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
rhoRDensity of the right state.
uRVelocity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
Pstar(Temporary) pressure of the middle state.
Returns
Value of the Riemann f function.

Definition at line 105 of file riemann.py.

References fb().

Referenced by solve(), solve_brent(), and solve_middle_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb()

exaparty.api.sphtools.riemann.RiemannSolver.fb ( self,
rho,
P,
a,
Pstar )

Riemann fL or fR function.

Parameters
rhoDensity of the left or right state.
PPressure of the left or right state.
aSoundspeed of the left or right state.
Pstar(Temporary) pressure of the middle state.
Returns
Value of the fL or fR function.

Definition at line 86 of file riemann.py.

References _gm1d2g, _gm1dgp1, _tdgm1, and _tdgp1.

Referenced by f(), solve(), and solve_middle_state().

Here is the caller graph for this function:

◆ fprime()

exaparty.api.sphtools.riemann.RiemannSolver.fprime ( self,
rhoL,
PL,
aL,
rhoR,
PR,
aR,
Pstar )

Derivative of the Riemann f function.

Parameters
rhoLDensity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
rhoRDensity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
Pstar(Temporary) pressure of the middle state.
Returns
Value of the derivative of the Riemann f function.

Definition at line 141 of file riemann.py.

References fprimeb().

Referenced by solve(), and solve_middle_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fprimeb()

exaparty.api.sphtools.riemann.RiemannSolver.fprimeb ( self,
rho,
P,
a,
Pstar )

Derivative of the Riemann fL or fR function.

Parameters
rhoDensity of the left or right state.
PPressure of the left or right state.
aSoundspeed of the left or right state.
Pstar(Temporary) pressure of the middle state.
Returns
Value of the derivative of the Riemann fL or fR function.

Definition at line 122 of file riemann.py.

References _gm1dgp1, _gp1d2g, and _tdgp1.

Referenced by fprime().

Here is the caller graph for this function:

◆ gb()

exaparty.api.sphtools.riemann.RiemannSolver.gb ( self,
rho,
P,
Pstar )

Riemann gL or gR function.

Parameters
rhoDensity of the left or right state.
PPressure of the left or right state.
Pstar(Temporary) pressure in the middle state.
Returns
Value of the gL or gR function.

Definition at line 156 of file riemann.py.

References _gm1dgp1, and _tdgp1.

Referenced by guess_P().

Here is the caller graph for this function:

◆ get_soundspeed()

exaparty.api.sphtools.riemann.RiemannSolver.get_soundspeed ( self,
rho,
P )

Get the soundspeed corresponding to the given density and pressure.

Parameters
rhoDensity value.
PPressure value.
Returns
Soundspeed.

Definition at line 73 of file riemann.py.

References exagrype.api.euler.Euler.Euler._gamma, and _gamma.

Referenced by solve(), and solve_middle_state().

Here is the caller graph for this function:

◆ guess_P()

exaparty.api.sphtools.riemann.RiemannSolver.guess_P ( self,
rhoL,
uL,
PL,
aL,
rhoR,
uR,
PR,
aR )

Get an initial guess for the pressure in the middle state.

Parameters
rhoLLeft state density.
uLLeft state velocity.
PLLeft state pressure.
aLLeft state soundspeed.
rhoRRight state density.
uRRight state velocity.
PRRight state pressure.
aRRight state soundspeed.
Returns
Initial guess for the pressure in the middle state.

Definition at line 169 of file riemann.py.

References _gm1d2, _gm1d2g, _tgdgm1, and gb().

Referenced by solve(), and solve_middle_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sample_left_rarefaction_wave()

exaparty.api.sphtools.riemann.RiemannSolver.sample_left_rarefaction_wave ( self,
rhoL,
uL,
PL,
aL,
ustar,
Pstar,
dxdt = np.array([0.0]) )

Sample the Riemann problem solution for a position in the left rarefaction wave regime.

Parameters
rhoLDensity of the left state.
uLVelocity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
ustarVelocity of the middle state.
PstarPressure of the middle state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution.

Definition at line 460 of file riemann.py.

References _ginv, _gm1d2, _gm1d2g, _gm1dgp1, _tdgm1, _tdgp1, and _tgdgm1.

Referenced by sample_left_state().

Here is the caller graph for this function:

◆ sample_left_shock_wave()

exaparty.api.sphtools.riemann.RiemannSolver.sample_left_shock_wave ( self,
rhoL,
uL,
PL,
aL,
ustar,
Pstar,
dxdt = np.array([0.0]) )

Sample the Riemann problem solution for a position in the left shock wave regime.

Parameters
rhoLDensity of the left state.
uLVelocity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
ustarVelocity of the middle state.
PstarPressure of the middle state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution.

Definition at line 419 of file riemann.py.

References _gm1d2g, _gm1dgp1, and _gp1d2g.

Referenced by sample_left_state().

Here is the caller graph for this function:

◆ sample_left_state()

exaparty.api.sphtools.riemann.RiemannSolver.sample_left_state ( self,
rhoL,
uL,
PL,
aL,
ustar,
Pstar,
dxdt = np.array([0.0]) )

Sample the Riemann problem solution in the left state regime.

Parameters
rhoLDensity of the left state.
uLVelocity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
ustarVelocity of the middle state.
PstarPressure of the middle state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution.

Definition at line 514 of file riemann.py.

References sample_left_rarefaction_wave(), and sample_left_shock_wave().

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sample_left_vacuum()

exaparty.api.sphtools.riemann.RiemannSolver.sample_left_vacuum ( self,
rhoR,
uR,
PR,
aR,
dxdt = np.array([0.0]) )

Sample the vacuum Riemann problem if the left state is a vacuum.

Parameters
rhoRDensity of the right state.
uRVelocity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution, and a flag indicating wether the left state (-1), the right state (1), or a vacuum state (0) was sampled.

Definition at line 586 of file riemann.py.

References _gm1dgp1, _tdgm1, _tdgp1, and _tgdgm1.

Referenced by solve_vacuum().

Here is the caller graph for this function:

◆ sample_right_rarefaction_wave()

exaparty.api.sphtools.riemann.RiemannSolver.sample_right_rarefaction_wave ( self,
rhoR,
uR,
PR,
aR,
ustar,
Pstar,
dxdt = np.array([0.0]) )

Sample the Riemann problem solution for a position in the right rarefaction wave regime.

Parameters
rhoRDensity of the right state.
uRVelocity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
ustarVelocity of the middle state.
PstarPressure of the middle state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution.

Definition at line 343 of file riemann.py.

References _ginv, _gm1d2, _gm1d2g, _gm1dgp1, _tdgm1, _tdgp1, and _tgdgm1.

Referenced by sample_right_state().

Here is the caller graph for this function:

◆ sample_right_shock_wave()

exaparty.api.sphtools.riemann.RiemannSolver.sample_right_shock_wave ( self,
rhoR,
uR,
PR,
aR,
ustar,
Pstar,
dxdt = np.array([0.0]) )

Sample the Riemann problem solution for a position in the right shock wave regime.

Parameters
rhoRDensity of the right state.
uRVelocity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
ustarVelocity of the middle state.
PstarPressure of the middle state.
rhosolDensity solution.
usolVelocity solution.
PsolPressure solution.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution.

Definition at line 301 of file riemann.py.

References _gm1d2g, _gm1dgp1, and _gp1d2g.

Referenced by sample_right_state().

Here is the caller graph for this function:

◆ sample_right_state()

exaparty.api.sphtools.riemann.RiemannSolver.sample_right_state ( self,
rhoR,
uR,
PR,
aR,
ustar,
Pstar,
dxdt = np.array([0.0]) )

Sample the Riemann problem solution in the right state regime.

Parameters
rhoRDensity of the right state.
uRVelocity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
ustarVelocity of the middle state.
PstarPressure of the middle state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution.

Definition at line 393 of file riemann.py.

References sample_right_rarefaction_wave(), and sample_right_shock_wave().

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sample_right_vacuum()

exaparty.api.sphtools.riemann.RiemannSolver.sample_right_vacuum ( self,
rhoL,
uL,
PL,
aL,
dxdt = np.array([0.0]) )

Sample the vacuum Riemann problem if the right state is a vacuum.

Parameters
rhoLDensity of the left state.
uLVelocity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution, and a flag indicating wether the left state (-1), the right state (1), or a vacuum state (0) was sampled.

Definition at line 540 of file riemann.py.

References _gm1d2, _gm1dgp1, _tdgm1, _tdgp1, and _tgdgm1.

Referenced by solve_vacuum().

Here is the caller graph for this function:

◆ sample_vacuum_generation()

exaparty.api.sphtools.riemann.RiemannSolver.sample_vacuum_generation ( self,
rhoL,
uL,
PL,
aL,
rhoR,
uR,
PR,
aR,
dxdt )

Sample the vacuum Riemann problem in the case vacuum is generated in between the left and right state.

Parameters
rhoLDensity of the left state.
uLVelocity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
rhoRDensity of the right state.
uRVelocity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution, and a flag indicating wether the left state (-1), the right state (1), or a vacuum state (0) was sampled.

Definition at line 632 of file riemann.py.

References _gm1dgp1, _tdgm1, _tdgp1, and _tgdgm1.

Referenced by solve_vacuum().

Here is the caller graph for this function:

◆ solve()

exaparty.api.sphtools.riemann.RiemannSolver.solve ( self,
rhoL,
uL,
PL,
rhoR,
uR,
PR,
dxdt = np.array([0.0]) )

Solve the Riemann problem with the given left and right state.

Parameters
rhoLLeft state density.
uLLeft state velocity.
PLLeft state pressure.
rhoRRight state density.
uRRight state velocity.
PRRight state pressure.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution, and a flag indicating wether the left state (-1), the right state (1), or a vacuum state (0) was sampled.

Definition at line 755 of file riemann.py.

References _tdgm1, exaparty.api.particle.SPHParticle.SPHParticle.f, f(), fb(), fprime(), get_soundspeed(), guess_P(), sample_left_state(), sample_right_state(), solve_brent(), and solve_vacuum().

Here is the call graph for this function:

◆ solve_brent()

exaparty.api.sphtools.riemann.RiemannSolver.solve_brent ( self,
rhoL,
uL,
PL,
aL,
rhoR,
uR,
PR,
aR,
Plow,
Phigh )

Find the pressure of the middle state by using Brent's method.

Parameters
rhoLDensity of the left state.
uLVelocity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
rhoRDensity of the right state.
uRVelocity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
PlowLower bound guess for the pressure of the middle state.
PhighHigher bound guess for the pressure of the middle state.
Returns
Pressure of the middle state, with a 1.e-8 relative error precision.

Definition at line 210 of file riemann.py.

References exaparty.api.particle.SPHParticle.SPHParticle.f, and f().

Referenced by solve(), and solve_middle_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ solve_middle_state()

exaparty.api.sphtools.riemann.RiemannSolver.solve_middle_state ( self,
rhoL,
uL,
PL,
rhoR,
uR,
PR )

Solve the Riemann problem with the given left and right state for the velocity and pressure (but do not sample the solution).

Parameters
rhoLLeft state density.
uLLeft state velocity.
PLLeft state pressure.
rhoRRight state density.
uRRight state velocity.
PRRight state pressure.
Returns
Velocity and pressure in the middle region.

Definition at line 854 of file riemann.py.

References _tdgm1, exaparty.api.particle.SPHParticle.SPHParticle.f, f(), fb(), fprime(), get_soundspeed(), guess_P(), and solve_brent().

Here is the call graph for this function:

◆ solve_vacuum()

exaparty.api.sphtools.riemann.RiemannSolver.solve_vacuum ( self,
rhoL,
uL,
PL,
aL,
rhoR,
uR,
PR,
aR,
dxdt = np.array([0.0]) )

Vacuum Riemann solver.

This solver is called when one or both states have a zero density, or when the vacuum generation condition is satisfied (meaning vacuum is generated in the middle state, although strictly speaking there is no "middle" state if vacuum is involved).

Parameters
rhoLDensity of the left state.
uLVelocity of the left state.
PLPressure of the left state.
aLSoundspeed of the left state.
rhoRDensity of the right state.
uRVelocity of the right state.
PRPressure of the right state.
aRSoundspeed of the right state.
dxdtPoint in velocity space where we want to sample the solution.
Returns
Density, velocity and pressure solution, and a flag indicating wether the left state (-1), the right state (1), or a vacuum state (0) was sampled.

Definition at line 712 of file riemann.py.

References sample_left_vacuum(), sample_right_vacuum(), and sample_vacuum_generation().

Referenced by solve().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ _gamma

exaparty.api.sphtools.riemann.RiemannSolver._gamma = gamma
protected

Definition at line 53 of file riemann.py.

Referenced by get_soundspeed().

◆ _ginv

float exaparty.api.sphtools.riemann.RiemannSolver._ginv = 1.0 / gamma
protected

Definition at line 71 of file riemann.py.

Referenced by sample_left_rarefaction_wave(), and sample_right_rarefaction_wave().

◆ _gm1d2

float exaparty.api.sphtools.riemann.RiemannSolver._gm1d2 = 0.5 * (gamma - 1.0)
protected

◆ _gm1d2g

float exaparty.api.sphtools.riemann.RiemannSolver._gm1d2g = 0.5 * (gamma - 1.0) / gamma
protected

◆ _gm1dgp1

tuple exaparty.api.sphtools.riemann.RiemannSolver._gm1dgp1 = (gamma - 1.0) / (gamma + 1.0)
protected

◆ _gp1d2g

float exaparty.api.sphtools.riemann.RiemannSolver._gp1d2g = 0.5 * (gamma + 1.0) / gamma
protected

related quantities: gamma plus 1 divided by 2 gamma

Definition at line 57 of file riemann.py.

Referenced by fprimeb(), sample_left_shock_wave(), and sample_right_shock_wave().

◆ _tdgm1

float exaparty.api.sphtools.riemann.RiemannSolver._tdgm1 = 2.0 / (gamma - 1.0)
protected

◆ _tdgp1

float exaparty.api.sphtools.riemann.RiemannSolver._tdgp1 = 2.0 / (gamma + 1.0)
protected

◆ _tgdgm1

float exaparty.api.sphtools.riemann.RiemannSolver._tgdgm1 = 2.0 * gamma / (gamma - 1.0)
protected

The documentation for this class was generated from the following file: