SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference - MonotonicityPreserving5.hpp Hit Total Coverage
Commit: 107e15b340886ae54549b1baa4bfc92e676f667e Lines: 1 37 2.7 %
Date: 2026-09-17 16:38:56
Legend: Lines: hit not hit

          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 <limits>
       9             : #include <memory>
      10             : #include <utility>
      11             : 
      12             : #include "DataStructures/DataBox/PrefixHelpers.hpp"
      13             : #include "DataStructures/DataBox/Prefixes.hpp"
      14             : #include "DataStructures/Tensor/TypeAliases.hpp"
      15             : #include "Domain/Structure/DirectionalIdMap.hpp"
      16             : #include "Domain/Tags.hpp"
      17             : #include "Evolution/DgSubcell/Tags/GhostDataForReconstruction.hpp"
      18             : #include "Evolution/DgSubcell/Tags/Inactive.hpp"
      19             : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
      20             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/ReconstructWork.hpp"
      21             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Reconstructor.hpp"
      22             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
      23             : #include "Evolution/VariableFixing/FixToAtmosphere.hpp"
      24             : #include "Evolution/VariableFixing/Tags.hpp"
      25             : #include "Options/String.hpp"
      26             : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      27             : #include "PointwiseFunctions/Hydro/Tags.hpp"
      28             : #include "Utilities/Serialization/CharmPupable.hpp"
      29             : #include "Utilities/TMPL.hpp"
      30             : 
      31             : /// \cond
      32             : class DataVector;
      33             : template <size_t Dim>
      34             : class Direction;
      35             : template <size_t Dim>
      36             : class Element;
      37             : template <size_t Dim>
      38             : class ElementId;
      39             : namespace EquationsOfState {
      40             : template <bool IsRelativistic, size_t ThermodynamicDim>
      41             : class EquationOfState;
      42             : }  // namespace EquationsOfState
      43             : template <size_t Dim>
      44             : class Mesh;
      45             : namespace gsl {
      46             : template <typename T>
      47             : class not_null;
      48             : }  // namespace gsl
      49             : namespace PUP {
      50             : class er;
      51             : }  // namespace PUP
      52             : template <typename TagsList>
      53             : class Variables;
      54             : namespace evolution::dg::subcell {
      55             : class GhostData;
      56             : }  // namespace evolution::dg::subcell
      57             : /// \endcond
      58             : 
      59             : namespace grmhd::ValenciaDivClean::fd {
      60             : /*!
      61             :  * \brief Fifth order monotonicity-preserving (MP5) reconstruction. See
      62             :  * ::fd::reconstruction::monotonicity_preserving_5() for details.
      63             :  *
      64             :  */
      65           1 : class MonotonicityPreserving5Prim : public Reconstructor {
      66             :  private:
      67           0 :   using prims_to_reconstruct_tags =
      68             :       tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
      69             :                  hydro::Tags::ElectronFraction<DataVector>,
      70             :                  hydro::Tags::Temperature<DataVector>,
      71             :                  hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>,
      72             :                  hydro::Tags::MagneticField<DataVector, 3>,
      73             :                  hydro::Tags::DivergenceCleaningField<DataVector>>;
      74             : 
      75             :  public:
      76           0 :   static constexpr size_t dim = 3;
      77             : 
      78           0 :   struct Alpha {
      79           0 :     using type = double;
      80           0 :     static constexpr Options::String help = {
      81             :         "The parameter used in an intermediate reconstruction step to impose "
      82             :         "monotonicity; typically Alpha=4.0 is used. Note that in principle the "
      83             :         "CFL number must be not bigger than 1/(1+Alpha). See the original text "
      84             :         "Suresh & Huynh (1997) for the details"};
      85             :   };
      86           0 :   struct Epsilon {
      87           0 :     using type = double;
      88           0 :     static constexpr Options::String help = {
      89             :         "A small tolerance value by which limiting process is turned on and "
      90             :         "off. Suresh & Huynh (1997) suggests 1e-10, but for hydro simulations "
      91             :         "with atmosphere treatment setting Epsilon=0.0 would be safe."};
      92             :   };
      93           0 :   struct ReconstructRhoTimesTemperature {
      94           0 :     using type = bool;
      95           0 :     static constexpr Options::String help = {
      96             :         "If 'true' then we reconstruct the rho*T, if 'false' we reconstruct "
      97             :         "T."};
      98             :   };
      99             : 
     100           0 :   using options = tmpl::list<Alpha, Epsilon, ReconstructRhoTimesTemperature>;
     101           0 :   static constexpr Options::String help{
     102             :       "MP5 reconstruction scheme using primitive variables."};
     103             : 
     104           0 :   MonotonicityPreserving5Prim() = default;
     105           0 :   MonotonicityPreserving5Prim(MonotonicityPreserving5Prim&&) = default;
     106           0 :   MonotonicityPreserving5Prim& operator=(MonotonicityPreserving5Prim&&) =
     107             :       default;
     108           0 :   MonotonicityPreserving5Prim(const MonotonicityPreserving5Prim&) = default;
     109           0 :   MonotonicityPreserving5Prim& operator=(const MonotonicityPreserving5Prim&) =
     110             :       default;
     111           0 :   ~MonotonicityPreserving5Prim() override = default;
     112             : 
     113           0 :   MonotonicityPreserving5Prim(double alpha, double epsilon,
     114             :                               bool reconstruct_rho_times_temperature);
     115             : 
     116           0 :   explicit MonotonicityPreserving5Prim(CkMigrateMessage* msg);
     117             : 
     118           0 :   WRAPPED_PUPable_decl_base_template(Reconstructor,
     119             :                                      MonotonicityPreserving5Prim);
     120             : 
     121           0 :   auto get_clone() const -> std::unique_ptr<Reconstructor> override;
     122             : 
     123           0 :   static constexpr bool use_adaptive_order = false;
     124             : 
     125           0 :   void pup(PUP::er& p) override;
     126             : 
     127           0 :   size_t ghost_zone_size() const override { return 3; }
     128             : 
     129           0 :   using reconstruction_argument_tags =
     130             :       tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>,
     131             :                  hydro::Tags::GrmhdEquationOfState, domain::Tags::Element<dim>,
     132             :                  evolution::dg::subcell::Tags::GhostDataForReconstruction<dim>,
     133             :                  evolution::dg::subcell::Tags::Mesh<dim>,
     134             :                  ::Tags::VariableFixer<VariableFixing::FixToAtmosphere<dim>>>;
     135             : 
     136             :   template <size_t ThermodynamicDim>
     137           0 :   void reconstruct(
     138             :       gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*>
     139             :           vars_on_lower_face,
     140             :       gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*>
     141             :           vars_on_upper_face,
     142             :       const Variables<hydro::grmhd_tags<DataVector>>& volume_prims,
     143             :       const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
     144             :       const Element<dim>& element,
     145             :       const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>&
     146             :           ghost_data,
     147             :       const Mesh<dim>& subcell_mesh,
     148             :       const VariableFixing::FixToAtmosphere<dim>& fix_to_atmosphere) const;
     149             : 
     150             :   template <size_t ThermodynamicDim>
     151           0 :   void reconstruct_fd_neighbor(
     152             :       gsl::not_null<Variables<tags_list_for_reconstruct>*> vars_on_face,
     153             :       const Variables<hydro::grmhd_tags<DataVector>>& subcell_volume_prims,
     154             :       const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
     155             :       const Element<dim>& element,
     156             :       const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>&
     157             :           ghost_data,
     158             :       const Mesh<dim>& subcell_mesh,
     159             :       const VariableFixing::FixToAtmosphere<dim>& fix_to_atmosphere,
     160             :       Direction<dim> direction_to_reconstruct) const;
     161             : 
     162           0 :   bool reconstruct_rho_times_temperature() const override;
     163             : 
     164             :  private:
     165             :   // NOLINTNEXTLINE(readability-redundant-declaration)
     166           0 :   friend bool operator==(const MonotonicityPreserving5Prim& lhs,
     167             :                          const MonotonicityPreserving5Prim& rhs);
     168           0 :   friend bool operator!=(const MonotonicityPreserving5Prim& lhs,
     169             :                          const MonotonicityPreserving5Prim& rhs);
     170             : 
     171           0 :   double alpha_ = std::numeric_limits<double>::signaling_NaN();
     172           0 :   double epsilon_ = std::numeric_limits<double>::signaling_NaN();
     173           0 :   bool reconstruct_rho_times_temperature_{false};
     174             : };
     175             : 
     176             : }  // namespace grmhd::ValenciaDivClean::fd

Generated by: LCOV version 1.14