SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean - ConservativeFromPrimitive.hpp Hit Total Coverage
Commit: a6a8ee404306bec9d92da8ab89f636b037aefc25 Lines: 1 5 20.0 %
Date: 2024-07-26 22:35:59
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 "DataStructures/Tensor/TypeAliases.hpp"
       7             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/TagsDeclarations.hpp"
       8             : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
       9             : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
      10             : #include "Utilities/TMPL.hpp"
      11             : 
      12             : /// \cond
      13             : namespace gsl {
      14             : template <typename T>
      15             : class not_null;
      16             : }  // namespace gsl
      17             : 
      18             : class DataVector;
      19             : /// \endcond
      20             : 
      21             : namespace grmhd {
      22             : namespace ValenciaDivClean {
      23             : 
      24             : /*!
      25             :  * \brief Compute the conservative variables from primitive variables
      26             :  *
      27             :  * \f{align*}
      28             :  * {\tilde D} = & \sqrt{\gamma} \rho W \\
      29             :  * {\tilde Y}_e = & \sqrt{\gamma} \rho Y_e W \\
      30             :  * {\tilde S}_i = & \sqrt{\gamma} \left( \rho h W^2 v_i + B^m B_m v_i - B^m v_m
      31             :  * B_i \right) \\
      32             :  * {\tilde \tau} = & \sqrt{\gamma} \left[ \rho h W^2 - p - \rho W - \frac{1}{2}
      33             :  * (B^m v_m)^2 + \frac{1}{2} B^m B_m \left( 1 + v^m v_m \right) \right] \\
      34             :  * {\tilde B}^i = & \sqrt{\gamma} B^i \\
      35             :  * {\tilde \Phi} = & \sqrt{\gamma} \Phi
      36             :  * \f}
      37             :  *
      38             :  * where the conserved variables \f${\tilde D}\f$, \f$\tilde{Y}_e\f$, \f${\tilde
      39             :  * S}_i\f$, \f${\tilde \tau}\f$, \f${\tilde B}^i\f$, and \f${\tilde \Phi}\f$ are
      40             :  * a generalized mass-energy density, electron fraction, momentum density,
      41             :  * specific internal energy density, magnetic field, and divergence cleaning
      42             :  * field.  Furthermore \f$\gamma\f$ is the determinant of the spatial metric,
      43             :  * \f$\rho\f$ is the rest mass density, \f$Y_e\f$ is the electron fraction,
      44             :  * \f$W = 1/\sqrt{1-v_i v^i}\f$ is the Lorentz factor, \f$h = 1 + \epsilon +
      45             :  * \frac{p}{\rho}\f$ is the specific enthalpy, \f$v^i\f$ is the spatial
      46             :  * velocity, \f$\epsilon\f$ is the specific internal energy, \f$p\f$ is the
      47             :  * pressure, \f$B^i\f$ is the spatial magnetic field measured by an Eulerian
      48             :  * observer, and \f$\Phi\f$ is a divergence cleaning field.
      49             :  *
      50             :  * The quantity \f${\tilde \tau}\f$ is rewritten as in `RelativisticEuler`
      51             :  * to avoid cancellation error in the non-relativistic limit:
      52             :  * \f[
      53             :  * \left( \rho h W^2 - p - \rho W \right) \longrightarrow
      54             :  *  W^2 \left[ \rho \left( \epsilon + v^2
      55             :  * \frac{W}{W + 1} \right) + p v^2 \right] .\f]
      56             :  */
      57           1 : struct ConservativeFromPrimitive {
      58           0 :   using return_tags = tmpl::list<grmhd::ValenciaDivClean::Tags::TildeD,
      59             :                                  grmhd::ValenciaDivClean::Tags::TildeYe,
      60             :                                  grmhd::ValenciaDivClean::Tags::TildeTau,
      61             :                                  grmhd::ValenciaDivClean::Tags::TildeS<>,
      62             :                                  grmhd::ValenciaDivClean::Tags::TildeB<>,
      63             :                                  grmhd::ValenciaDivClean::Tags::TildePhi>;
      64             : 
      65           0 :   using argument_tags =
      66             :       tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
      67             :                  hydro::Tags::ElectronFraction<DataVector>,
      68             :                  hydro::Tags::SpecificInternalEnergy<DataVector>,
      69             :                  hydro::Tags::Pressure<DataVector>,
      70             :                  hydro::Tags::SpatialVelocity<DataVector, 3>,
      71             :                  hydro::Tags::LorentzFactor<DataVector>,
      72             :                  hydro::Tags::MagneticField<DataVector, 3>,
      73             :                  gr::Tags::SqrtDetSpatialMetric<DataVector>,
      74             :                  gr::Tags::SpatialMetric<DataVector, 3>,
      75             :                  hydro::Tags::DivergenceCleaningField<DataVector>>;
      76             : 
      77           0 :   static void apply(
      78             :       gsl::not_null<Scalar<DataVector>*> tilde_d,
      79             :       gsl::not_null<Scalar<DataVector>*> tilde_ye,
      80             :       gsl::not_null<Scalar<DataVector>*> tilde_tau,
      81             :       gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*> tilde_s,
      82             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_b,
      83             :       gsl::not_null<Scalar<DataVector>*> tilde_phi,
      84             :       const Scalar<DataVector>& rest_mass_density,
      85             :       const Scalar<DataVector>& electron_fraction,
      86             :       const Scalar<DataVector>& specific_internal_energy,
      87             :       const Scalar<DataVector>& pressure,
      88             :       const tnsr::I<DataVector, 3, Frame::Inertial>& spatial_velocity,
      89             :       const Scalar<DataVector>& lorentz_factor,
      90             :       const tnsr::I<DataVector, 3, Frame::Inertial>& magnetic_field,
      91             :       const Scalar<DataVector>& sqrt_det_spatial_metric,
      92             :       const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
      93             :       const Scalar<DataVector>& divergence_cleaning_field);
      94             : };
      95             : }  // namespace ValenciaDivClean
      96             : }  // namespace grmhd

Generated by: LCOV version 1.14