PrimitiveFromConservative.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "Evolution/Systems/GrMhd/ValenciaDivClean/TagsDeclarations.hpp" // IWYU pragma: keep
10 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp" // IWYU pragma: keep
11 #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"
12 #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp" // IWYU pragma: keep
13 #include "Utilities/TMPL.hpp"
14 
15 // IWYU pragma: no_include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
16 // IWYU pragma: no_include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
17 // IWYU pragma: no_include "PointwiseFunctions/Hydro/Tags.hpp"
18 
19 /// \cond
20 namespace gsl {
21 template <typename T>
22 class not_null;
23 } // namespace gsl
24 
25 class DataVector;
26 /// \endcond
27 
28 // IWYU pragma: no_forward_declare EquationsOfState::EquationOfState
29 // IWYU pragma: no_forward_declare Tensor
30 
31 namespace grmhd {
32 namespace ValenciaDivClean {
33 /*!
34  * \brief Compute the primitive variables from the conservative variables
35  *
36  * For the Valencia formulation of the GRMHD system with divergence cleaning,
37  * the conversion of the evolved conserved variables to the primitive variables
38  * cannot be expressed in closed analytic form and requires a root find.
39  *
40  * [Siegel {\em et al}, The Astrophysical Journal 859:71(2018)]
41  * (http://iopscience.iop.org/article/10.3847/1538-4357/aabcc5/meta)
42  * compares several inversion methods.
43  */
44 template <typename OrderedListOfPrimitiveRecoverySchemes,
45  size_t ThermodynamicDim>
47  using return_tags =
48  tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
56 
57  using argument_tags =
66 
67  static void apply(
68  gsl::not_null<Scalar<DataVector>*> rest_mass_density,
69  gsl::not_null<Scalar<DataVector>*> specific_internal_energy,
70  gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> spatial_velocity,
71  gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> magnetic_field,
72  gsl::not_null<Scalar<DataVector>*> divergence_cleaning_field,
73  gsl::not_null<Scalar<DataVector>*> lorentz_factor,
76  const Scalar<DataVector>& tilde_d, const Scalar<DataVector>& tilde_tau,
77  const tnsr::i<DataVector, 3, Frame::Inertial>& tilde_s,
78  const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_b,
79  const Scalar<DataVector>& tilde_phi,
80  const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
81  const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric,
82  const Scalar<DataVector>& sqrt_det_spatial_metric,
84  equation_of_state) noexcept;
85 };
86 } // namespace ValenciaDivClean
87 } // namespace grmhd
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
The spatial velocity .
Definition: Tags.hpp:144
The fluid pressure .
Definition: Tags.hpp:123
The specific internal energy .
Definition: Tags.hpp:176
Base class for equations of state depending on whether or not the system is relativistic, and the number of independent thermodynamic variables (ThermodynamicDim) needed to determine the pressure.
Definition: EquationOfState.hpp:63
Definition: Tags.hpp:36
Base tag for the equation of state.
Definition: Tags.hpp:53
The densitized divergence-cleaning field .
Definition: Tags.hpp:70
Definition: Tags.hpp:31
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
Definition: ComputeSpacetimeQuantities.cpp:43
Scalar< DataType > specific_enthalpy(const Scalar< DataType > &rest_mass_density, const Scalar< DataType > &specific_internal_energy, const Scalar< DataType > &pressure) noexcept
Computes the relativistic specific enthalpy as: where is the specific internal energy...
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args)
Apply the function f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1595
The magnetic field measured by an Eulerian observer, where is the normal to the spatial hypersurfac...
Definition: Tags.hpp:80
The divergence-cleaning field .
Definition: Tags.hpp:47
The densitized energy density .
Definition: Tags.hpp:50
The densitized momentum density .
Definition: Tags.hpp:57
The densitized magnetic field .
Definition: Tags.hpp:64
Definition: Tags.hpp:26
The Lorentz factor .
Definition: Tags.hpp:64
Defines a list of useful type aliases for tensors.
The densitized rest-mass density .
Definition: Tags.hpp:44
Stores a collection of function values.
Definition: DataVector.hpp:46
Wraps the template metaprogramming library used (brigand)
Compute the primitive variables from the conservative variables.
Definition: PrimitiveFromConservative.hpp:46
The specific enthalpy .
Definition: Tags.hpp:169
Items related to general relativistic magnetohydrodynamics (GRMHD)
Definition: Characteristics.hpp:34
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12