Skip to content

Sod Shock Tube

 import minuteman.cpg.shock_tube as shock_tube

Solve the 1D Sod shock tube problem

High-level API

minuteman.cpg.shock_tube.solve_sod

solve_sod(
    time: Floatlike,
    pressure_l: Floatlike,
    pressure_r: Floatlike,
    density_l: Floatlike,
    density_r: Floatlike,
    specific_heat_ratio_l: Floatlike = 1.4,
    specific_heat_ratio_r: Floatlike = 1.4,
    gas_constant_l: Floatlike = thermo.gas_constant_air_si,
    gas_constant_r: Floatlike = thermo.gas_constant_air_si,
    tube_length: Floatlike = 20.0,
    position: NDArrayFloat | None = None,
) -> ShockTubeSolution

Computes Sod shock tube problem. Both gases initially stagnant, with the contact surface centered in the tube at x=0.

Parameters:

  • time (Floatlike) –

    time, \(t\). Bounds: \((0, \infty)\)

  • pressure_l (Floatlike) –

    pressure on left hand side (LHS), \(p_L\). Bounds: \((0, \infty)\)

  • pressure_r (Floatlike) –

    pressure on right hand side (RHS), \(p_R\). Bounds: \((0, \infty)\)

  • density_l (Floatlike) –

    density on LHS, \(\rho_L\). Bounds: \((0, \infty)\)

  • density_r (Floatlike) –

    density on RHS, \(\rho_R\). Bounds: \((0, \infty)\)

  • specific_heat_ratio_l (Floatlike, default: 1.4 ) –

    ratio of specific heats on LHS, \(\gamma_L\). Bounds: \([1.0, 1.67]\)

  • specific_heat_ratio_r (Floatlike, default: 1.4 ) –

    ratio of specific heats on RHS, \(\gamma_R\). Bounds: \([1.0, 1.67]\)

  • gas_constant_l (Floatlike, default: gas_constant_air_si ) –

    specific gas constant on LHS, \(R_L\). Bounds: \((0, \infty)\)

  • gas_constant_r (Floatlike, default: gas_constant_air_si ) –

    specific gas constant on RHS, \(R_R\). Bounds: \((0, \infty)\)

  • tube_length (Floatlike, default: 20.0 ) –

    Length of shock tube. Defaults to 20.0, the Sod problem #1 length. Bounds: \((0, \infty)\)

  • position (NDArrayFloat | None, default: None ) –

    explicit positions along the shock tube to evaluate. This is helpful when comparing to a CFD grid directly. Defaults to None where values are chosen based upon critical points.

Returns:

Raises:

  • OutOfBoundsError –

    invalid inputs

Low-level API

minuteman.cpg.shock_tube.contact_surface_speed

contact_surface_speed(
    pressure_ratio: Floatlike,
    speed_of_sound_driven: Floatlike,
    specific_heat_ratio_driven: Floatlike,
) -> Floatlike

Compute the speed of the contact surface/piston \(u_p\) in a shock tube, or the speed of the mass motion induced by the incident shock (Eq. 7.16 in 1).

For \(\gamma_1=1.4\), as the pressure ratio approaches infinity, the Mach number approaches 1.89.

Parameters:

  • pressure_ratio (Floatlike) –

    static pressure ratio across shock, \(p_2 / p_1\)

  • speed_of_sound_driven (Floatlike) –

    speed of sound of driven gas, \(a_1\)

  • specific_heat_ratio_driven (Floatlike) –

    ratio of specific heats for the driven gas, \(\gamma_1\)

Returns: Contact surface or piston speed, \(u_p\)

minuteman.cpg.shock_tube.expansion_fan_speed_of_sound

expansion_fan_speed_of_sound(
    speed_of_sound_driver: Floatlike, velocity: NDArrayFloat, specific_heat_ratio_driver: Floatlike
) -> NDArrayFloat

Compute speed of sound within expansion fan \(a\)[^1]

Parameters:

  • speed_of_sound_driver (Floatlike) –

    speed of sound of driver gas, \(a_4\)

  • velocity (NDArrayFloat) –

    velocity within the expansion fan

  • specific_heat_ratio_driver (Floatlike) –

    ratio of specific heats of driver gas, \(\gamma_4\)

Returns:

  • NDArrayFloat –

    Speed of sound within expansion fan, \(a\)

minuteman.cpg.shock_tube.expansion_fan_velocity

expansion_fan_velocity(
    speed_of_sound_driver: Floatlike,
    position: NDArrayFloat,
    time: Floatlike,
    specfic_heat_ratio_driver: Floatlike,
) -> NDArrayFloat

Compute the velocity within the expansion fan of a shock tube \(u\) (Eq. 7.89 in 1).

Parameters:

  • speed_of_sound_driver (Floatlike) –

    speed of sound of driver gas, \(a_4\)

  • position (NDArrayFloat) –

    position within expansion fan, \(x\)

  • time (Floatlike) –

    time \(t\)

  • specfic_heat_ratio_driver (Floatlike) –

    ratio of specific heats of driver gas, \(\gamma_4\)

Returns:

minuteman.cpg.shock_tube.moving_shock_density_ratio

moving_shock_density_ratio(
    pressure_ratio: Floatlike, specific_heat_ratio_driven: Floatlike
) -> Floatlike

Compute the density ratio \(\rho_2 / \rho_1\) ratio across a moving normal shock (Eq. 7.11 in 1).

Parameters:

  • pressure_ratio (Floatlike) –

    static pressure ratio across shock, \(p_2 / p_1\)

  • specific_heat_ratio_driven (Floatlike) –

    ratio of specific heats for the driven gas, \(\gamma_1\)

Returns:

  • Floatlike –

    Density ratio, \(\rho_2 / \rho_1\)

minuteman.cpg.shock_tube.moving_shock_pressure_ratio

moving_shock_pressure_ratio(
    pressure_ratio: Floatlike,
    speed_of_sound_ratio: Floatlike,
    specific_heat_ratio_driver: Floatlike,
    specific_heat_ratio_driven: Floatlike,
) -> Floatlike

Solve for the pressure ratio across a moving normal shock in a shock tube, \(p_2 / p_1\) (Eq. 7.94 in 1).

Parameters:

  • pressure_ratio (Floatlike) –

    pressure ratio between the driver and driven gas, \(p_4 / p_1\)

  • speed_of_sound_ratio (Floatlike) –

    speed of sound ratio between the driver and driven gas, \(a_4 / a_1\)

  • specific_heat_ratio_driver (Floatlike) –

    ratio of specific heats for the driver gas, \(\gamma_4\)

  • specific_heat_ratio_driven (Floatlike) –

    ratio of specific heats for the driven gas, \(\gamma_1\)

Returns:

  • Floatlike –

    Pressure ratio \(p_2 / p_1\) across the moving normal shock

minuteman.cpg.shock_tube.moving_shock_speed

moving_shock_speed(
    pressure_ratio: Floatlike,
    speed_of_sound_driven: Floatlike,
    specific_heat_ratio_driven: Floatlike,
) -> Floatlike

Compute the shock speed \(w\) of the moving shock (Eq. 7.14 in 1).

Parameters:

  • pressure_ratio (Floatlike) –

    static pressure ratio across shock, \(p_2 / p_1\)

  • speed_of_sound_driven (Floatlike) –

    speed of sound of driven gas, \(a_1\)

  • specific_heat_ratio_driven (Floatlike) –

    ratio of specific heats for the driven gas, \(\gamma_1\)

Returns:

  • Floatlike –

    Wave velocity of the moving shock wave, \(w\)

minuteman.cpg.shock_tube.moving_shock_temperature_ratio

moving_shock_temperature_ratio(
    pressure_ratio: Floatlike, specific_heat_ratio_driven: Floatlike
) -> Floatlike

Compute the static temperature \(T_2 / T_1\) ratio across a moving normal shock (Eq. 7.10 in 1).

Parameters:

  • pressure_ratio (Floatlike) –

    static pressure ratio across shock, \(p_2 / p_1\)

  • specific_heat_ratio_driven (Floatlike) –

    ratio of specific heats for the driven gas, \(\gamma_1\)

Returns:

  • Floatlike –

    Static temperature ratio, \(T_2 / T_1\)

Data Structures

minuteman.cpg.shock_tube.ShockTubeSolution dataclass

Solution to the Sod Shock tube

position: NDArrayFloat instance-attribute

Position in the shock tube, \(x\)

time: Floatlike instance-attribute

Time, \(t\)

pressure: NDArrayFloat instance-attribute

Pressure, \(p\)

density: NDArrayFloat instance-attribute

Density, \(\rho\)

temperature: NDArrayFloat instance-attribute

Temperature, \(T\)

specific_heat_ratio: NDArrayFloat instance-attribute

Ratio of specific heats, \(\gamma\)

gas_constant: NDArrayFloat instance-attribute

Specific gas constant, \(R\)

mach: NDArrayFloat instance-attribute

Mach number, \(M\)

velocity: NDArrayFloat instance-attribute

Velocity, \(v\)

speed_of_sound: NDArrayFloat instance-attribute

Speed of sound, \(a\)

entropy: NDArrayFloat instance-attribute

Entropy, \(s\)

internal_energy: NDArrayFloat instance-attribute

Specific internal energy, \(e\)

enthalpy: NDArrayFloat instance-attribute

Specific internal enthalpy, \(h\)

total_energy: NDArrayFloat instance-attribute

Total energy per unit volume, \(E_t\)

region_1: NDArrayBool instance-attribute

Region 1 solution mask

region_2: NDArrayBool instance-attribute

Region 2 solution mask

region_3: NDArrayBool instance-attribute

Region 3 solution mask

region_4: NDArrayBool instance-attribute

Region 4 solution mask

region_5: NDArrayBool instance-attribute

Region 5 solution mask

References

  1. Anderson, J. D., Jr. (2003). Modern compressible flow: With historical perspective (3rd ed.). McGraw-Hill.