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 : struct ReconstructRhoTimesTemperature { 75 0 : using type = bool; 76 0 : static constexpr Options::String help = { 77 : "If 'true' then we reconstruct the rho*T, if 'false' we reconstruct " 78 : "T."}; 79 : }; 80 : 81 0 : using options = tmpl::list<ReconstructRhoTimesTemperature>; 82 0 : static constexpr Options::String help{ 83 : "Monotonised central reconstruction scheme using primitive variables."}; 84 : 85 0 : MonotonisedCentralPrim() = default; 86 0 : MonotonisedCentralPrim(MonotonisedCentralPrim&&) = default; 87 0 : MonotonisedCentralPrim& operator=(MonotonisedCentralPrim&&) = default; 88 0 : MonotonisedCentralPrim(const MonotonisedCentralPrim&) = default; 89 0 : MonotonisedCentralPrim& operator=(const MonotonisedCentralPrim&) = default; 90 0 : ~MonotonisedCentralPrim() override = default; 91 : 92 0 : explicit MonotonisedCentralPrim(bool reconstruct_rho_times_temperature); 93 : 94 0 : explicit MonotonisedCentralPrim(CkMigrateMessage* msg); 95 : 96 0 : WRAPPED_PUPable_decl_base_template(Reconstructor, MonotonisedCentralPrim); 97 : 98 0 : auto get_clone() const -> std::unique_ptr<Reconstructor> override; 99 : 100 0 : static constexpr bool use_adaptive_order = false; 101 : 102 0 : void pup(PUP::er& p) override; 103 : 104 0 : size_t ghost_zone_size() const override { return 2; } 105 : 106 0 : using reconstruction_argument_tags = 107 : tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>, 108 : hydro::Tags::GrmhdEquationOfState, domain::Tags::Element<dim>, 109 : evolution::dg::subcell::Tags::GhostDataForReconstruction<dim>, 110 : evolution::dg::subcell::Tags::Mesh<dim>>; 111 : 112 : template <size_t ThermodynamicDim> 113 0 : void reconstruct( 114 : gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*> 115 : vars_on_lower_face, 116 : gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*> 117 : vars_on_upper_face, 118 : const Variables<hydro::grmhd_tags<DataVector>>& volume_prims, 119 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos, 120 : const Element<dim>& element, 121 : const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>& 122 : ghost_data, 123 : const Mesh<dim>& subcell_mesh) const; 124 : 125 : /// Called by an element doing DG when the neighbor is doing subcell. 126 : template <size_t ThermodynamicDim> 127 1 : void reconstruct_fd_neighbor( 128 : gsl::not_null<Variables<tags_list_for_reconstruct>*> vars_on_face, 129 : const Variables<hydro::grmhd_tags<DataVector>>& subcell_volume_prims, 130 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos, 131 : const Element<dim>& element, 132 : const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>& 133 : ghost_data, 134 : const Mesh<dim>& subcell_mesh, 135 : Direction<dim> direction_to_reconstruct) const; 136 : 137 0 : bool reconstruct_rho_times_temperature() const override; 138 : 139 : private: 140 0 : bool reconstruct_rho_times_temperature_{false}; 141 : }; 142 : 143 0 : bool operator==(const MonotonisedCentralPrim& lhs, 144 : const MonotonisedCentralPrim& rhs); 145 : 146 0 : bool operator!=(const MonotonisedCentralPrim& lhs, 147 : const MonotonisedCentralPrim& rhs); 148 : } // namespace grmhd::ValenciaDivClean::fd