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