InitializeElement.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 
10 #include "Domain/Domain.hpp"
11 #include "Elliptic/Initialization/BoundaryConditions.hpp"
12 #include "Elliptic/Initialization/Derivatives.hpp"
13 #include "Elliptic/Initialization/DiscontinuousGalerkin.hpp"
14 #include "Elliptic/Initialization/Domain.hpp"
15 #include "Elliptic/Initialization/Interface.hpp"
16 #include "Elliptic/Initialization/LinearSolver.hpp"
17 #include "Elliptic/Initialization/Source.hpp"
18 #include "Elliptic/Initialization/System.hpp"
20 #include "Utilities/TMPL.hpp"
21 
22 /// \cond
23 // IWYU pragma: no_forward_declare db::DataBox
24 template <size_t VolumeDim>
25 class ElementIndex;
26 namespace Frame {
27 struct Inertial;
28 } // namespace Frame
29 namespace tuples {
30 template <typename... Tags>
31 class TaggedTuple; // IWYU pragma: keep
32 } // namespace tuples
33 /// \endcond
34 
35 namespace Elliptic {
36 namespace dg {
37 namespace Actions {
38 
39 /*!
40  * \brief Initializes the DataBox of each element in the DgElementArray
41  *
42  * The following initializers are chained together (in this order):
43  *
44  * - `Elliptic::Initialization::Domain`
45  * - `Elliptic::Initialization::System`
46  * - `Elliptic::Initialization::Source`
47  * - `Elliptic::Initialization::Derivatives`
48  * - `Elliptic::Initialization::Interface`
49  * - `Elliptic::Initialization::BoundaryConditions`
50  * - `Elliptic::Initialization::LinearSolver`
51  * - `Elliptic::Initialization::DiscontinuousGalerkin`
52  */
53 template <size_t Dim>
55  template <class Metavariables>
56  using return_tag_list = tmpl::append<
57  // Simple tags
58  typename Elliptic::Initialization::Domain<Dim>::simple_tags,
60  typename Metavariables::system>::simple_tags,
61  typename Elliptic::Initialization::Source<Metavariables>::simple_tags,
63  typename Metavariables::system>::simple_tags,
65  typename Metavariables::system>::simple_tags,
67  Metavariables>::simple_tags,
69  Metavariables>::simple_tags,
71  Metavariables>::simple_tags,
72  // Compute tags
73  typename Elliptic::Initialization::Domain<Dim>::compute_tags,
75  typename Metavariables::system>::compute_tags,
76  typename Elliptic::Initialization::Source<Metavariables>::compute_tags,
78  typename Metavariables::system>::compute_tags,
80  typename Metavariables::system>::compute_tags,
82  Metavariables>::compute_tags,
84  Metavariables>::compute_tags,
86  Metavariables>::compute_tags>;
87 
88  template <typename... InboxTags, typename Metavariables, typename ActionList,
89  typename ParallelComponent>
90  static auto apply(const db::DataBox<tmpl::list<>>& /*box*/,
91  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
93  const ElementIndex<Dim>& array_index,
94  const ActionList /*meta*/,
95  const ParallelComponent* const parallel_component_meta,
96  std::vector<std::array<size_t, Dim>> initial_extents,
98  using system = typename Metavariables::system;
100  db::DataBox<tmpl::list<>>{}, array_index, initial_extents, domain);
102  std::move(domain_box));
103  auto source_box =
105  std::move(system_box), cache);
106  auto deriv_box = Elliptic::Initialization::Derivatives<
107  typename Metavariables::system>::initialize(std::move(source_box));
109  std::move(deriv_box));
110  auto boundary_conditions_box =
112  std::move(face_box), cache);
113  auto linear_solver_box =
115  std::move(boundary_conditions_box), cache, array_index,
116  parallel_component_meta);
118  Metavariables>::initialize(std::move(linear_solver_box),
119  initial_extents);
120  return std::make_tuple(std::move(dg_box));
121  }
122 };
123 } // namespace Actions
124 } // namespace dg
125 } // namespace Elliptic
Definition: BlockId.hpp:16
Definition: ComputeOperatorAction.hpp:28
Initializes DataBox tags related to discontinuous Galerkin fluxes.
Definition: DiscontinuousGalerkin.hpp:74
Definition: InitializeElement.hpp:63
Definition: TaggedTuple.hpp:25
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args)
Apply the function f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1595
Computes the sources of the elliptic equations and adds them to the DataBox.
Definition: Source.hpp:53
Defines class template Domain.
Adds boundary contributions to the sources.
Definition: BoundaryConditions.hpp:69
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Defines classes and functions used for manipulating DataBox&#39;s.
Initializes the DataBox tags related to data on the element faces.
Definition: Interface.hpp:63
Indicates the Frame that a TensorIndexType is in.
Definition: IndexType.hpp:36
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Initializes the DataBox tag related to the computational domain.
Definition: Domain.hpp:49
Definition: DataBoxTag.hpp:29
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:76
Initializes the DataBox tags related to the system.
Definition: System.hpp:42
Initializes the DataBox tag related to the linear solver.
Definition: LinearSolver.hpp:51
A wrapper around a vector of Blocks that represent the computational domain.
Definition: Domain.hpp:38
The Poisson equation formulated as a set of coupled first-order PDEs.
Definition: FirstOrderSystem.hpp:55
Wraps the template metaprogramming library used (brigand)
Initializes the DataBox of each element in the DgElementArray.
Definition: InitializeElement.hpp:54
Initializes the DataBox tags related to derivatives of the system variables.
Definition: Derivatives.hpp:44
Definition: SolvePoissonProblem.hpp:38
A class for indexing a Charm array by Element.
Definition: ElementIndex.hpp:53
Defines class template ConstGlobalCache.
Definition: ComputeTimeDerivative.hpp:28