SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference - MonotonicityPreserving5.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 1 37 2.7 %
Date: 2025-12-05 05:03:31
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 "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 Fifth order monotonicity-preserving (MP5) reconstruction. See
      60             :  * ::fd::reconstruction::monotonicity_preserving_5() for details.
      61             :  *
      62             :  */
      63           1 : class MonotonicityPreserving5Prim : public Reconstructor {
      64             :  private:
      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 Alpha {
      77           0 :     using type = double;
      78           0 :     static constexpr Options::String help = {
      79             :         "The parameter used in an intermediate reconstruction step to impose "
      80             :         "monotonicity; typically Alpha=4.0 is used. Note that in principle the "
      81             :         "CFL number must be not bigger than 1/(1+Alpha). See the original text "
      82             :         "Suresh & Huynh (1997) for the details"};
      83             :   };
      84           0 :   struct Epsilon {
      85           0 :     using type = double;
      86           0 :     static constexpr Options::String help = {
      87             :         "A small tolerance value by which limiting process is turned on and "
      88             :         "off. Suresh & Huynh (1997) suggests 1e-10, but for hydro simulations "
      89             :         "with atmosphere treatment setting Epsilon=0.0 would be safe."};
      90             :   };
      91           0 :   struct ReconstructRhoTimesTemperature {
      92           0 :     using type = bool;
      93           0 :     static constexpr Options::String help = {
      94             :         "If 'true' then we reconstruct the rho*T, if 'false' we reconstruct "
      95             :         "T."};
      96             :   };
      97             : 
      98           0 :   using options = tmpl::list<Alpha, Epsilon, ReconstructRhoTimesTemperature>;
      99           0 :   static constexpr Options::String help{
     100             :       "MP5 reconstruction scheme using primitive variables."};
     101             : 
     102           0 :   MonotonicityPreserving5Prim() = default;
     103           0 :   MonotonicityPreserving5Prim(MonotonicityPreserving5Prim&&) = default;
     104           0 :   MonotonicityPreserving5Prim& operator=(MonotonicityPreserving5Prim&&) =
     105             :       default;
     106           0 :   MonotonicityPreserving5Prim(const MonotonicityPreserving5Prim&) = default;
     107           0 :   MonotonicityPreserving5Prim& operator=(const MonotonicityPreserving5Prim&) =
     108             :       default;
     109           0 :   ~MonotonicityPreserving5Prim() override = default;
     110             : 
     111           0 :   MonotonicityPreserving5Prim(double alpha, double epsilon,
     112             :                               bool reconstruct_rho_times_temperature);
     113             : 
     114           0 :   explicit MonotonicityPreserving5Prim(CkMigrateMessage* msg);
     115             : 
     116           0 :   WRAPPED_PUPable_decl_base_template(Reconstructor,
     117             :                                      MonotonicityPreserving5Prim);
     118             : 
     119           0 :   auto get_clone() const -> std::unique_ptr<Reconstructor> override;
     120             : 
     121           0 :   static constexpr bool use_adaptive_order = false;
     122             : 
     123           0 :   void pup(PUP::er& p) override;
     124             : 
     125           0 :   size_t ghost_zone_size() const override { return 3; }
     126             : 
     127           0 :   using reconstruction_argument_tags =
     128             :       tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>,
     129             :                  hydro::Tags::GrmhdEquationOfState, domain::Tags::Element<dim>,
     130             :                  evolution::dg::subcell::Tags::GhostDataForReconstruction<dim>,
     131             :                  evolution::dg::subcell::Tags::Mesh<dim>>;
     132             : 
     133             :   template <size_t ThermodynamicDim>
     134           0 :   void reconstruct(
     135             :       gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*>
     136             :           vars_on_lower_face,
     137             :       gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*>
     138             :           vars_on_upper_face,
     139             :       const Variables<hydro::grmhd_tags<DataVector>>& volume_prims,
     140             :       const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
     141             :       const Element<dim>& element,
     142             :       const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>&
     143             :           ghost_data,
     144             :       const Mesh<dim>& subcell_mesh) const;
     145             : 
     146             :   template <size_t ThermodynamicDim>
     147           0 :   void reconstruct_fd_neighbor(
     148             :       gsl::not_null<Variables<tags_list_for_reconstruct>*> vars_on_face,
     149             :       const Variables<hydro::grmhd_tags<DataVector>>& subcell_volume_prims,
     150             :       const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
     151             :       const Element<dim>& element,
     152             :       const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>&
     153             :           ghost_data,
     154             :       const Mesh<dim>& subcell_mesh,
     155             :       Direction<dim> direction_to_reconstruct) const;
     156             : 
     157           0 :   bool reconstruct_rho_times_temperature() const override;
     158             : 
     159             :  private:
     160             :   // NOLINTNEXTLINE(readability-redundant-declaration)
     161           0 :   friend bool operator==(const MonotonicityPreserving5Prim& lhs,
     162             :                          const MonotonicityPreserving5Prim& rhs);
     163           0 :   friend bool operator!=(const MonotonicityPreserving5Prim& lhs,
     164             :                          const MonotonicityPreserving5Prim& rhs);
     165             : 
     166           0 :   double alpha_ = std::numeric_limits<double>::signaling_NaN();
     167           0 :   double epsilon_ = std::numeric_limits<double>::signaling_NaN();
     168           0 :   bool reconstruct_rho_times_temperature_{false};
     169             : };
     170             : 
     171             : }  // namespace grmhd::ValenciaDivClean::fd

Generated by: LCOV version 1.14