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

Generated by: LCOV version 1.14