SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean - PalenzuelaEtAl.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 14.3 % 7 1
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            0 : // 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              : #include "Evolution/Systems/GrMhd/ValenciaDivClean/PrimitiveRecoveryData.hpp"
      12              : 
      13              : /// \cond
      14              : namespace EquationsOfState {
      15              : template <bool, size_t>
      16              : class EquationOfState;
      17              : }  // namespace EquationsOfState
      18              : namespace grmhd::ValenciaDivClean {
      19              : class PrimitiveFromConservativeOptions;
      20              : }  // namespace grmhd::ValenciaDivClean
      21              : /// \endcond
      22              : 
      23              : namespace grmhd::ValenciaDivClean::PrimitiveRecoverySchemes {
      24              : 
      25              : /*!
      26              :  * \brief Compute the primitive variables from the conservative variables using
      27              :  * the scheme of [Palenzuela et al, Phys. Rev. D 92, 044045
      28              :  * (2015)](https://doi.org/10.1103/PhysRevD.92.044045).
      29              :  *
      30              :  * In the notation of the Palenzuela paper, `tau` is \f$D q\f$,
      31              :  * `momentum_density_squared` is \f$r^2 D^2\f$,
      32              :  * `momentum_density_dot_magnetic_field` is \f$t D^{\frac{3}{2}}\f$,
      33              :  * `magnetic_field_squared` is \f$s D\f$, and
      34              :  * `rest_mass_density_times_lorentz_factor` is \f$D\f$.
      35              :  * Furthermore, the returned `PrimitiveRecoveryData.rho_h_w_squared` is \f$x
      36              :  * D\f$.  Note also that \f$h\f$ in the Palenzuela paper is the specific
      37              :  * enthalpy times the rest mass density.
      38              :  *
      39              :  * In terms of the conservative variables (in our notation):
      40              :  * \f{align*}
      41              :  * q = & \frac{{\tilde \tau}}{{\tilde D}} \\
      42              :  * r = & \frac{\gamma^{mn} {\tilde S}_m {\tilde S}_n}{{\tilde D}^2} \\
      43              :  * t^2 = & \frac{({\tilde B}^m {\tilde S}_m)^2}{{\tilde D}^3 \sqrt{\gamma}} \\
      44              :  * s = & \frac{\gamma_{mn} {\tilde B}^m {\tilde B}^n}{{\tilde D}\sqrt{\gamma}}
      45              :  * \f}
      46              :  *
      47              :  * where the conserved variables \f${\tilde D}\f$, \f${\tilde S}_i\f$,
      48              :  * \f${\tilde \tau}\f$, and \f${\tilde B}^i\f$ are a generalized mass-energy
      49              :  * density, momentum density, specific internal energy density, and magnetic
      50              :  * field, and \f$\gamma\f$ and \f$\gamma^{mn}\f$ are the determinant and inverse
      51              :  * of the spatial metric \f$\gamma_{mn}\f$.
      52              :  */
      53            1 : class PalenzuelaEtAl {
      54              :  public:
      55              :   template <bool EnforcePhysicality, typename EosType>
      56            0 :   static std::optional<PrimitiveRecoveryData> apply(
      57              :       double /*initial_guess_pressure*/, double tau,
      58              :       double momentum_density_squared,
      59              :       double momentum_density_dot_magnetic_field, double magnetic_field_squared,
      60              :       double rest_mass_density_times_lorentz_factor, double electron_fraction,
      61              :       const EosType& equation_of_state,
      62              :       const grmhd::ValenciaDivClean::PrimitiveFromConservativeOptions&
      63              :           primitive_from_conservative_options);
      64              : 
      65            0 :   static const std::string name() { return "PalenzuelaEtAl"; }
      66              : 
      67              :  private:
      68            0 :   static constexpr size_t max_iterations_ = 100;
      69            0 :   static constexpr double absolute_tolerance_ =
      70              :       10.0 * std::numeric_limits<double>::epsilon();
      71            0 :   static constexpr double relative_tolerance_ =
      72              :       10.0 * std::numeric_limits<double>::epsilon();
      73              : };
      74              : }  // namespace grmhd::ValenciaDivClean::PrimitiveRecoverySchemes
        

Generated by: LCOV version 2.0-1