MonotisedCentral.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <cstddef>
8 #include <utility>
9 
10 #include "DataStructures/DataBox/PrefixHelpers.hpp"
12 #include "DataStructures/FixedHashMap.hpp"
14 #include "DataStructures/VariablesTag.hpp"
15 #include "Domain/Structure/MaxNumberOfNeighbors.hpp"
16 #include "Domain/Tags.hpp"
17 #include "Evolution/DgSubcell/Tags/Mesh.hpp"
18 #include "Evolution/DgSubcell/Tags/NeighborData.hpp"
19 #include "Evolution/Systems/NewtonianEuler/FiniteDifference/Reconstructor.hpp"
20 #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
21 #include "Options/Options.hpp"
22 #include "PointwiseFunctions/Hydro/Tags.hpp"
23 #include "Utilities/TMPL.hpp"
24 
25 /// \cond
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 namespace evolution::dg::subcell {
37 struct NeighborData;
38 } // namespace evolution::dg::subcell
39 namespace gsl {
40 template <typename T>
41 class not_null;
42 } // namespace gsl
43 template <size_t Dim>
44 class Mesh;
45 template <typename TagsList>
46 class Variables;
47 /// \endcond
48 
49 namespace NewtonianEuler::fd {
50 /*!
51  * \brief Monotised central reconstruction. See
52  * `::fd::reconstruction::monotised_central()` for details.
53  */
54 template <size_t Dim>
55 class MonotisedCentralPrim : public Reconstructor<Dim> {
56  private:
57  // Conservative vars tags
61 
62  // Primitive vars tags
67 
68  using prims_tags =
69  tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>;
70  using cons_tags = tmpl::list<MassDensityCons, MomentumDensity, EnergyDensity>;
73  using prim_tags_for_reconstruction =
74  tmpl::list<MassDensity, Velocity, Pressure>;
75 
76  public:
77  using options = tmpl::list<>;
78  static constexpr Options::String help{
79  "Monotised central reconstruction scheme using primitive variables."};
80 
81  MonotisedCentralPrim() = default;
82  MonotisedCentralPrim(MonotisedCentralPrim&&) noexcept = default;
83  MonotisedCentralPrim& operator=(MonotisedCentralPrim&&) noexcept = default;
85  MonotisedCentralPrim& operator=(const MonotisedCentralPrim&) = default;
86  ~MonotisedCentralPrim() override = default;
87 
88  explicit MonotisedCentralPrim(CkMigrateMessage* msg) noexcept;
89 
90  WRAPPED_PUPable_decl_base_template(Reconstructor<Dim>, MonotisedCentralPrim);
91 
92  auto get_clone() const noexcept
94 
95  void pup(PUP::er& p) override;
96 
97  size_t ghost_zone_size() const noexcept override { return 2; }
98 
99  using reconstruction_argument_tags =
100  tmpl::list<::Tags::Variables<prims_tags>,
102  evolution::dg::subcell::Tags::
103  NeighborDataForReconstructionAndRdmpTci<Dim>,
105 
106  template <size_t ThermodynamicDim, typename TagsList>
107  void reconstruct(
108  gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_lower_face,
109  gsl::not_null<std::array<Variables<TagsList>, Dim>*> vars_on_upper_face,
110  const Variables<prims_tags>& volume_prims,
112  const Element<Dim>& element,
113  const FixedHashMap<
117  boost::hash<std::pair<Direction<Dim>, ElementId<Dim>>>>&
118  neighbor_data,
119  const Mesh<Dim>& subcell_mesh) const noexcept;
120 
121  /// Called by an element doing DG when the neighbor is doing subcell.
122  ///
123  /// This is used to reconstruct the fluxes on the mortar that the subcell
124  /// neighbor would have sent had we instead used a two a two-communication
125  /// subcell solver (first communication for reconstruction, second for
126  /// fluxes).
127  template <size_t ThermodynamicDim, typename TagsList>
129  gsl::not_null<Variables<TagsList>*> vars_on_face,
130  const Variables<prims_tags>& subcell_volume_prims,
132  const Element<Dim>& element,
133  const FixedHashMap<
137  boost::hash<std::pair<Direction<Dim>, ElementId<Dim>>>>&
138  neighbor_data,
139  const Mesh<Dim>& subcell_mesh,
140  const Direction<Dim> direction_to_reconstruct) const noexcept;
141 };
142 
143 template <size_t Dim>
144 bool operator==(const MonotisedCentralPrim<Dim>& /*lhs*/,
145  const MonotisedCentralPrim<Dim>& /*rhs*/) noexcept {
146  return true;
147 }
148 
149 template <size_t Dim>
150 bool operator!=(const MonotisedCentralPrim<Dim>& lhs,
151  const MonotisedCentralPrim<Dim>& rhs) noexcept {
152  return not(lhs == rhs);
153 }
154 } // namespace NewtonianEuler::fd
EquationsOfState
Contains all equations of state, including base class.
Definition: DarkEnergyFluid.hpp:26
maximum_number_of_neighbors
constexpr size_t maximum_number_of_neighbors(const size_t dim)
Definition: MaxNumberOfNeighbors.hpp:15
utility
Frame::Inertial
Definition: IndexType.hpp:44
EquationsOfState::EquationOfState
Base class for equations of state depending on whether or not the system is relativistic,...
Definition: EquationOfState.hpp:63
std::pair
Options.hpp
Tags.hpp
domain::Tags::Element
Definition: Tags.hpp:97
NewtonianEuler::Tags::MassDensity
The mass density of the fluid.
Definition: Tags.hpp:26
NewtonianEuler::Tags::SpecificInternalEnergy
The specific internal energy of the fluid.
Definition: Tags.hpp:60
NewtonianEuler::Tags::MassDensityCons
The mass density of the fluid (as a conservative variable).
Definition: Tags.hpp:31
Direction
Definition: Direction.hpp:23
Element
Definition: Element.hpp:29
ElementId
An ElementId uniquely labels an Element.
Definition: ElementId.hpp:51
NewtonianEuler::fd::MonotisedCentralPrim::reconstruct_fd_neighbor
void reconstruct_fd_neighbor(gsl::not_null< Variables< TagsList > * > vars_on_face, const Variables< prims_tags > &subcell_volume_prims, const EquationsOfState::EquationOfState< false, ThermodynamicDim > &eos, const Element< Dim > &element, const FixedHashMap< maximum_number_of_neighbors(Dim)+1, std::pair< Direction< Dim >, ElementId< Dim >>, evolution::dg::subcell::NeighborData, boost::hash< std::pair< Direction< Dim >, ElementId< Dim >>>> &neighbor_data, const Mesh< Dim > &subcell_mesh, const Direction< Dim > direction_to_reconstruct) const noexcept
Called by an element doing DG when the neighbor is doing subcell.
NewtonianEuler::fd::MonotisedCentralPrim
Monotised central reconstruction. See fd::reconstruction::monotised_central() for details.
Definition: MonotisedCentral.hpp:55
cstddef
array
NewtonianEuler::fd
Finite difference functionality for Newtonian Euler.
Definition: AoWeno.hpp:25
NewtonianEuler::Tags::Pressure
The fluid pressure.
Definition: Tags.hpp:66
NewtonianEuler::Tags::EnergyDensity
The energy density of the fluid.
Definition: Tags.hpp:45
evolution::dg::subcell::Tags::Mesh
The mesh on the subcells.
Definition: Mesh.hpp:18
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:49
evolution::dg::subcell::NeighborData
Holds neighbor data needed for the TCI and reconstruction.
Definition: NeighborData.hpp:24
NewtonianEuler::Tags::MomentumDensity
The momentum density of the fluid.
Definition: Tags.hpp:37
evolution::dg::subcell
Implementation of a generic finite volume/conservative finite difference subcell limiter.
Definition: Actions.hpp:6
TypeAliases.hpp
hydro::Tags::EquationOfStateBase
Base tag for the equation of state.
Definition: Tags.hpp:53
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
db::wrap_tags_in
tmpl::transform< TagList, tmpl::bind< Wrapper, tmpl::_1, tmpl::pin< Args >... > > wrap_tags_in
Create a new tmpl::list of tags by wrapping each tag in TagList in Wrapper<_, Args....
Definition: PrefixHelpers.hpp:30
NewtonianEuler::Tags::Velocity
The macroscopic or flow velocity of the fluid.
Definition: Tags.hpp:51
FixedHashMap
A hash table with a compile-time specified maximum size and ability to efficiently handle perfect has...
Definition: FixedHashMap.hpp:82
std::unique_ptr
Prefixes.hpp
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecPiecewisePolynomial.hpp:11
TMPL.hpp
NewtonianEuler::fd::Reconstructor
The base class from which all reconstruction schemes must inherit.
Definition: Reconstructor.hpp:33
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13