Interface.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <utility>
8 
11 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
12 #include "Utilities/TMPL.hpp"
13 
14 namespace Initialization {
15 
16 /// \brief Initialize items related to the interfaces between Elements and on
17 /// external boundaries
18 ///
19 /// DataBox changes:
20 /// - Adds:
21 /// * `face_tags<Tags::InternalDirections<Dim>>`
22 /// * `face_tags<Tags::BoundaryDirectionsInterior<Dim>>`
23 /// * `face_tags<Tags::BoundaryDirectionsExterior<Dim>>`
24 ///
25 /// - For face_tags:
26 /// * `Tags::InterfaceComputeItem<Directions, Tags::Direction<Dim>>`
27 /// * `Tags::InterfaceComputeItem<Directions, Tags::InterfaceMesh<Dim>>`
28 /// * `Tags::Slice<Directions, typename System::variables_tag>`
29 /// * `Tags::InterfaceComputeItem<Directions,
30 /// Tags::UnnormalizedFaceNormal<Dim>>`
31 /// * Tags::InterfaceComputeItem<Directions,
32 /// typename System::template magnitude_tag<
33 /// Tags::UnnormalizedFaceNormal<Dim>>>
34 /// * `Tags::InterfaceComputeItem<
35 /// Directions, Tags::Normalized<Tags::UnnormalizedFaceNormal<Dim>>>`
36 /// - Removes: nothing
37 /// - Modifies: nothing
38 template <typename System>
39 struct Interface {
40  static constexpr size_t dim = System::volume_dim;
41  using simple_tags =
43  typename System::variables_tag>>;
44 
45  template <typename Directions>
46  using face_tags = tmpl::list<
53  Tags::InterfaceComputeItem<Directions,
54  typename System::template magnitude_tag<
58 
59  using ext_tags = tmpl::list<
63  Tags::InterfaceComputeItem<Tags::BoundaryDirectionsExterior<dim>,
66  typename System::spacetime_variables_tag>,
67  Tags::Slice<Tags::BoundaryDirectionsExterior<dim>,
68  typename System::primitive_variables_tag>,
69  Tags::InterfaceComputeItem<Tags::BoundaryDirectionsExterior<dim>,
71  Tags::InterfaceComputeItem<Tags::BoundaryDirectionsExterior<dim>,
72  Tags::UnnormalizedFaceNormal<dim>>,
73  Tags::InterfaceComputeItem<Tags::BoundaryDirectionsExterior<dim>,
74  typename System::template magnitude_tag<
75  Tags::UnnormalizedFaceNormal<dim>>>,
77  Tags::BoundaryDirectionsExterior<dim>,
78  Tags::Normalized<Tags::UnnormalizedFaceNormal<dim>>>>;
79 
80  using compute_tags =
81  tmpl::append<face_tags<Tags::InternalDirections<dim>>,
82  face_tags<Tags::BoundaryDirectionsInterior<dim>>, ext_tags>;
83 
84  template <typename TagsList>
85  static auto initialize(db::DataBox<TagsList>&& box) noexcept {
86  const auto& mesh = db::get<Tags::Mesh<dim>>(box);
89  external_boundary_vars{};
90 
91  for (const auto& direction :
92  db::get<Tags::Element<dim>>(box).external_boundaries()) {
93  external_boundary_vars[direction] =
95  mesh.slice_away(direction.dimension()).number_of_grid_points()};
96  }
97 
98  return db::create_from<db::RemoveTags<>, simple_tags, compute_tags>(
99  std::move(box), std::move(external_boundary_vars));
100  }
101 };
102 
103 } // namespace Initialization
Items for initializing the DataBoxes of parallel components.
Definition: ConservativeSystem.hpp:21
The normalized (co)vector represented by Tag.
Definition: Magnitude.hpp:93
The unnormalized face normal one form.
Definition: FaceNormal.hpp:68
Direction to an interface
Definition: Tags.hpp:364
Computes the coordinates in the frame Frame on the faces defined by Direction. Intended to be prefixe...
Definition: Tags.hpp:392
Computes the VolumeDim-1 dimensional mesh on an interface from the volume mesh. Tags::InterfaceComput...
Definition: Tags.hpp:375
Derived tag for representing a compute item which acts on Tags on an interface. Can be retrieved usin...
Definition: Tags.hpp:440
Defines classes and functions used for manipulating DataBox&#39;s.
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1227
Initialize items related to the interfaces between Elements and on external boundaries.
Definition: Interface.hpp:39
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Derived tag for representing a compute item which slices a Tag containing a Variables from the volume...
Definition: Tags.hpp:479
The Element associated with the DataBox.
Definition: Tags.hpp:64
const auto & get(const DataBox< TagList > &box) noexcept
Retrieve the item with tag Tag from the DataBox.
Definition: DataBox.hpp:1211
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 classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
The set of directions which correspond to external boundaries. To be used to represent data which exi...
Definition: Tags.hpp:177