SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/ScalarAdvection/FiniteDifference - AoWeno.hpp Hit Total Coverage
Commit: 52f20d7d69c179a8fabd675cc9d8c5355c7d621c Lines: 2 44 4.5 %
Date: 2024-04-17 15:32:38
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/Prefixes.hpp"
      13             : #include "DataStructures/Tensor/TypeAliases.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/ScalarAdvection/FiniteDifference/Reconstructor.hpp"
      19             : #include "Evolution/Systems/ScalarAdvection/Tags.hpp"
      20             : #include "Options/String.hpp"
      21             : #include "Utilities/TMPL.hpp"
      22             : 
      23             : /// \cond
      24             : class DataVector;
      25             : template <size_t Dim>
      26             : class Direction;
      27             : template <size_t Dim>
      28             : class Element;
      29             : template <size_t Dim>
      30             : class ElementId;
      31             : template <size_t Dim>
      32             : class Mesh;
      33             : template <typename TagsList>
      34             : class Variables;
      35             : namespace gsl {
      36             : template <typename>
      37             : class not_null;
      38             : }  // namespace gsl
      39             : namespace Tags {
      40             : template <typename TagsList>
      41             : class Variables;
      42             : }  // namespace Tags
      43             : namespace PUP {
      44             : class er;
      45             : }  // namespace PUP
      46             : namespace evolution::dg::subcell {
      47             : class GhostData;
      48             : }  // namespace evolution::dg::subcell
      49             : /// \endcond
      50             : 
      51           1 : namespace ScalarAdvection::fd {
      52             : /*!
      53             :  * \brief Adaptive-order WENO reconstruction hybridizing orders 5 and 3. See
      54             :  * ::fd::reconstruction::aoweno_53() for details.
      55             :  */
      56             : template <size_t Dim>
      57           1 : class AoWeno53 : public Reconstructor<Dim> {
      58             :  private:
      59           0 :   using face_vars_tags =
      60             :       tmpl::list<ScalarAdvection::Tags::U,
      61             :                  ::Tags::Flux<ScalarAdvection::Tags::U, tmpl::size_t<Dim>,
      62             :                               Frame::Inertial>>;
      63           0 :   using volume_vars_tags = tmpl::list<ScalarAdvection::Tags::U>;
      64             : 
      65             :  public:
      66           0 :   struct GammaHi {
      67           0 :     using type = double;
      68           0 :     static constexpr Options::String help = {
      69             :         "The linear weight for the 5th-order stencil."};
      70             :   };
      71           0 :   struct GammaLo {
      72           0 :     using type = double;
      73           0 :     static constexpr Options::String help = {
      74             :         "The linear weight for the central 3rd-order stencil."};
      75             :   };
      76           0 :   struct Epsilon {
      77           0 :     using type = double;
      78           0 :     static constexpr Options::String help = {
      79             :         "The parameter added to the oscillation indicators to avoid division "
      80             :         "by zero"};
      81             :   };
      82           0 :   struct NonlinearWeightExponent {
      83           0 :     using type = size_t;
      84           0 :     static constexpr Options::String help = {
      85             :         "The exponent q to which the oscillation indicators are raised"};
      86             :   };
      87             : 
      88           0 :   using options =
      89             :       tmpl::list<GammaHi, GammaLo, Epsilon, NonlinearWeightExponent>;
      90           0 :   static constexpr Options::String help{
      91             :       "Adaptive-order WENO reconstruction hybridizing orders 5 and 3."};
      92             : 
      93           0 :   AoWeno53() = default;
      94           0 :   AoWeno53(AoWeno53&&) = default;
      95           0 :   AoWeno53& operator=(AoWeno53&&) = default;
      96           0 :   AoWeno53(const AoWeno53&) = default;
      97           0 :   AoWeno53& operator=(const AoWeno53&) = default;
      98           0 :   ~AoWeno53() override = default;
      99             : 
     100           0 :   AoWeno53(double gamma_hi, double gamma_lo, double epsilon,
     101             :            size_t nonlinear_weight_exponent);
     102             : 
     103           0 :   explicit AoWeno53(CkMigrateMessage* msg);
     104             : 
     105           0 :   WRAPPED_PUPable_decl_base_template(Reconstructor<Dim>, AoWeno53);
     106             : 
     107           0 :   auto get_clone() const -> std::unique_ptr<Reconstructor<Dim>> override;
     108             : 
     109           0 :   void pup(PUP::er& p) override;
     110             : 
     111           0 :   size_t ghost_zone_size() const override { return 3; }
     112             : 
     113           0 :   using reconstruction_argument_tags =
     114             :       tmpl::list<::Tags::Variables<volume_vars_tags>,
     115             :                  domain::Tags::Element<Dim>,
     116             :                  evolution::dg::subcell::Tags::GhostDataForReconstruction<Dim>,
     117             :                  evolution::dg::subcell::Tags::Mesh<Dim>>;
     118             : 
     119             :   template <typename TagsList>
     120           0 :   void reconstruct(
     121             :       gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_lower_face,
     122             :       gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_upper_face,
     123             :       const Variables<tmpl::list<ScalarAdvection::Tags::U>>& volume_vars,
     124             :       const Element<Dim>& element,
     125             :       const DirectionalIdMap<Dim, evolution::dg::subcell::GhostData>&
     126             :           ghost_data,
     127             :       const Mesh<Dim>& subcell_mesh) const;
     128             : 
     129             :   template <typename TagsList>
     130           0 :   void reconstruct_fd_neighbor(
     131             :       gsl::not_null<Variables<TagsList>*> vars_on_face,
     132             :       const Variables<tmpl::list<ScalarAdvection::Tags::U>>& volume_vars,
     133             :       const Element<Dim>& element,
     134             :       const DirectionalIdMap<Dim, evolution::dg::subcell::GhostData>&
     135             :           ghost_data,
     136             :       const Mesh<Dim>& subcell_mesh,
     137             :       const Direction<Dim> direction_to_reconstruct) const;
     138             : 
     139             :  private:
     140             :   template <size_t LocalDim>
     141             :   // NOLINTNEXTLINE(readability-redundant-declaration)
     142           0 :   friend bool operator==(const AoWeno53<LocalDim>& lhs,
     143             :                          const AoWeno53<LocalDim>& rhs);
     144             : 
     145           0 :   double gamma_hi_ = std::numeric_limits<double>::signaling_NaN();
     146           0 :   double gamma_lo_ = std::numeric_limits<double>::signaling_NaN();
     147           0 :   double epsilon_ = std::numeric_limits<double>::signaling_NaN();
     148           0 :   size_t nonlinear_weight_exponent_ = 0;
     149             : 
     150           0 :   void (*reconstruct_)(gsl::not_null<std::array<gsl::span<double>, Dim>*>,
     151             :                        gsl::not_null<std::array<gsl::span<double>, Dim>*>,
     152             :                        const gsl::span<const double>&,
     153             :                        const DirectionMap<Dim, gsl::span<const double>>&,
     154             :                        const Index<Dim>&, size_t, double, double, double);
     155           0 :   void (*reconstruct_lower_neighbor_)(gsl::not_null<DataVector*>,
     156             :                                       const DataVector&, const DataVector&,
     157             :                                       const Index<Dim>&, const Index<Dim>&,
     158             :                                       const Direction<Dim>&, const double&,
     159             :                                       const double&, const double&);
     160           0 :   void (*reconstruct_upper_neighbor_)(gsl::not_null<DataVector*>,
     161             :                                       const DataVector&, const DataVector&,
     162             :                                       const Index<Dim>&, const Index<Dim>&,
     163             :                                       const Direction<Dim>&, const double&,
     164             :                                       const double&, const double&);
     165             : };
     166             : 
     167             : template <size_t Dim>
     168           0 : bool operator==(const AoWeno53<Dim>& lhs, const AoWeno53<Dim>& rhs);
     169             : 
     170             : template <size_t Dim>
     171           0 : bool operator!=(const AoWeno53<Dim>& lhs, const AoWeno53<Dim>& rhs);
     172             : }  // namespace ScalarAdvection::fd

Generated by: LCOV version 1.14