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 <memory> 9 : #include <utility> 10 : 11 : #include "DataStructures/DataBox/PrefixHelpers.hpp" 12 : #include "DataStructures/DataBox/Prefixes.hpp" 13 : #include "DataStructures/Tensor/TypeAliases.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/GrMhd/ValenciaDivClean/FiniteDifference/ReconstructWork.hpp" 19 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Reconstructor.hpp" 20 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp" 21 : #include "Options/String.hpp" 22 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 23 : #include "PointwiseFunctions/Hydro/Tags.hpp" 24 : #include "Utilities/Serialization/CharmPupable.hpp" 25 : #include "Utilities/TMPL.hpp" 26 : 27 : /// \cond 28 : class DataVector; 29 : template <size_t Dim> 30 : class Direction; 31 : template <size_t Dim> 32 : class Element; 33 : template <size_t Dim> 34 : class ElementId; 35 : namespace EquationsOfState { 36 : template <bool IsRelativistic, size_t ThermodynamicDim> 37 : class EquationOfState; 38 : } // namespace EquationsOfState 39 : template <size_t Dim> 40 : class Mesh; 41 : namespace gsl { 42 : template <typename T> 43 : class not_null; 44 : } // namespace gsl 45 : namespace PUP { 46 : class er; 47 : } // namespace PUP 48 : template <typename TagsList> 49 : class Variables; 50 : namespace evolution::dg::subcell { 51 : class GhostData; 52 : } // namespace evolution::dg::subcell 53 : /// \endcond 54 : 55 : namespace grmhd::ValenciaDivClean::fd { 56 : /*! 57 : * \brief Monotonised central reconstruction. See 58 : * ::fd::reconstruction::monotonised_central() for details. 59 : */ 60 1 : class MonotonisedCentralPrim : public Reconstructor { 61 : private: 62 : // pressure -> temperature 63 0 : using prims_to_reconstruct_tags = 64 : tmpl::list<hydro::Tags::RestMassDensity<DataVector>, 65 : hydro::Tags::ElectronFraction<DataVector>, 66 : hydro::Tags::Temperature<DataVector>, 67 : hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>, 68 : hydro::Tags::MagneticField<DataVector, 3>, 69 : hydro::Tags::DivergenceCleaningField<DataVector>>; 70 : 71 : public: 72 0 : static constexpr size_t dim = 3; 73 : 74 0 : using options = tmpl::list<>; 75 0 : static constexpr Options::String help{ 76 : "Monotonised central reconstruction scheme using primitive variables."}; 77 : 78 0 : MonotonisedCentralPrim() = default; 79 0 : MonotonisedCentralPrim(MonotonisedCentralPrim&&) = default; 80 0 : MonotonisedCentralPrim& operator=(MonotonisedCentralPrim&&) = default; 81 0 : MonotonisedCentralPrim(const MonotonisedCentralPrim&) = default; 82 0 : MonotonisedCentralPrim& operator=(const MonotonisedCentralPrim&) = default; 83 0 : ~MonotonisedCentralPrim() override = default; 84 : 85 0 : explicit MonotonisedCentralPrim(CkMigrateMessage* msg); 86 : 87 0 : WRAPPED_PUPable_decl_base_template(Reconstructor, MonotonisedCentralPrim); 88 : 89 0 : auto get_clone() const -> std::unique_ptr<Reconstructor> override; 90 : 91 0 : static constexpr bool use_adaptive_order = false; 92 : 93 0 : void pup(PUP::er& p) override; 94 : 95 0 : size_t ghost_zone_size() const override { return 2; } 96 : 97 0 : using reconstruction_argument_tags = 98 : tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>, 99 : hydro::Tags::GrmhdEquationOfState, domain::Tags::Element<dim>, 100 : evolution::dg::subcell::Tags::GhostDataForReconstruction<dim>, 101 : evolution::dg::subcell::Tags::Mesh<dim>>; 102 : 103 : template <size_t ThermodynamicDim> 104 0 : void reconstruct( 105 : gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*> 106 : vars_on_lower_face, 107 : gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*> 108 : vars_on_upper_face, 109 : const Variables<hydro::grmhd_tags<DataVector>>& volume_prims, 110 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos, 111 : const Element<dim>& element, 112 : const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>& 113 : ghost_data, 114 : const Mesh<dim>& subcell_mesh) const; 115 : 116 : /// Called by an element doing DG when the neighbor is doing subcell. 117 : template <size_t ThermodynamicDim> 118 1 : void reconstruct_fd_neighbor( 119 : gsl::not_null<Variables<tags_list_for_reconstruct>*> vars_on_face, 120 : const Variables<hydro::grmhd_tags<DataVector>>& subcell_volume_prims, 121 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos, 122 : const Element<dim>& element, 123 : const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>& 124 : ghost_data, 125 : const Mesh<dim>& subcell_mesh, 126 : const Direction<dim> direction_to_reconstruct) const; 127 : }; 128 : 129 0 : bool operator==(const MonotonisedCentralPrim& /*lhs*/, 130 : const MonotonisedCentralPrim& /*rhs*/); 131 : 132 0 : bool operator!=(const MonotonisedCentralPrim& lhs, 133 : const MonotonisedCentralPrim& rhs); 134 : } // namespace grmhd::ValenciaDivClean::fd