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 : #include <vector> 11 : 12 : #include "DataStructures/DataBox/PrefixHelpers.hpp" 13 : #include "DataStructures/DataBox/Prefixes.hpp" 14 : #include "DataStructures/Tensor/TypeAliases.hpp" 15 : #include "DataStructures/Variables.hpp" 16 : #include "DataStructures/VariablesTag.hpp" 17 : #include "Domain/Structure/DirectionalIdMap.hpp" 18 : #include "Domain/Tags.hpp" 19 : #include "Evolution/DgSubcell/Tags/GhostDataForReconstruction.hpp" 20 : #include "Evolution/DgSubcell/Tags/Mesh.hpp" 21 : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp" 22 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/Reconstructor.hpp" 23 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/System.hpp" 24 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/Tags.hpp" 25 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp" 26 : #include "Options/String.hpp" 27 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 28 : #include "PointwiseFunctions/Hydro/Tags.hpp" 29 : #include "Utilities/Serialization/CharmPupable.hpp" 30 : #include "Utilities/TMPL.hpp" 31 : 32 : /// \cond 33 : class DataVector; 34 : template <size_t Dim> 35 : class Direction; 36 : template <size_t Dim> 37 : class Element; 38 : template <size_t Dim> 39 : class ElementId; 40 : namespace EquationsOfState { 41 : template <bool IsRelativistic, size_t ThermodynamicDim> 42 : class EquationOfState; 43 : } // namespace EquationsOfState 44 : template <size_t Dim> 45 : class Mesh; 46 : namespace gsl { 47 : template <typename T> 48 : class not_null; 49 : } // namespace gsl 50 : namespace PUP { 51 : class er; 52 : } // namespace PUP 53 : namespace evolution::dg::subcell { 54 : class GhostData; 55 : } // namespace evolution::dg::subcell 56 : /// \endcond 57 : 58 : namespace grmhd::GhValenciaDivClean::fd { 59 : /*! 60 : * \brief Monotonised central reconstruction on the GRMHD primitive variables 61 : * (see 62 : * ::fd::reconstruction::monotonised_central() for details) and unlimited 3rd 63 : * order (degree 2 polynomial) reconstruction on the metric variables. 64 : * 65 : * Only the spacetime metric is reconstructed when we and the neighboring 66 : * element in the direction are doing FD. If we are doing DG and a neighboring 67 : * element is doing FD, then the spacetime metric, \f$\Phi_{iab}\f$, and 68 : * \f$\Pi_{ab}\f$ are all reconstructed since the Riemann solver on the DG 69 : * element also needs to solve for the metric variables. 70 : */ 71 1 : class MonotonisedCentralPrim : public Reconstructor { 72 : public: 73 0 : static constexpr size_t dim = 3; 74 : 75 0 : using options = tmpl::list<>; 76 0 : static constexpr Options::String help{ 77 : "Monotonised central reconstruction scheme using primitive variables and " 78 : "the metric variables."}; 79 : 80 0 : MonotonisedCentralPrim() = default; 81 0 : MonotonisedCentralPrim(MonotonisedCentralPrim&&) = default; 82 0 : MonotonisedCentralPrim& operator=(MonotonisedCentralPrim&&) = default; 83 0 : MonotonisedCentralPrim(const MonotonisedCentralPrim&) = default; 84 0 : MonotonisedCentralPrim& operator=(const MonotonisedCentralPrim&) = default; 85 0 : ~MonotonisedCentralPrim() override = default; 86 : 87 0 : explicit MonotonisedCentralPrim(CkMigrateMessage* msg); 88 : 89 0 : WRAPPED_PUPable_decl_base_template(Reconstructor, MonotonisedCentralPrim); 90 : 91 0 : auto get_clone() const -> std::unique_ptr<Reconstructor> override; 92 : 93 0 : static constexpr bool use_adaptive_order = false; 94 : 95 0 : void pup(PUP::er& p) override; 96 : 97 0 : size_t ghost_zone_size() const override { return 2; } 98 : 99 0 : using reconstruction_argument_tags = 100 : tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>, 101 : typename System::variables_tag, 102 : hydro::Tags::GrmhdEquationOfState, domain::Tags::Element<dim>, 103 : evolution::dg::subcell::Tags::GhostDataForReconstruction<dim>, 104 : evolution::dg::subcell::Tags::Mesh<dim>>; 105 : 106 : template <size_t ThermodynamicDim, typename TagsList> 107 0 : void reconstruct( 108 : gsl::not_null<std::array<Variables<TagsList>, dim>*> vars_on_lower_face, 109 : gsl::not_null<std::array<Variables<TagsList>, dim>*> vars_on_upper_face, 110 : const Variables<hydro::grmhd_tags<DataVector>>& volume_prims, 111 : const Variables<typename System::variables_tag::type::tags_list>& 112 : volume_spacetime_and_cons_vars, 113 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos, 114 : const Element<dim>& element, 115 : const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>& 116 : ghost_data, 117 : const Mesh<dim>& subcell_mesh) const; 118 : 119 : /// Called by an element doing DG when the neighbor is doing subcell. 120 : template <size_t ThermodynamicDim, typename TagsList> 121 1 : void reconstruct_fd_neighbor( 122 : gsl::not_null<Variables<TagsList>*> vars_on_face, 123 : const Variables<hydro::grmhd_tags<DataVector>>& subcell_volume_prims, 124 : const Variables< 125 : grmhd::GhValenciaDivClean::Tags::spacetime_reconstruction_tags>& 126 : subcell_volume_spacetime_metric, 127 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos, 128 : const Element<dim>& element, 129 : const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>& 130 : ghost_data, 131 : const Mesh<dim>& subcell_mesh, 132 : const Direction<dim> direction_to_reconstruct) const; 133 : }; 134 : 135 0 : bool operator==(const MonotonisedCentralPrim& /*lhs*/, 136 : const MonotonisedCentralPrim& /*rhs*/); 137 : 138 0 : bool operator!=(const MonotonisedCentralPrim& lhs, 139 : const MonotonisedCentralPrim& rhs); 140 : } // namespace grmhd::GhValenciaDivClean::fd