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/Tags/DidRollback.hpp" 12 : #include "Evolution/DgSubcell/Tags/Mesh.hpp" 13 : #include "Evolution/Systems/NewtonianEuler/Tags.hpp" 14 : #include "PointwiseFunctions/Hydro/Tags.hpp" 15 : #include "Utilities/TMPL.hpp" 16 : 17 : /// \cond 18 : class DataVector; 19 : namespace EquationsOfState { 20 : template <bool IsRelativistic, size_t ThermodynamicDim> 21 : class EquationOfState; 22 : } // namespace EquationsOfState 23 : template <size_t Dim> 24 : class Mesh; 25 : namespace gsl { 26 : template <typename T> 27 : class not_null; 28 : } // namespace gsl 29 : template <typename TagsList> 30 : class Variables; 31 : /// \endcond 32 : 33 : namespace NewtonianEuler::subcell { 34 : /*! 35 : * \brief Mutator that resizes the primitive variables to the subcell mesh and 36 : * computes the primitives, but only if 37 : * `evolution::dg::subcell::Tags::DidRollback` is `true`. 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::Labels::BeginSubcellAfterDgRollback` label. 42 : */ 43 : template <size_t Dim> 44 1 : struct PrimsAfterRollback { 45 : private: 46 0 : using MassDensity = hydro::Tags::RestMassDensity<DataVector>; 47 0 : using Velocity = hydro::Tags::SpatialVelocity<DataVector, Dim>; 48 0 : using SpecificInternalEnergy = 49 : hydro::Tags::SpecificInternalEnergy<DataVector>; 50 0 : using Pressure = hydro::Tags::Pressure<DataVector>; 51 : 52 : public: 53 0 : using return_tags = tmpl::list<::Tags::Variables< 54 : tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>>; 55 0 : using argument_tags = 56 : tmpl::list<evolution::dg::subcell::Tags::DidRollback, 57 : evolution::dg::subcell::Tags::Mesh<Dim>, Tags::MassDensityCons, 58 : Tags::MomentumDensity<Dim>, Tags::EnergyDensity, 59 : hydro::Tags::EquationOfState<false, 2>>; 60 : 61 0 : static void apply( 62 : gsl::not_null<Variables< 63 : tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>*> 64 : prim_vars, 65 : bool did_rollback, const Mesh<Dim>& subcell_mesh, 66 : const Scalar<DataVector>& mass_density_cons, 67 : const tnsr::I<DataVector, Dim>& momentum_density, 68 : const Scalar<DataVector>& energy_density, 69 : const EquationsOfState::EquationOfState<false, 2>& equation_of_state); 70 : }; 71 : } // namespace NewtonianEuler::subcell