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

Generated by: LCOV version 1.14