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 "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/NewtonianEuler/Tags.hpp"
15 : #include "PointwiseFunctions/Hydro/Tags.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : /// \cond
19 : class DataVector;
20 : namespace EquationsOfState {
21 : template <bool IsRelativistic, size_t ThermodynamicDim>
22 : class EquationOfState;
23 : } // namespace EquationsOfState
24 : template <size_t Dim>
25 : class Mesh;
26 : namespace gsl {
27 : template <typename T>
28 : class not_null;
29 : } // namespace gsl
30 : template <typename TagsList>
31 : class Variables;
32 : /// \endcond
33 :
34 : namespace NewtonianEuler::subcell {
35 : /*!
36 : * \brief Mutator that resizes the primitive variables to have the size of the
37 : * active mesh and then computes the primitive variables on the active mesh.
38 : *
39 : * In the DG-subcell `step_actions` list this will normally be called using the
40 : * `::Actions::MutateApply` action right after the
41 : * `evolution::dg::subcell::Actions::TciAndSwitchToDg` action. We only need to
42 : * compute the primitives if we switched to the DG grid because otherwise we
43 : * computed the primitives during the FD TCI. After the primitive variables tag
44 : * is resized for the DG grid, the primitives are computed directly on the DG
45 : * grid from the reconstructed conserved variables, not via a reconstruction
46 : * operation applied to the primitives.
47 : */
48 : template <size_t Dim>
49 1 : struct ResizeAndComputePrims {
50 : private:
51 0 : using MassDensity = hydro::Tags::RestMassDensity<DataVector>;
52 0 : using Velocity = hydro::Tags::SpatialVelocity<DataVector, Dim>;
53 0 : using SpecificInternalEnergy =
54 : hydro::Tags::SpecificInternalEnergy<DataVector>;
55 0 : using Pressure = hydro::Tags::Pressure<DataVector>;
56 :
57 : public:
58 0 : using return_tags = tmpl::list<::Tags::Variables<
59 : tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>>;
60 0 : using argument_tags =
61 : tmpl::list<evolution::dg::subcell::Tags::ActiveGrid,
62 : domain::Tags::Mesh<Dim>,
63 : evolution::dg::subcell::Tags::Mesh<Dim>, Tags::MassDensityCons,
64 : Tags::MomentumDensity<Dim>, Tags::EnergyDensity,
65 : hydro::Tags::EquationOfState<false, 2>>;
66 :
67 0 : static void apply(
68 : gsl::not_null<Variables<
69 : tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>*>
70 : prim_vars,
71 : evolution::dg::subcell::ActiveGrid active_grid, const Mesh<Dim>& dg_mesh,
72 : const Mesh<Dim>& subcell_mesh,
73 : const Scalar<DataVector>& mass_density_cons,
74 : const tnsr::I<DataVector, Dim>& momentum_density,
75 : const Scalar<DataVector>& energy_density,
76 : const EquationsOfState::EquationOfState<false, 2>& equation_of_state);
77 : };
78 : } // namespace NewtonianEuler::subcell
|