SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/NewtonianEuler/FiniteDifference - AoWeno.hpp Hit Total Coverage
Commit: e93d8312de4f331d36b5aa00ea83a894e26dfcb7 Lines: 3 52 5.8 %
Date: 2021-09-24 22:40:29
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 <boost/functional/hash.hpp>
       8             : #include <cstddef>
       9             : #include <limits>
      10             : #include <memory>
      11             : 
      12             : #include "DataStructures/DataBox/PrefixHelpers.hpp"
      13             : #include "DataStructures/DataBox/Prefixes.hpp"
      14             : #include "DataStructures/FixedHashMap.hpp"
      15             : #include "DataStructures/Tensor/TypeAliases.hpp"
      16             : #include "Domain/Structure/MaxNumberOfNeighbors.hpp"
      17             : #include "Domain/Tags.hpp"
      18             : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
      19             : #include "Evolution/DgSubcell/Tags/NeighborData.hpp"
      20             : #include "Evolution/Systems/NewtonianEuler/FiniteDifference/Reconstructor.hpp"
      21             : #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
      22             : #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"
      23             : #include "PointwiseFunctions/Hydro/Tags.hpp"
      24             : 
      25           1 : namespace NewtonianEuler::fd {
      26             : /*!
      27             :  * \brief Adaptive-order WENO reconstruction hybridizing orders 5 and 3. See
      28             :  * ::fd::reconstruction::aoweno_53() for details.
      29             :  */
      30             : template <size_t Dim>
      31           1 : class AoWeno53Prim : public Reconstructor<Dim> {
      32             :  private:
      33             :   // Conservative vars tags
      34           0 :   using MassDensityCons = Tags::MassDensityCons;
      35           0 :   using EnergyDensity = Tags::EnergyDensity;
      36           0 :   using MomentumDensity = Tags::MomentumDensity<Dim>;
      37             : 
      38             :   // Primitive vars tags
      39           0 :   using MassDensity = Tags::MassDensity<DataVector>;
      40           0 :   using Velocity = Tags::Velocity<DataVector, Dim>;
      41           0 :   using SpecificInternalEnergy = Tags::SpecificInternalEnergy<DataVector>;
      42           0 :   using Pressure = Tags::Pressure<DataVector>;
      43             : 
      44           0 :   using prims_tags =
      45             :       tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>;
      46           0 :   using cons_tags = tmpl::list<MassDensityCons, MomentumDensity, EnergyDensity>;
      47           0 :   using flux_tags = db::wrap_tags_in<::Tags::Flux, cons_tags, tmpl::size_t<Dim>,
      48             :                                      Frame::Inertial>;
      49           0 :   using prim_tags_for_reconstruction =
      50             :       tmpl::list<MassDensity, Velocity, Pressure>;
      51             : 
      52             :  public:
      53           0 :   struct GammaHi {
      54           0 :     using type = double;
      55           0 :     static constexpr Options::String help = {
      56             :         "The linear weight for the 5th-order stencil."};
      57             :   };
      58           0 :   struct GammaLo {
      59           0 :     using type = double;
      60           0 :     static constexpr Options::String help = {
      61             :         "The linear weight for the central 3rd-order stencil."};
      62             :   };
      63           0 :   struct Epsilon {
      64           0 :     using type = double;
      65           0 :     static constexpr Options::String help = {
      66             :         "The parameter added to the oscillation indicators to avoid division "
      67             :         "by zero"};
      68             :   };
      69           0 :   struct NonlinearWeightExponent {
      70           0 :     using type = size_t;
      71           0 :     static constexpr Options::String help = {
      72             :         "The exponent q to which the oscillation indicators are raised"};
      73             :   };
      74             : 
      75           0 :   using options =
      76             :       tmpl::list<GammaHi, GammaLo, Epsilon, NonlinearWeightExponent>;
      77           0 :   static constexpr Options::String help{
      78             :       "Monotised central reconstruction scheme using primitive variables."};
      79             : 
      80           0 :   AoWeno53Prim() = default;
      81           0 :   AoWeno53Prim(AoWeno53Prim&&) noexcept = default;
      82           0 :   AoWeno53Prim& operator=(AoWeno53Prim&&) noexcept = default;
      83           0 :   AoWeno53Prim(const AoWeno53Prim&) = default;
      84           0 :   AoWeno53Prim& operator=(const AoWeno53Prim&) = default;
      85           0 :   ~AoWeno53Prim() override = default;
      86             : 
      87           0 :   AoWeno53Prim(double gamma_hi, double gamma_lo, double epsilon,
      88             :                size_t nonlinear_weight_exponent) noexcept;
      89             : 
      90           0 :   explicit AoWeno53Prim(CkMigrateMessage* msg) noexcept;
      91             : 
      92           0 :   WRAPPED_PUPable_decl_base_template(Reconstructor<Dim>, AoWeno53Prim);
      93             : 
      94           0 :   auto get_clone() const noexcept
      95             :       -> std::unique_ptr<Reconstructor<Dim>> override;
      96             : 
      97           0 :   void pup(PUP::er& p) override;
      98             : 
      99           0 :   size_t ghost_zone_size() const noexcept override { return 3; }
     100             : 
     101           0 :   using reconstruction_argument_tags =
     102             :       tmpl::list<::Tags::Variables<prims_tags>,
     103             :                  hydro::Tags::EquationOfStateBase, domain::Tags::Element<Dim>,
     104             :                  evolution::dg::subcell::Tags::
     105             :                      NeighborDataForReconstructionAndRdmpTci<Dim>,
     106             :                  evolution::dg::subcell::Tags::Mesh<Dim>>;
     107             : 
     108             :   template <size_t ThermodynamicDim, typename TagsList>
     109           0 :   void reconstruct(
     110             :       gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_lower_face,
     111             :       gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_upper_face,
     112             :       const Variables<prims_tags>& volume_prims,
     113             :       const EquationsOfState::EquationOfState<false, ThermodynamicDim>& eos,
     114             :       const Element<Dim>& element,
     115             :       const FixedHashMap<
     116             :           maximum_number_of_neighbors(Dim) + 1,
     117             :           std::pair<Direction<Dim>, ElementId<Dim>>,
     118             :           evolution::dg::subcell::NeighborData,
     119             :           boost::hash<std::pair<Direction<Dim>, ElementId<Dim>>>>&
     120             :           neighbor_data,
     121             :       const Mesh<Dim>& subcell_mesh) const noexcept;
     122             : 
     123             :   /// Called by an element doing DG when the neighbor is doing subcell.
     124             :   template <size_t ThermodynamicDim, typename TagsList>
     125           1 :   void reconstruct_fd_neighbor(
     126             :       gsl::not_null<Variables<TagsList>*> vars_on_face,
     127             :       const Variables<prims_tags>& subcell_volume_prims,
     128             :       const EquationsOfState::EquationOfState<false, ThermodynamicDim>& eos,
     129             :       const Element<Dim>& element,
     130             :       const FixedHashMap<
     131             :           maximum_number_of_neighbors(Dim) + 1,
     132             :           std::pair<Direction<Dim>, ElementId<Dim>>,
     133             :           evolution::dg::subcell::NeighborData,
     134             :           boost::hash<std::pair<Direction<Dim>, ElementId<Dim>>>>&
     135             :           neighbor_data,
     136             :       const Mesh<Dim>& subcell_mesh,
     137             :       const Direction<Dim> direction_to_reconstruct) const noexcept;
     138             : 
     139             :  private:
     140             :   template <size_t LocalDim>
     141             :   // NOLINTNEXTLINE(readability-redundant-declaration)
     142           0 :   friend bool operator==(const AoWeno53Prim<LocalDim>& lhs,
     143             :                          const AoWeno53Prim<LocalDim>& rhs) noexcept;
     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,
     155             :                        double) noexcept;
     156           0 :   void (*reconstruct_lower_neighbor_)(gsl::not_null<DataVector*>,
     157             :                                       const DataVector&, const DataVector&,
     158             :                                       const Index<Dim>&, const Index<Dim>&,
     159             :                                       const Direction<Dim>&, const double&,
     160             :                                       const double&, const double&) noexcept;
     161           0 :   void (*reconstruct_upper_neighbor_)(gsl::not_null<DataVector*>,
     162             :                                       const DataVector&, const DataVector&,
     163             :                                       const Index<Dim>&, const Index<Dim>&,
     164             :                                       const Direction<Dim>&, const double&,
     165             :                                       const double&, const double&) noexcept;
     166             : };
     167             : 
     168             : template <size_t Dim>
     169           0 : bool operator!=(const AoWeno53Prim<Dim>& lhs,
     170             :                 const AoWeno53Prim<Dim>& rhs) noexcept {
     171             :   return not(lhs == rhs);
     172             : }
     173             : }  // namespace NewtonianEuler::fd

Generated by: LCOV version 1.14