SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean - NewmanHamlin.hpp Hit Total Coverage
Commit: 318ae36d2001e2abec5256f34415b420007ed6cc Lines: 1 6 16.7 %
Date: 2024-07-18 18:43:07
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 <optional>
       8             : #include <string>
       9             : 
      10             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/PrimitiveRecoveryData.hpp"
      11             : 
      12             : /// \cond
      13             : namespace EquationsOfState {
      14             : template <bool, size_t>
      15             : class EquationOfState;
      16             : }  // namespace EquationsOfState
      17             : namespace grmhd::ValenciaDivClean {
      18             : class PrimitiveFromConservativeOptions;
      19             : }  // namespace grmhd::ValenciaDivClean
      20             : /// \endcond
      21             : 
      22             : namespace grmhd::ValenciaDivClean::PrimitiveRecoverySchemes {
      23             : 
      24             : /*!
      25             :  * \brief Compute the primitive variables from the conservative variables using
      26             :  * the scheme of [Newman and Hamlin, SIAM J. Sci. Comput., 36(4)
      27             :  * B661-B683 (2014)](https://epubs.siam.org/doi/10.1137/140956749).
      28             :  *
      29             :  * In the Newman and Hamlin paper, `tau` is \f$e - \rho W\f$,
      30             :  * `momentum_density_squared` is\f${\cal M}^2\f$,
      31             :  * `momentum_density_dot_magnetic_field` is \f${\cal T}\f$,
      32             :  * `magnetic_field_squared` is \f${\cal B}^2\f$, and
      33             :  * `rest_mass_density_times_lorentz_factor` is \f${\tilde \rho}\f$.
      34             :  * Furthermore, the returned `PrimitiveRecoveryData.rho_h_w_squared` is \f${\cal
      35             :  * L}\f$.
      36             :  *
      37             :  * In terms of the conservative variables (in our notation):
      38             :  * \f{align}
      39             :  * e = & \frac{{\tilde D} + {\tilde \tau}}{\sqrt{\gamma}} \\
      40             :  * {\cal M}^2 = & \frac{\gamma^{mn} {\tilde S}_m {\tilde S}_n}{\gamma} \\
      41             :  * {\cal T} = & \frac{{\tilde B}^m {\tilde S}_m}{\gamma} \\
      42             :  * {\cal B}^2 = & \frac{\gamma_{mn} {\tilde B}^m {\tilde B}^n}{\gamma} \\
      43             :  * {\tilde \rho} = & \frac{\tilde D}{\sqrt{\gamma}}
      44             :  * \f}
      45             :  *
      46             :  * where the conserved variables \f${\tilde D}\f$, \f${\tilde S}_i\f$,
      47             :  * \f${\tilde \tau}\f$, and \f${\tilde B}^i\f$ are a generalized mass-energy
      48             :  * density, momentum density, specific internal energy density, and magnetic
      49             :  * field, and \f$\gamma\f$ and \f$\gamma^{mn}\f$ are the determinant and inverse
      50             :  * of the spatial metric \f$\gamma_{mn}\f$.
      51             :  */
      52           1 : class NewmanHamlin {
      53             :  public:
      54             :   template <bool EnforcePhysicality, typename EosType>
      55           0 :   static std::optional<PrimitiveRecoveryData> apply(
      56             :       double initial_guess_for_pressure, double tau,
      57             :       double momentum_density_squared,
      58             :       double momentum_density_dot_magnetic_field, double magnetic_field_squared,
      59             :       double rest_mass_density_times_lorentz_factor, double electron_fraction,
      60             :       const EosType& equation_of_state,
      61             :       const grmhd::ValenciaDivClean::PrimitiveFromConservativeOptions&
      62             :           primitive_from_conservative_options);
      63             : 
      64           0 :   static const std::string name() { return "Newman Hamlin"; }
      65             : 
      66             :  private:
      67           0 :   static constexpr size_t max_iterations_ = 50;
      68           0 :   static constexpr double relative_tolerance_ = 1.e-10;
      69             : };
      70             : }  // namespace grmhd::ValenciaDivClean::PrimitiveRecoverySchemes

Generated by: LCOV version 1.14