SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference - Wcns5z.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 1 49 2.0 %
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/VariablesTag.hpp"
      13             : #include "Domain/Structure/DirectionalIdMap.hpp"
      14             : #include "Domain/Tags.hpp"
      15             : #include "Evolution/DgSubcell/Tags/GhostDataForReconstruction.hpp"
      16             : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
      17             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/ReconstructWork.hpp"
      18             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Reconstructor.hpp"
      19             : #include "NumericalAlgorithms/FiniteDifference/FallbackReconstructorType.hpp"
      20             : #include "Options/String.hpp"
      21             : #include "PointwiseFunctions/Hydro/Tags.hpp"
      22             : #include "Utilities/TMPL.hpp"
      23             : 
      24             : /// \cond
      25             : class DataVector;
      26             : template <size_t Dim>
      27             : class Direction;
      28             : template <size_t Dim>
      29             : class Element;
      30             : template <size_t Dim>
      31             : class ElementId;
      32             : namespace EquationsOfState {
      33             : template <bool IsRelativistic, size_t ThermodynamicDim>
      34             : class EquationOfState;
      35             : }  // namespace EquationsOfState
      36             : template <size_t Dim>
      37             : class Mesh;
      38             : namespace gsl {
      39             : template <typename T>
      40             : class not_null;
      41             : }  // namespace gsl
      42             : namespace PUP {
      43             : class er;
      44             : }  // namespace PUP
      45             : template <typename TagsList>
      46             : class Variables;
      47             : namespace evolution::dg::subcell {
      48             : class GhostData;
      49             : }  // namespace evolution::dg::subcell
      50             : /// \endcond
      51             : 
      52             : namespace grmhd::ValenciaDivClean::fd {
      53             : /*!
      54             :  * \brief Fifth order weighted nonlinear compact scheme reconstruction using the
      55             :  * Z oscillation indicator. See ::fd::reconstruction::wcns5z() for details.
      56             :  *
      57             :  */
      58           1 : class Wcns5zPrim : public Reconstructor {
      59             :  private:
      60           0 :   using prims_to_reconstruct_tags =
      61             :       tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
      62             :                  hydro::Tags::ElectronFraction<DataVector>,
      63             :                  hydro::Tags::Temperature<DataVector>,
      64             :                  hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>,
      65             :                  hydro::Tags::MagneticField<DataVector, 3>,
      66             :                  hydro::Tags::DivergenceCleaningField<DataVector>>;
      67             : 
      68           0 :   using FallbackReconstructorType =
      69             :       ::fd::reconstruction::FallbackReconstructorType;
      70             : 
      71             :  public:
      72           0 :   static constexpr size_t dim = 3;
      73             : 
      74           0 :   struct NonlinearWeightExponent {
      75           0 :     using type = size_t;
      76           0 :     static constexpr Options::String help = {
      77             :         "The exponent q to which the oscillation indicator term is raised"};
      78             :   };
      79           0 :   struct Epsilon {
      80           0 :     using type = double;
      81           0 :     static constexpr Options::String help = {
      82             :         "The parameter added to the oscillation indicators to avoid division "
      83             :         "by zero"};
      84             :   };
      85           0 :   struct FallbackReconstructor {
      86           0 :     using type = FallbackReconstructorType;
      87           0 :     static constexpr Options::String help = {
      88             :         "A reconstruction scheme to fallback to adaptively. Finite difference "
      89             :         "will switch to this reconstruction scheme if there are more extrema "
      90             :         "in a FD stencil than a specified number. See also the option "
      91             :         "'MaxNumberOfExtrema' below. Adaptive fallback is disabled if 'None'."};
      92             :   };
      93           0 :   struct MaxNumberOfExtrema {
      94           0 :     using type = size_t;
      95           0 :     static constexpr Options::String help = {
      96             :         "The maximum allowed number of extrema in FD stencil for using Wcns5z "
      97             :         "reconstruction before switching to a low-order reconstruction. If "
      98             :         "FallbackReconstructor=None, this option is ignored"};
      99             :   };
     100           0 :   struct ReconstructRhoTimesTemperature {
     101           0 :     using type = bool;
     102           0 :     static constexpr Options::String help = {
     103             :         "If 'true' then we reconstruct the rho*T, if 'false' we reconstruct "
     104             :         "T."};
     105             :   };
     106             : 
     107           0 :   using options =
     108             :       tmpl::list<NonlinearWeightExponent, Epsilon, FallbackReconstructor,
     109             :                  MaxNumberOfExtrema, ReconstructRhoTimesTemperature>;
     110             : 
     111           0 :   static constexpr Options::String help{
     112             :       "WCNS 5Z reconstruction scheme using primitive variables."};
     113             : 
     114           0 :   Wcns5zPrim() = default;
     115           0 :   Wcns5zPrim(Wcns5zPrim&&) = default;
     116           0 :   Wcns5zPrim& operator=(Wcns5zPrim&&) = default;
     117           0 :   Wcns5zPrim(const Wcns5zPrim&) = default;
     118           0 :   Wcns5zPrim& operator=(const Wcns5zPrim&) = default;
     119           0 :   ~Wcns5zPrim() override = default;
     120             : 
     121           0 :   Wcns5zPrim(size_t nonlinear_weight_exponent, double epsilon,
     122             :              FallbackReconstructorType fallback_reconstructor,
     123             :              size_t max_number_of_extrema,
     124             :              bool reconstruct_rho_times_temperature);
     125             : 
     126           0 :   explicit Wcns5zPrim(CkMigrateMessage* msg);
     127             : 
     128           0 :   WRAPPED_PUPable_decl_base_template(Reconstructor, Wcns5zPrim);
     129             : 
     130           0 :   auto get_clone() const -> std::unique_ptr<Reconstructor> override;
     131             : 
     132           0 :   static constexpr bool use_adaptive_order = false;
     133             : 
     134           0 :   void pup(PUP::er& p) override;
     135             : 
     136           0 :   size_t ghost_zone_size() const override { return 3; }
     137             : 
     138           0 :   using reconstruction_argument_tags =
     139             :       tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>,
     140             :                  hydro::Tags::GrmhdEquationOfState, domain::Tags::Element<dim>,
     141             :                  evolution::dg::subcell::Tags::GhostDataForReconstruction<dim>,
     142             :                  evolution::dg::subcell::Tags::Mesh<dim>>;
     143             : 
     144             :   template <size_t ThermodynamicDim>
     145           0 :   void reconstruct(
     146             :       gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*>
     147             :           vars_on_lower_face,
     148             :       gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, dim>*>
     149             :           vars_on_upper_face,
     150             :       const Variables<hydro::grmhd_tags<DataVector>>& volume_prims,
     151             :       const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
     152             :       const Element<dim>& element,
     153             :       const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>&
     154             :           ghost_data,
     155             :       const Mesh<dim>& subcell_mesh) const;
     156             : 
     157             :   template <size_t ThermodynamicDim>
     158           0 :   void reconstruct_fd_neighbor(
     159             :       gsl::not_null<Variables<tags_list_for_reconstruct>*> vars_on_face,
     160             :       const Variables<hydro::grmhd_tags<DataVector>>& subcell_volume_prims,
     161             :       const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
     162             :       const Element<dim>& element,
     163             :       const DirectionalIdMap<dim, evolution::dg::subcell::GhostData>&
     164             :           ghost_data,
     165             :       const Mesh<dim>& subcell_mesh,
     166             :       Direction<dim> direction_to_reconstruct) const;
     167             : 
     168           0 :   bool reconstruct_rho_times_temperature() const override;
     169             : 
     170             :  private:
     171             :   // NOLINTNEXTLINE(readability-redundant-declaration)
     172           0 :   friend bool operator==(const Wcns5zPrim& lhs, const Wcns5zPrim& rhs);
     173           0 :   friend bool operator!=(const Wcns5zPrim& lhs, const Wcns5zPrim& rhs);
     174             : 
     175           0 :   size_t nonlinear_weight_exponent_ = 0;
     176           0 :   double epsilon_ = std::numeric_limits<double>::signaling_NaN();
     177           0 :   FallbackReconstructorType fallback_reconstructor_ =
     178             :       FallbackReconstructorType::None;
     179           0 :   size_t max_number_of_extrema_ = 0;
     180           0 :   bool reconstruct_rho_times_temperature_{false};
     181             : 
     182           0 :   void (*reconstruct_)(gsl::not_null<std::array<gsl::span<double>, dim>*>,
     183             :                        gsl::not_null<std::array<gsl::span<double>, dim>*>,
     184             :                        const gsl::span<const double>&,
     185             :                        const DirectionMap<dim, gsl::span<const double>>&,
     186             :                        const Index<dim>&, size_t, double, size_t) = nullptr;
     187           0 :   void (*reconstruct_lower_neighbor_)(gsl::not_null<DataVector*>,
     188             :                                       const DataVector&, const DataVector&,
     189             :                                       const Index<dim>&, const Index<dim>&,
     190             :                                       const Direction<dim>&, const double&,
     191             :                                       const size_t&) = nullptr;
     192           0 :   void (*reconstruct_upper_neighbor_)(gsl::not_null<DataVector*>,
     193             :                                       const DataVector&, const DataVector&,
     194             :                                       const Index<dim>&, const Index<dim>&,
     195             :                                       const Direction<dim>&, const double&,
     196             :                                       const size_t&) = nullptr;
     197             : };
     198             : 
     199             : }  // namespace grmhd::ValenciaDivClean::fd

Generated by: LCOV version 1.14