Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <array> 7 : #include <cstddef> 8 : #include <utility> 9 : 10 : #include "DataStructures/DataBox/PrefixHelpers.hpp" 11 : #include "DataStructures/DataBox/Prefixes.hpp" 12 : #include "DataStructures/Tensor/TypeAliases.hpp" 13 : #include "DataStructures/VariablesTag.hpp" 14 : #include "Domain/Structure/DirectionalIdMap.hpp" 15 : #include "Domain/Tags.hpp" 16 : #include "Evolution/DgSubcell/Tags/GhostDataForReconstruction.hpp" 17 : #include "Evolution/DgSubcell/Tags/Mesh.hpp" 18 : #include "Evolution/Systems/NewtonianEuler/FiniteDifference/Reconstructor.hpp" 19 : #include "Evolution/Systems/NewtonianEuler/Tags.hpp" 20 : #include "Options/String.hpp" 21 : #include "PointwiseFunctions/Hydro/Tags.hpp" 22 : #include "Utilities/TMPL.hpp" 23 : 24 : /// \cond 25 : class DataVector; 26 : template <size_t Dim> 27 : class Direction; 28 : template <size_t Dim> 29 : class Element; 30 : template <size_t Dim> 31 : class ElementId; 32 : namespace EquationsOfState { 33 : template <bool IsRelativistic, size_t ThermodynamicDim> 34 : class EquationOfState; 35 : } // namespace EquationsOfState 36 : namespace gsl { 37 : template <typename T> 38 : class not_null; 39 : } // namespace gsl 40 : template <size_t Dim> 41 : class Mesh; 42 : template <typename TagsList> 43 : class Variables; 44 : namespace evolution::dg::subcell { 45 : class GhostData; 46 : } // namespace evolution::dg::subcell 47 : /// \endcond 48 : 49 : namespace NewtonianEuler::fd { 50 : /*! 51 : * \brief Monotonised central reconstruction. See 52 : * `::fd::reconstruction::monotonised_central()` for details. 53 : */ 54 : template <size_t Dim> 55 1 : class MonotonisedCentralPrim : public Reconstructor<Dim> { 56 : private: 57 : // Conservative vars tags 58 0 : using MassDensityCons = NewtonianEuler::Tags::MassDensityCons; 59 0 : using EnergyDensity = NewtonianEuler::Tags::EnergyDensity; 60 0 : using MomentumDensity = NewtonianEuler::Tags::MomentumDensity<Dim>; 61 : 62 : // Primitive vars tags 63 0 : using MassDensity = hydro::Tags::RestMassDensity<DataVector>; 64 0 : using Velocity = hydro::Tags::SpatialVelocity<DataVector, Dim>; 65 0 : using SpecificInternalEnergy = 66 : hydro::Tags::SpecificInternalEnergy<DataVector>; 67 0 : using Pressure = hydro::Tags::Pressure<DataVector>; 68 : 69 0 : using prims_tags = 70 : tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>; 71 0 : using cons_tags = tmpl::list<MassDensityCons, MomentumDensity, EnergyDensity>; 72 0 : using flux_tags = db::wrap_tags_in<::Tags::Flux, cons_tags, tmpl::size_t<Dim>, 73 : Frame::Inertial>; 74 0 : using prim_tags_for_reconstruction = 75 : tmpl::list<MassDensity, Velocity, Pressure>; 76 : 77 : public: 78 0 : using options = tmpl::list<>; 79 0 : static constexpr Options::String help{ 80 : "Monotonised central reconstruction scheme using primitive variables."}; 81 : 82 0 : MonotonisedCentralPrim() = default; 83 0 : MonotonisedCentralPrim(MonotonisedCentralPrim&&) = default; 84 0 : MonotonisedCentralPrim& operator=(MonotonisedCentralPrim&&) = default; 85 0 : MonotonisedCentralPrim(const MonotonisedCentralPrim&) = default; 86 0 : MonotonisedCentralPrim& operator=(const MonotonisedCentralPrim&) = default; 87 0 : ~MonotonisedCentralPrim() override = default; 88 : 89 0 : explicit MonotonisedCentralPrim(CkMigrateMessage* msg); 90 : 91 0 : WRAPPED_PUPable_decl_base_template(Reconstructor<Dim>, 92 : MonotonisedCentralPrim); 93 : 94 0 : auto get_clone() const -> std::unique_ptr<Reconstructor<Dim>> override; 95 : 96 0 : void pup(PUP::er& p) override; 97 : 98 0 : size_t ghost_zone_size() const override { return 2; } 99 : 100 0 : using reconstruction_argument_tags = 101 : tmpl::list<::Tags::Variables<prims_tags>, 102 : hydro::Tags::EquationOfState<false, 2>, 103 : domain::Tags::Element<Dim>, 104 : evolution::dg::subcell::Tags::GhostDataForReconstruction<Dim>, 105 : evolution::dg::subcell::Tags::Mesh<Dim>>; 106 : 107 : template <typename TagsList> 108 0 : void reconstruct( 109 : gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_lower_face, 110 : gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_upper_face, 111 : const Variables<prims_tags>& volume_prims, 112 : const EquationsOfState::EquationOfState<false, 2>& eos, 113 : const Element<Dim>& element, 114 : const DirectionalIdMap<Dim, evolution::dg::subcell::GhostData>& 115 : ghost_data, 116 : const Mesh<Dim>& subcell_mesh) const; 117 : 118 : /// Called by an element doing DG when the neighbor is doing subcell. 119 : /// 120 : /// This is used to reconstruct the fluxes on the mortar that the subcell 121 : /// neighbor would have sent had we instead used a two a two-communication 122 : /// subcell solver (first communication for reconstruction, second for 123 : /// fluxes). 124 : template <typename TagsList> 125 1 : void reconstruct_fd_neighbor( 126 : gsl::not_null<Variables<TagsList>*> vars_on_face, 127 : const Variables<prims_tags>& subcell_volume_prims, 128 : const EquationsOfState::EquationOfState<false, 2>& eos, 129 : const Element<Dim>& element, 130 : const DirectionalIdMap<Dim, evolution::dg::subcell::GhostData>& 131 : ghost_data, 132 : const Mesh<Dim>& subcell_mesh, 133 : const Direction<Dim> direction_to_reconstruct) const; 134 : }; 135 : 136 : template <size_t Dim> 137 0 : bool operator==(const MonotonisedCentralPrim<Dim>& /*lhs*/, 138 : const MonotonisedCentralPrim<Dim>& /*rhs*/) { 139 : return true; 140 : } 141 : 142 : template <size_t Dim> 143 0 : bool operator!=(const MonotonisedCentralPrim<Dim>& lhs, 144 : const MonotonisedCentralPrim<Dim>& rhs) { 145 : return not(lhs == rhs); 146 : } 147 : } // namespace NewtonianEuler::fd