ResizeAndComputePrimitives.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "DataStructures/VariablesTag.hpp"
10 #include "Domain/Tags.hpp"
11 #include "Evolution/DgSubcell/ActiveGrid.hpp"
12 #include "Evolution/DgSubcell/Tags/ActiveGrid.hpp"
13 #include "Evolution/DgSubcell/Tags/Mesh.hpp"
14 #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
15 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
16 #include "PointwiseFunctions/Hydro/Tags.hpp"
17 #include "Utilities/TMPL.hpp"
18 
19 /// \cond
20 class DataVector;
21 namespace EquationsOfState {
22 template <bool IsRelativistic, size_t ThermodynamicDim>
23 class EquationOfState;
24 } // namespace EquationsOfState
25 template <size_t Dim>
26 class Mesh;
27 namespace gsl {
28 template <typename T>
29 class not_null;
30 } // namespace gsl
31 template <typename TagsList>
32 class Variables;
33 /// \endcond
34 
36 /*!
37  * \brief Mutator that, if the active mesh is subcell, resizes the primitive
38  * variables to have the size of the subcell and then computes the primitive
39  * variables.
40  *
41  * In the DG-subcell `step_actions` list this will normally be called using the
42  * `::Actions::MutateApply` action in the following way in the action list:
43  * - `TciAndSwitchToDg<TciOnFdGrid>`
44  * - `Actions::MutateApply<grmhd::ValenciaDivClean::subcell::SwapGrTags>`
45  * - `Actions::MutateApply<ResizeAndComputePrims<primitive_recovery_schemes>>`
46  * Note that the GR tags are swapped before this action is called.
47  *
48  * If the active grid is DG (we are switching from subcell back to DG) then this
49  * mutator computes the primitive variables on the active grid. We reconstruct
50  * the pressure to the DG grid to give a high-order initial guess for the
51  * primitive recovery. A possible future optimization would be to avoid this
52  * reconstruction when all recovery schemes don't need an initial guess.
53  * Finally, we perform the primitive recovery on the DG grid.
54  */
55 template <typename OrderedListOfRecoverySchemes>
57  using return_tags =
58  tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>>;
59  using argument_tags =
70 
71  template <size_t ThermodynamicDim>
72  static void apply(
73  gsl::not_null<Variables<hydro::grmhd_tags<DataVector>>*> prim_vars,
74  evolution::dg::subcell::ActiveGrid active_grid, const Mesh<3>& dg_mesh,
75  const Mesh<3>& subcell_mesh, const Scalar<DataVector>& tilde_d,
76  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  eos) noexcept;
85 };
86 } // namespace grmhd::ValenciaDivClean::subcell
EquationsOfState
Contains all equations of state, including base class.
Definition: DarkEnergyFluid.hpp:26
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
EquationsOfState::EquationOfState
Base class for equations of state depending on whether or not the system is relativistic,...
Definition: EquationOfState.hpp:63
grmhd::ValenciaDivClean::subcell
Code required by the DG-subcell/FD hybrid solver.
Definition: ComputeFluxes.hpp:11
Tags.hpp
domain::Tags::Mesh
The computational grid of the Element in the DataBox.
Definition: Tags.hpp:107
evolution::dg::subcell::ActiveGrid
ActiveGrid
Definition: ActiveGrid.hpp:11
cstddef
grmhd::ValenciaDivClean::Tags::TildeS
The densitized momentum density .
Definition: Tags.hpp:42
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
evolution::dg::subcell::Tags::Mesh
The mesh on the subcells.
Definition: Mesh.hpp:19
grmhd::ValenciaDivClean::Tags::TildeB
The densitized magnetic field .
Definition: Tags.hpp:49
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:49
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
TypeAliases.hpp
hydro::Tags::EquationOfStateBase
Base tag for the equation of state.
Definition: Tags.hpp:53
gr::spatial_metric
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
grmhd::ValenciaDivClean::Tags::TildeD
The densitized rest-mass density .
Definition: Tags.hpp:31
grmhd::ValenciaDivClean::Tags::TildePhi
The densitized divergence-cleaning field .
Definition: Tags.hpp:55
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecPiecewisePolynomial.hpp:11
TMPL.hpp
grmhd::ValenciaDivClean::subcell::ResizeAndComputePrims
Mutator that, if the active mesh is subcell, resizes the primitive variables to have the size of the ...
Definition: ResizeAndComputePrimitives.hpp:56
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13
grmhd::ValenciaDivClean::Tags::TildeTau
The densitized energy density .
Definition: Tags.hpp:36
gr::Tags::SqrtDetSpatialMetric
Definition: Tags.hpp:44