pttools.models.bag

Bag model

Classes

class pttools.models.bag.BagModel(V_s=AnalyticModel.DEFAULT_V_S, V_b=AnalyticModel.DEFAULT_V_B, a_s=None, a_b=None, g_s=None, g_b=None, T_min=None, T_max=None, alpha_n_min=None, name=None, label_latex=None, label_unicode=None, allow_invalid=False, auto_potential=False, log_info=True)

Bases: AnalyticModel

Bag equation of state. This is one of the simplest equations of state for a relativistic plasma. Each integration corresponds to a line on the figure below (fig. 9 of Hindmarsh et al., 2019).

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

../../_images/xi_v_plane.png
Parameters:
  • V_s (float)

  • V_b (float)

  • a_s (float)

  • a_b (float)

  • g_s (float)

  • g_b (float)

  • T_min (float)

  • T_max (float)

  • alpha_n_min (float)

  • name (str)

  • label_latex (str)

  • label_unicode (str)

  • allow_invalid (bool)

  • auto_potential (bool)

  • log_info (bool)

DEFAULT_LABEL_LATEX: str = 'Bag model'
DEFAULT_LABEL_UNICODE: str = 'Bag model'
DEFAULT_NAME: str = 'bag'
TEMPERATURE_IS_PHYSICAL: bool = False

Whether the temperature is in proper physics units

alpha_n(wn, error_on_invalid=True, nan_on_invalid=True, log_invalid=True)

Transition strength parameter \(\alpha_+\), Hindmarsh et al., 2021, eq. 7.25.

\[\alpha_+ = \frac{4}{3w_+}(V_s - V_b)\]

Parameters:
  • wp\(w_+\), enthalpy ahead of the wall

  • wm\(w_-\), enthalpy behind the wall (not used)

  • error_on_invalid (bool) – raise error for invalid values

  • nan_on_invalid (bool) – return nan for invalid values

  • log_invalid (bool) – whether to log invalid values

  • wn (float | float64 | ndarray)

Return type:

float | float64 | ndarray

alpha_n_min_find(w_min=None, w_max=None)

Find \(\text{min} \alpha_n(w)\) for \(w \in ({w}_\text{min}, {w}_\text{max})\)

Parameters:
  • w_min (float)

  • w_max (float)

Return type:

Tuple[float, float]

classmethod alpha_n_min_find_params(alpha_n_min_target, a_s_default=None, a_b=1, V_s=None, V_b=0, safety_factor_alpha=None)

Find the model parameters that allow the given \(\alpha_{n,\text{min,target}}\)

Parameters:
  • alpha_n_min_target (float)

  • a_s_default (float)

  • a_b (float)

  • V_s (float)

  • V_b (float)

  • safety_factor_alpha (float)

Return type:

Tuple[float, float, float, float]

alpha_plus(wp, wm, vp_tilde=None, sol_type=None, error_on_invalid=True, nan_on_invalid=True, log_invalid=True)

Transition strength parameter \(\alpha_+\), Hindmarsh et al., 2021, eq. 7.25.

\[\alpha_+ = \frac{4}{3w_+}(V_s - V_b)\]

Parameters:
  • wp (float | float64 | ndarray) – \(w_+\), enthalpy ahead of the wall

  • wm (float | float64 | ndarray) – \(w_-\), enthalpy behind the wall (not used)

  • error_on_invalid (bool) – raise error for invalid values

  • nan_on_invalid (bool) – return nan for invalid values

  • log_invalid (bool) – whether to log invalid values

  • vp_tilde (float)

  • sol_type (SolutionType)

Return type:

float | float64 | ndarray

alpha_theta_bar_n(wn, error_on_invalid=True, nan_on_invalid=True, log_invalid=True)

Transition strength parameter, Giese et al., 2021, eq. 13

\[\alpha_{\bar{\theta}+} = \frac{D \bar{\theta}(T_n)}{3 w_n}\]

Parameters:
  • wn (float | float64 | ndarray)

  • error_on_invalid (bool)

  • nan_on_invalid (bool)

  • log_invalid (bool)

Return type:

float | float64 | ndarray

alpha_theta_bar_plus(wp, error_on_invalid=True, nan_on_invalid=True, log_invalid=True)

Transition strength parameter, Giese et al., 2021, eq. 9

\[\alpha_{\bar{\theta}+} = \frac{D \bar{\theta}(T_+)}{3 w_+}\]

Parameters:
  • wp (float | float64 | ndarray)

  • error_on_invalid (bool)

  • nan_on_invalid (bool)

  • log_invalid (bool)

Return type:

float | float64 | ndarray

critical_temp(**kwargs)

Critical temperature for the bag model

\[T_{cr} = \sqrt[4]{\frac{V_s - V_b}{a_s - a_b}}\]
Note that Giese et al., 2020 p. 6 is using a different convention.

Return type:

float

static cs2(w=None, phase=None)

Sound speed squared, \(c_s^2=\frac{1}{3}\). Hindmarsh et al., 2021, p. 37, Relativistic hydrodynamics, Rezzolla, Zanotti, 2013, eq. 2.207

Parameters:
Return type:

float | float64 | ndarray

cs2_max(w_max, phase, w_min=0, allow_fail=False, **kwargs)
Parameters:
  • w_max (float)

  • phase (Phase)

  • w_min (float)

  • allow_fail (bool)

Return type:

Tuple[float, float]

cs2_min(w_max, phase, w_min=0, allow_fail=False, **kwargs)
Parameters:
  • w_max (float)

  • phase (Phase)

  • w_min (float)

  • allow_fail (bool)

Return type:

Tuple[float, float]

static cs2_neg(w=None, phase=None)

Speed of sound squared with a minus sign. This is needed for finding the maximum of cs2.

Parameters:
Return type:

float | float64 | ndarray

static cs2_temp(temp, phase)
delta_theta(wp, wm, error_on_invalid=True, nan_on_invalid=True, log_invalid=True)
Parameters:
  • wp (float | float64 | ndarray)

  • wm (float | float64 | ndarray)

  • error_on_invalid (bool)

  • nan_on_invalid (bool)

  • log_invalid (bool)

Return type:

float | float64 | ndarray

df_dtau_ptr()
Return type:

(float64, float64*, float64*, float64*) -> none*

e_temp(temp, phase)

Energy density as a function of temperature, Giese et al., 2021 eq. 15, Borsanyi et al., 2016, eq. S12 The convention for \(a_s\) and \(a_b\) is that of Hindmarsh et al., 2021, eq. 7.33.

Parameters:
Return type:

float | float64 | ndarray

p_temp(temp, phase)

Pressure \(p(T,\phi)\), Hindmarsh et al., 2021, eq. 5.14, 7.1, 7.33, Giese et al., 2021, eq. 18

\[p_s = a_s T^4\]
\[p_b = a_b T^4\]
The convention for \(a_s\) and \(a_b\) is that of Hindmarsh et al., 2021 eq. 7.33.

Parameters:
Return type:

float | float64 | ndarray

params_str()

Model parameters as a string

Return type:

str

s_temp(temp, phase)

Entropy density \(s=\frac{dp}{dT}\)

\[s_s = 4 a_s T^3\]
\[s_b = 4 a_b T^3\]
Derived from Hindmarsh et al., 2021 eq. 7.33.

Parameters:
Return type:

float | float64 | ndarray

solution_type(v_wall, alpha_n, wn=None, wn_guess=None, wm_guess=None)
Parameters:
  • v_wall (float)

  • alpha_n (float)

  • wn (float)

  • wn_guess (float)

  • wm_guess (float)

Return type:

SolutionType

temp(w, phase)

Temperature \(T(w,\phi)\). Inverted from

\[T(w) = \sqrt[4]{\frac{w}{4a(\phi)}}\]

Parameters:
  • w (float | float64 | ndarray) – enthalpy \(w\)

  • phase (float | float64 | ndarray) – phase \(\phi\)

Returns:

temperature \(T(w,\phi)\)

Return type:

float | float64 | ndarray

theta(w, phase)

Trace anomaly $ heta$

For the bag model the trace anomaly $ heta$ does not depend on the enthalpy.

Parameters:
Return type:

float | float64 | ndarray

static v_shock(xi)

Velocity at the shock, Hindmarsh et al., 2019 eq. B.17

\[v_\text{sh}(\xi) = \frac{3\xi^22 - 1}{2\xi}\]

Parameters:

xi (float | float64 | ndarray)

Return type:

float | float64 | ndarray

w(temp, phase)

Enthalpy \(w(T)\)

\[w(T) = 4a(\phi)T^4\]

Parameters:
  • temp (float | float64 | ndarray) – temperature \(T\)

  • phase (float | float64 | ndarray) – phase \(\phi\)

Return type:

float | float64 | ndarray

static w_shock(xi, w_n)

Enthalpy at the shock, Hindmarsh et al., 2019 eq. B.18

\[w_\text{sh}(\xi) = w_n \frac{9\xi^2 - 1}{3(1-\xi^2)}\]

Parameters:
Return type:

float | float64 | ndarray

wn(alpha_n, wn_guess=1, analytical=True, theta_bar=False, error_on_invalid=True, nan_on_invalid=True, log_invalid=True)

Enthalpy at nucleation temperature

\[w_n = \frac{4}{3} \frac{V_s - V_b}{\alpha_n}\]
This can be derived from the equations for \(\theta\) and \(\alpha_n\).

Parameters:
  • alpha_n (float | float64 | ndarray)

  • wn_guess (float)

  • analytical (bool)

  • theta_bar (bool)

  • error_on_invalid (bool)

  • nan_on_invalid (bool)

  • log_invalid (bool)

Return type:

float | float64 | ndarray

Functions

pttools.models.bag.cs2_bag(w=None, phase=None)

Sound speed squared, \(c_s^2=\frac{1}{3}\). Hindmarsh et al., 2021, p. 37, Relativistic hydrodynamics, Rezzolla, Zanotti, 2013, eq. 2.207

Parameters:
Return type:

float | float64 | ndarray