FluxCommunicationTypes.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <boost/functional/hash.hpp> // IWYU pragma: keep
7 #include <cstddef>
8 #include <map>
9 #include <unordered_map>
10 #include <utility>
11 
14 #include "DataStructures/DataVector.hpp" // IWYU pragma: keep
15 #include "DataStructures/FixedHashMap.hpp"
17 #include "DataStructures/Variables.hpp" // IWYU pragma: keep
19 #include "Domain/Direction.hpp" // IWYU pragma: keep
20 #include "Domain/ElementId.hpp" // IWYU pragma: keep
21 #include "Domain/MaxNumberOfNeighbors.hpp"
22 #include "Domain/Tags.hpp" // IWYU pragma: keep
23 #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
24 #include "Time/Tags.hpp" // IWYU pragma: keep
25 #include "Utilities/TMPL.hpp"
26 
27 /// \cond
28 namespace PUP {
29 class er;
30 } // namespace PUP
31 /// \endcond
32 
33 namespace dg {
34 /// \ingroup DiscontinuousGalerkinGroup
35 /// \brief Types related to flux communication.
36 template <typename Metavariables>
38  private:
39  using system = typename Metavariables::system;
40  static constexpr size_t volume_dim = system::volume_dim;
41 
42  public:
43  /// The type of the Variables sent to neighboring elements.
44  using PackagedData = Variables<
45  typename Metavariables::normal_dot_numerical_flux::type::package_tags>;
46 
47  /// The DataBox tag for the normal fluxes of the evolved variables.
48  using normal_dot_fluxes_tag =
50 
51  /// The type of the local data stored on the mortar. Contains the
52  /// packaged data and the local flux.
53  using LocalMortarData = Variables<tmpl::remove_duplicates<tmpl::append<
55  typename PackagedData::tags_list>>>;
56 
57  /// The type of the data needed for the local part of the flux
58  /// numerical flux computations. Contains the PackagedData, the
59  /// normal fluxes, and MagnitudeOfFaceNormal.
60  struct LocalData {
61  /// Data on the mortar mesh
63  /// Magnitude of the face normal on the face mesh
65 
66  // NOLINTNEXTLINE(google-runtime-references)
67  void pup(PUP::er& p) noexcept {
68  p | mortar_data;
69  p | magnitude_of_face_normal;
70  }
71  };
72 
73  private:
74  template <typename Base, typename Tag, size_t VolumeDim>
75  struct BasedMortars : Base, Tags::Mortars<Tag, VolumeDim> {};
76 
77  public:
78  /// The DataBox tag for the data stored on the mortars for global
79  /// stepping.
81  BasedMortars<Tags::VariablesBoundaryData,
85  volume_dim>;
86 
87  /// The DataBox tag for the data stored on the mortars for local
88  /// stepping.
89  using local_time_stepping_mortar_data_tag = BasedMortars<
90  Tags::VariablesBoundaryData,
91  Tags::BoundaryHistory<LocalData, PackagedData,
93  volume_dim>;
94 
95  /// The inbox tag for flux communication.
96  struct FluxesTag {
97  using temporal_id = db::item_type<typename Metavariables::temporal_id>;
98  using type = std::map<
99  temporal_id,
103  boost::hash<std::pair<Direction<volume_dim>,
104  ElementId<volume_dim>>>>>;
105  };
106 };
107 } // namespace dg
Prefix< DataBox_detail::dispatch_add_tag_prefix_impl< Prefix, Tag, Args... >, Args... > add_tag_prefix
Wrap Tag in Prefix<_, Args...>, also wrapping variables tags if Tag is a Tags::Variables.
Definition: DataBoxTag.hpp:533
Defines class template Direction.
Definition: Strahlkorper.hpp:14
constexpr size_t maximum_number_of_neighbors(const size_t dim)
Returns the maximum number of neighbors an element can have in dim dimensions.
Definition: MaxNumberOfNeighbors.hpp:13
Base tag for boundary data needed for updating the variables.
Definition: Tags.hpp:139
A hash table with a compile-time specified maximum size and ability to efficiently handle perfect has...
Definition: FixedHashMap.hpp:81
Definition: InitializeElement.hpp:63
An ElementId uniquely labels an Element. It is constructed from the BlockId of the Block to which the...
Definition: ElementId.hpp:36
LocalMortarData mortar_data
Data on the mortar mesh.
Definition: FluxCommunicationTypes.hpp:62
Define prefixes for DataBox tags.
Defines class ElementId.
Scalar< DataVector > magnitude_of_face_normal
Magnitude of the face normal on the face mesh.
Definition: FluxCommunicationTypes.hpp:64
Variables< tmpl::remove_duplicates< tmpl::append< typename db::item_type< normal_dot_fluxes_tag >::tags_list, typename PackagedData::tags_list > >> LocalMortarData
The type of the local data stored on the mortar. Contains the packaged data and the local flux...
Definition: FluxCommunicationTypes.hpp:55
Data on mortars, indexed by (Direction, ElementId) pairs.
Definition: Tags.hpp:34
The type of the data needed for the local part of the flux numerical flux computations. Contains the PackagedData, the normal fluxes, and MagnitudeOfFaceNormal.
Definition: FluxCommunicationTypes.hpp:60
Simple boundary communication data.
Definition: Tags.hpp:25
The inbox tag for flux communication.
Definition: FluxCommunicationTypes.hpp:96
Defines class Variables.
Types related to flux communication.
Definition: FluxCommunicationTypes.hpp:37
Defines a list of useful type aliases for tensors.
The Poisson equation formulated as a set of coupled first-order PDEs.
Definition: FirstOrderSystem.hpp:55
Wraps the template metaprogramming library used (brigand)
typename DataBox_detail::item_type_impl< TagList, Tag >::type item_type
Get the type that is returned by the Tag. If it is a base tag then a TagList must be passed as a seco...
Definition: DataBoxTag.hpp:410
Defines tags related to domain quantities.
BasedMortars< Tags::VariablesBoundaryData, Tags::SimpleBoundaryData< db::item_type< typename Metavariables::temporal_id >, LocalData, PackagedData >, volume_dim > simple_mortar_data_tag
The DataBox tag for the data stored on the mortars for global stepping.
Definition: FluxCommunicationTypes.hpp:85
Tag for TimeStepper boundary history.
Definition: Tags.hpp:85
Defines helper functions for use with Variables class.
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Variables< typename Metavariables::normal_dot_numerical_flux::type::package_tags > PackagedData
The type of the Variables sent to neighboring elements.
Definition: FluxCommunicationTypes.hpp:45
db::add_tag_prefix< Tags::NormalDotFlux, typename system::variables_tag > normal_dot_fluxes_tag
The DataBox tag for the normal fluxes of the evolved variables.
Definition: FluxCommunicationTypes.hpp:49
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
BasedMortars< Tags::VariablesBoundaryData, Tags::BoundaryHistory< LocalData, PackagedData, db::item_type< typename system::variables_tag > >, volume_dim > local_time_stepping_mortar_data_tag
The DataBox tag for the data stored on the mortars for local stepping.
Definition: FluxCommunicationTypes.hpp:93
Defines tags related to Time quantities.