SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/RelativisticEuler/Valencia - ConservativeFromPrimitive.hpp Hit Total Coverage
Commit: d0fc80462417e83e5cddfa1b9901bb4a9b6af4d6 Lines: 1 5 20.0 %
Date: 2024-03-29 00:33:31
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             : 
       8             : #include "DataStructures/Tensor/TypeAliases.hpp"
       9             : #include "Evolution/Systems/RelativisticEuler/Valencia/TagsDeclarations.hpp"
      10             : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
      11             : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
      12             : #include "Utilities/TMPL.hpp"
      13             : 
      14             : /// \cond
      15             : class DataVector;
      16             : 
      17             : namespace gsl {
      18             : template <typename T>
      19             : class not_null;
      20             : }  // namespace gsl
      21             : /// \endcond
      22             : 
      23             : namespace RelativisticEuler {
      24             : namespace Valencia {
      25             : 
      26             : /*!
      27             :  * \brief Compute the conservative variables from primitive variables
      28             :  *
      29             :  * \f{align*}
      30             :  * {\tilde D} = & \sqrt{\gamma} \rho W \\
      31             :  * {\tilde S}_i = & \sqrt{\gamma} \rho h W^2 v_i \\
      32             :  * {\tilde \tau} = & \sqrt{\gamma} \left( \rho h W^2 - p - \rho W \right)
      33             :  * \f}
      34             :  * where \f${\tilde D}\f$, \f${\tilde S}_i\f$, and \f${\tilde \tau}\f$ are a
      35             :  * generalized mass-energy density, momentum density, and specific internal
      36             :  * energy density as measured by an Eulerian observer, \f$\gamma\f$ is the
      37             :  * determinant of the spatial metric, \f$\rho\f$ is the rest mass density,
      38             :  * \f$W = 1/\sqrt{1-v_i v^i}\f$ is the Lorentz factor, \f$h = 1 + \epsilon +
      39             :  * \frac{p}{\rho}\f$ is the specific enthalpy, \f$v_i\f$ is the spatial
      40             :  * velocity, \f$\epsilon\f$ is the specific internal energy, and \f$p\f$ is the
      41             :  * pressure.
      42             :  *
      43             :  * Using the definitions of the Lorentz factor and the specific enthalpy, the
      44             :  * last equation can be rewritten in a form that has a well-behaved Newtonian
      45             :  * limit: \f[
      46             :  * {\tilde \tau} = \sqrt{\gamma} W^2 \left[ \rho \left( \epsilon + v^2
      47             :  * \frac{W}{W + 1} \right) + p v^2 \right] .\f]
      48             :  */
      49             : template <size_t Dim>
      50           1 : struct ConservativeFromPrimitive {
      51           0 :   using return_tags =
      52             :       tmpl::list<RelativisticEuler::Valencia::Tags::TildeD,
      53             :                  RelativisticEuler::Valencia::Tags::TildeTau,
      54             :                  RelativisticEuler::Valencia::Tags::TildeS<Dim>>;
      55             : 
      56           0 :   using argument_tags =
      57             :       tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
      58             :                  hydro::Tags::SpecificInternalEnergy<DataVector>,
      59             :                  hydro::Tags::SpecificEnthalpy<DataVector>,
      60             :                  hydro::Tags::Pressure<DataVector>,
      61             :                  hydro::Tags::SpatialVelocity<DataVector, Dim>,
      62             :                  hydro::Tags::LorentzFactor<DataVector>,
      63             :                  gr::Tags::SqrtDetSpatialMetric<DataVector>,
      64             :                  gr::Tags::SpatialMetric<DataVector, Dim>>;
      65             : 
      66           0 :   static void apply(
      67             :       gsl::not_null<Scalar<DataVector>*> tilde_d,
      68             :       gsl::not_null<Scalar<DataVector>*> tilde_tau,
      69             :       gsl::not_null<tnsr::i<DataVector, Dim, Frame::Inertial>*> tilde_s,
      70             :       const Scalar<DataVector>& rest_mass_density,
      71             :       const Scalar<DataVector>& specific_internal_energy,
      72             :       const Scalar<DataVector>& specific_enthalpy,
      73             :       const Scalar<DataVector>& pressure,
      74             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& spatial_velocity,
      75             :       const Scalar<DataVector>& lorentz_factor,
      76             :       const Scalar<DataVector>& sqrt_det_spatial_metric,
      77             :       const tnsr::ii<DataVector, Dim, Frame::Inertial>& spatial_metric);
      78             : };
      79             : }  // namespace Valencia
      80             : }  // namespace RelativisticEuler

Generated by: LCOV version 1.14