InitializeFluxes.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <tuple>
8 
11 #include "Domain/Tags.hpp"
12 #include "Elliptic/FirstOrderComputeTags.hpp"
13 #include "Elliptic/Tags.hpp"
14 #include "NumericalAlgorithms/DiscontinuousGalerkin/NormalDotFlux.hpp"
16 #include "ParallelAlgorithms/Initialization/MergeIntoDataBox.hpp"
17 #include "Utilities/TMPL.hpp"
18 
19 /// \cond
20 namespace Parallel {
21 template <typename Metavariables>
22 struct ConstGlobalCache;
23 } // namespace Parallel
24 namespace tuples {
25 template <typename... Tags>
26 struct TaggedTuple;
27 } // namespace tuples
28 /// \endcond
29 
30 namespace elliptic {
31 namespace dg {
32 namespace Actions {
33 
34 /*!
35  * \brief Initialize DataBox tags related to discontinuous Galerkin fluxes
36  *
37  * Uses:
38  * - System:
39  * - `volume_dim`
40  * - `variables_tag`
41  * - `fluxes`
42  */
43 template <typename Metavariables>
45  private:
46  using system = typename Metavariables::system;
47  static constexpr size_t volume_dim = system::volume_dim;
48  using vars_tag = typename system::variables_tag;
49  using fluxes_tag =
52  using div_fluxes_tag = db::add_tag_prefix<::Tags::div, fluxes_tag>;
53 
54  template <typename Directions>
55  using face_tags =
56  tmpl::list<::Tags::Slice<Directions, fluxes_tag>,
58  // For the strong first-order DG scheme we also need the
59  // interface normal dotted into the fluxes
61  Directions, ::Tags::NormalDotFluxCompute<
62  vars_tag, volume_dim, Frame::Inertial>>>;
63 
64  using fluxes_compute_tag =
66 
67  using exterior_tags = tmpl::list<
68  // On exterior (ghost) boundary faces we compute the fluxes from the
69  // data that is being set there to impose boundary conditions. Then, we
70  // compute their normal-dot-fluxes. The flux divergences are sliced from
71  // the volume.
78  div_fluxes_tag>>;
79 
80  public:
81  template <typename DbTagsList, typename... InboxTags, typename ArrayIndex,
82  typename ActionList, typename ParallelComponent>
83  static auto apply(db::DataBox<DbTagsList>& box,
84  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
86  const ArrayIndex& /*array_index*/,
87  const ActionList /*meta*/,
88  const ParallelComponent* const /*meta*/) noexcept {
89  using compute_tags = tmpl::flatten<
90  tmpl::list<face_tags<::Tags::InternalDirections<volume_dim>>,
91  face_tags<::Tags::BoundaryDirectionsInterior<volume_dim>>,
92  exterior_tags>>;
93  return std::make_tuple(
95  db::AddSimpleTags<>, compute_tags>(
96  std::move(box)));
97  }
98 };
99 } // namespace Actions
100 } // namespace dg
101 } // namespace elliptic
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:616
Derived tag for representing a compute item which acts on Tags on an interface. Can be retrieved usin...
Definition: InterfaceComputeTags.hpp:117
Definition: InitializeAnalyticSolution.hpp:27
Definition: ApplyBoundaryFluxesLocalTimeStepping.hpp:33
Definition: TaggedTuple.hpp:27
Define prefixes for DataBox tags.
Contains functions that forward to Charm++ parallel functions.
Definition: Abort.hpp:13
auto merge_into_databox(db::DataBox< DbTagsList > &&box, Args &&... args) noexcept
Add tags that are not yet in the DataBox.
Definition: MergeIntoDataBox.hpp:132
Prefix computing a boundary unit normal vector dotted into the flux from a flux on the boundary...
Definition: NormalDotFlux.hpp:57
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:273
Defines classes and functions used for manipulating DataBox&#39;s.
Definition: FirstOrderComputeTags.hpp:24
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1222
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Derived tag for representing a compute item which slices a Tag containing a Tensor or a Variables fro...
Definition: InterfaceComputeTags.hpp:156
Definition: DataBoxTag.hpp:29
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:135
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args) noexcept
Apply the invokable f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1623
Wraps the template metaprogramming library used (brigand)
Defines tags related to domain quantities.
Definition: IndexType.hpp:44
The set of directions which correspond to external boundaries. To be used to represent data which exi...
Definition: Tags.hpp:223
Initialize DataBox tags related to discontinuous Galerkin fluxes.
Definition: InitializeFluxes.hpp:44
Defines functions and tags for taking a divergence.
Definition: ComputeTimeDerivative.hpp:28