pttools.bubble.boundary

Functions for calculating the properties of the bubble boundaries

(Source code, png, hires.png, pdf)

../../_images/vm_vp_plane.png

Classes

class pttools.bubble.boundary.Phase(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: float, Enum

In general the phase is a scalar variable (a real number), and therefore also these values are floats.

BROKEN = 1.0
SYMMETRIC = 0.0
class pttools.bubble.boundary.SolutionType(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

There are three different types of relativistic combustion. For further details, please see chapter 7.2 and figure 14 of Hindmarsh et al., 2021.

(Source code, png, hires.png, pdf)

../../_images/relativistic_combustion.png
DETON = 'Detonation'

In a detonation the fluid outside the bubble is at rest and the wall moves at a supersonic speed.

ERROR = 'Error'

This value is used to inform, that determining the type of the relativistic combustion failed.

HYBRID = 'Hybrid'

In the hybrid case the wall speed is supersonic and the fluid is moving both ahead and behind the wall.

SUB_DEF = 'Subsonic deflagration'

In a subsonic deflagration the fluid is at rest inside the bubble, and the wall moves at a subsonic speed.

UNKNOWN = 'Unknown'

This value is used, when the type of the relativistic combustion is not yet determined.

Functions

pttools.bubble.boundary.check_entropy_fluxes(model, v1_tilde, v2_tilde, w1, w2, phase1, phase2, allow_negative_entropy_flux_change=False)

False = OK, True = fail

Parameters:
  • model (Model)

  • v1_tilde (float)

  • v2_tilde (float)

  • w1 (float)

  • w2 (float)

  • phase1 (Phase)

  • phase2 (float)

  • allow_negative_entropy_flux_change (bool)

Return type:

Tuple[bool, float, float]

pttools.bubble.boundary.enthalpy_ratio(v_m, v_p)

Ratio of enthalpies behind (\(w_-\)) and ahead \((w_+)\) of a shock or transition front, \(w_-/w_+\). Uses conservation of momentum in moving frame.

\[\frac{\gamma^2 (v_m) v_m}{\gamma^2 (v_p) v_p}\]

Parameters:
  • v_m (float | float64 | ndarray) – \(v_-\)

  • v_p (float | float64 | ndarray) – \(v_+\)

Returns:

enthalpy ratio

Return type:

float | float64 | ndarray

pttools.bubble.boundary.entropy_flux(v_tilde, s)
Parameters:
pttools.bubble.boundary.fluid_speeds_at_wall(v_wall, alpha_p, sol_type)

Solves fluid speed boundary conditions at the wall to obtain the fluid speeds both in the universe (plasma frame): \(v_+\) and \(v_+\) and in the wall frame: \(\tilde{v}_+, \tilde{v}_-\).

Bag model only!

The abbreviations are: fluid speed (vf) just behind (m=minus) and just ahead (p=plus) of wall, in wall (_w) and plasma/universe (_p) frames.

TODO: add a validity check for v_minus

Parameters:
  • v_wall (float) – \(v_\text{wall}\)

  • alpha_p (float | float64 | ndarray) – \(\alpha_+\)

  • sol_type (SolutionType) – solution type

Returns:

\(\tilde{v}_+,\tilde{v}_-,v_+,v_-\)

Return type:

Tuple[float, float, float, float]

pttools.bubble.boundary.get_phase(xi, v_w)

Returns array indicating phase of system. in symmetric phase \((\xi > v_w)\), phase = 0 in broken phase \((\xi < v_w)\), phase = 1

Returns:

phase

Parameters:
  • xi (float | float64 | ndarray)

  • v_w (float)

Return type:

float | float64 | ndarray | callable | CPUDispatcher

pttools.bubble.boundary.junction_condition_deviation1(v1, w1, v2, w2)

Deviation from the first junction condition

\[w_- \tilde{\gamma}_-^2 \tilde{v}_- - w_+ \tilde{\gamma}_-^2 \tilde{v}_+\]
Hindmarsh et al., 2021, eq. 7.22

Parameters:
Return type:

float | float64 | ndarray

pttools.bubble.boundary.junction_condition_deviation2(v1, w1, p1, v2, w2, p2)

Deviation from the second junction condition

\[w_1 \tilde{\gamma}_1^2 \tilde{v}_1^2 + p_1 - w_2 \tilde{\gamma}_2^2 \tilde{v}_2^2 - p_2\]
Hindmarsh et al., 2021, eq. 7.22

Parameters:
pttools.bubble.boundary.junction_conditions_deviation(vp, vm, ap)

Deviation from the combined junction conditions

\[\Delta = \left( \frac{1}{\tilde{v}_-} + 3\tilde{v}_- \right) \tilde{v}_+ - 3(1 + \alpha_+) \tilde{v}_+^2 - \alpha_+ + 1\]

Parameters:
Return type:

float | float64 | ndarray

pttools.bubble.boundary.junction_conditions_solvable(params, model, v1, w1, phase1, phase2)

Get the deviation from both boundary conditions simultaneously.

Parameters:
  • params (ndarray)

  • model (Model)

  • v1 (float)

  • w1 (float)

  • phase1 (float)

  • phase2 (float)

pttools.bubble.boundary.solve_junction(model, v1_tilde, w1, phase1, phase2, v2_tilde_guess, w2_guess, v2_tilde_min=None, v2_tilde_max=None, w2_min=None, w2_max=None, allow_failure=False, allow_negative_entropy_flux_change=False, rtol=const.JUNCTION_RTOL)

Model-independent junction condition solver Velocities are in the wall frame!

Parameters:
  • model (Model)

  • v1_tilde (float)

  • w1 (float)

  • phase1 (Phase)

  • phase2 (Phase)

  • v2_tilde_guess (float)

  • w2_guess (float)

  • v2_tilde_min (float)

  • v2_tilde_max (float)

  • w2_min (float)

  • w2_max (float)

  • allow_failure (bool)

  • allow_negative_entropy_flux_change (bool)

  • rtol (float)

Return type:

Tuple[float, float]

pttools.bubble.boundary.solve_junction_internal(model, v1_tilde, w1, phase1, phase2, v2_tilde_guess, w2_guess)
Parameters:
  • model (Model)

  • v1_tilde (float)

  • w1 (float)

  • phase1 (Phase)

  • phase2 (Phase)

  • v2_tilde_guess (float)

  • w2_guess (float)

Return type:

Tuple[ndarray, dict, int, str]

pttools.bubble.boundary.v_minus(vp, ap, sol_type=SolutionType.DETON, strong_branch=False, debug=False)

Fluid speed \(\tilde{v}_-\) behind the wall in the wall frame

\[\tilde{v}_- = \frac{1}{2} \left[ \left( (1 + \alpha_+)\tilde{v}_+ + \frac{1 - 3\alpha_+}{3 \tilde{v}_+} \right) \pm \sqrt{ \left( (1 + \alpha_+)\tilde{v}_+ + \frac{1 - 3\alpha_+}{3 \tilde{v}_+} \right)^2 - \frac{4}{3} } \right]\]
Hindmarsh et al., 2019, eq. B.7

Positive sign is for detonations, which corresponds to \(\tilde{v}_+ < \frac{1}{\sqrt{3}}\) in the bag model. TODO Check that this is actually the case.

Parameters:
  • vp (float | float64 | ndarray) – \(\tilde{v}_+\), fluid speed ahead of the wall

  • ap (float) – \(\alpha_+\), strength parameter at the wall

  • sol_type (SolutionType) – Detonation, Deflagration, Hybrid (assumed detonation if not given)

  • strong_branch (bool)

  • debug (bool)

Returns:

\(\tilde{v}_-\), fluid speed behind the wall

Return type:

float | float64 | ndarray | callable | CPUDispatcher

pttools.bubble.boundary.v_plus(vm, ap, sol_type, debug=True)

Fluid speed \(\tilde{v}_+\) ahead of the wall in the wall frame

\[\tilde{v}_+ = \frac{1}{2(1 + \alpha_+)} \left[ \left( \frac{1}{3 \tilde{v}_-} + \tilde{v}_- \right) \pm \sqrt{ \left( \frac{1}{3\tilde{v}_-} - \tilde{v}_- \right)^2 + 4\alpha_+^2 + \frac{8}{3} \alpha_+} \right]\]
Hindmarsh et al., 2019, eq. B.6, Hindmarsh et al., 2021, eq. 7.27. The equations in both sources are equivalent by moving a factor of 2.

Positive sign is for detonations, which corresponds to \(\tilde{v}_- > \frac{1}{\sqrt{3}}\) in the bag model.

Parameters:
  • vm (float | float64 | ndarray) – \(\tilde{v}_-\), fluid speed behind the wall

  • ap (float) – \(\alpha_+\), strength parameter at the wall

  • sol_type (SolutionType) – Detonation, Deflagration, Hybrid

  • debug (bool)

Returns:

\(\tilde{v}_+\), fluid speed ahead of the wall

Return type:

float | float64 | ndarray | callable | CPUDispatcher

pttools.bubble.boundary.v_plus_hybrid(model, v_wall, wm, vp_tilde_guess, wp_guess, allow_failure=False, allow_negative_entropy_flux_change=False)

Find \(v_+\) for a hybrid

Parameters:
  • model (Model)

  • v_wall (float)

  • wm (float)

  • vp_tilde_guess (float)

  • wp_guess (float)

  • allow_failure (bool)

  • allow_negative_entropy_flux_change (bool)

Return type:

float

pttools.bubble.boundary.v_plus_limit(ap, sol_type)

Limit for the values that \(\tilde{v}_+\) can have.

TODO this is the Chapman-Jouguet speed, not a separate limit!

$$frac{1}{1+alpha_+} left( frac{1}{sqrt{3}} pm sqrt{alpha_+ ( alpha_+ + frac{2}{3})} right)

Parameters:
Return type:

float | float64 | ndarray

pttools.bubble.boundary.v_plus_off_limits(vp, ap, sol_type)
Parameters:
pttools.bubble.boundary.w2_junction(v1, w1, v2)

Get \(w_-\) from the junction condition 1

\[w_1 = w_2 \frac{\tilde{\gamma}_2^2 \tilde{v}_2}{\tilde{\gamma}_1^2 \tilde{v}_1}\]
Hindmarsh et al., 2021, eq. 7.22

Parameters:
Return type:

float | float64 | ndarray