KastaunEtAl.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <limits>
8 #include <optional>
9 #include <string>
10 
11 /// \cond
12 namespace EquationsOfState {
13 template <bool, size_t>
14 class EquationOfState;
15 } // namespace EquationsOfState
16 /// \endcond
17 
19 
20 /// \cond
22 /// \endcond
23 
24 /*!
25  * \brief Compute the primitive variables from the conservative variables using
26  * the scheme of \cite Kastaun2020uxr.
27  *
28  * In the notation of the Kastaun paper, `total_energy_density` is \f$D
29  * (1+q)\f$, `momentum_density_squared` is \f$r^2 D^2\f$,
30  * `momentum_density_dot_magnetic_field` is \f$t D^{\frac{3}{2}}\f$,
31  * `magnetic_field_squared` is \f$s D\f$, and
32  * `rest_mass_density_times_lorentz_factor` is \f$D\f$.
33  * Furthermore, the returned `PrimitiveRecoveryData.rho_h_w_squared` is \f$x
34  * D\f$.
35  *
36  * In terms of the conservative variables (in our notation):
37  * \f{align*}
38  * q = & \frac{{\tilde \tau}}{{\tilde D}} \\
39  * r = & \frac{\gamma^{kl} {\tilde S}_k {\tilde S}_l}{{\tilde D}^2} \\
40  * t^2 = & \frac{({\tilde B}^k {\tilde S}_k)^2}{{\tilde D}^3 \sqrt{\gamma}} \\
41  * s = & \frac{\gamma_{kl} {\tilde B}^k {\tilde B}^l}{{\tilde D}\sqrt{\gamma}}
42  * \f}
43  *
44  * where the conserved variables \f${\tilde D}\f$, \f${\tilde S}_i\f$,
45  * \f${\tilde \tau}\f$, and \f${\tilde B}^i\f$ are a generalized mass-energy
46  * density, momentum density, specific internal energy density, and magnetic
47  * field, and \f$\gamma\f$ and \f$\gamma^{kl}\f$ are the determinant and inverse
48  * of the spatial metric \f$\gamma_{kl}\f$.
49  *
50  * \note This scheme does not use the initial guess for the pressure.
51  */
52 class KastaunEtAl {
53  public:
54  template <size_t ThermodynamicDim>
56  double initial_guess_pressure, double total_energy_density,
57  double momentum_density_squared,
58  double momentum_density_dot_magnetic_field, double magnetic_field_squared,
59  double rest_mass_density_times_lorentz_factor,
61  equation_of_state) noexcept;
62 
63  static const std::string name() noexcept { return "KastaunEtAl"; }
64 
65  private:
66  static constexpr size_t max_iterations_ = 100;
67  static constexpr double absolute_tolerance_ =
69  static constexpr double relative_tolerance_ =
71 };
72 } // namespace grmhd::ValenciaDivClean::PrimitiveRecoverySchemes
EquationsOfState
Contains all equations of state, including base class.
Definition: DarkEnergyFluid.hpp:26
std::string
EquationsOfState::EquationOfState
Base class for equations of state depending on whether or not the system is relativistic,...
Definition: EquationOfState.hpp:63
grmhd::ValenciaDivClean::PrimitiveRecoverySchemes::KastaunEtAl
Compute the primitive variables from the conservative variables using the scheme of .
Definition: KastaunEtAl.hpp:52
cstddef
std::numeric_limits::epsilon
T epsilon(T... args)
grmhd::ValenciaDivClean::PrimitiveRecoverySchemes::PrimitiveRecoveryData
Data determined by PrimitiveRecoverySchemes at a single grid point.
Definition: PrimitiveRecoveryData.hpp:19
limits
optional
grmhd::ValenciaDivClean::PrimitiveRecoverySchemes
Schemes for recovering primitive variables from conservative variables.
Definition: KastaunEtAl.hpp:18
string