RequestBoundaryData.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <tuple>
7 #include <utility>
8 
10 #include "Evolution/Systems/Cce/Actions/BoundaryComputeAndSendToEvolution.hpp"
12 #include "Parallel/Invoke.hpp"
13 #include "Time/Tags.hpp"
14 
15 namespace Cce {
16 namespace Actions {
17 
18 /*!
19  * \ingroup ActionsGroup
20  * \brief Requests boundary data be sent from `WorldtubeBoundaryComponent` to
21  * `EvolutionComponent` (template parameters).
22  *
23  * \details Calls the simple action
24  * `Cce::Actions::BoundaryComputeAndSendToEvolution<WorldtubeBoundaryComponent,
25  * EvolutionComponent>` on the `WorldtubeBoundaryComponent`, which performs
26  * boundary computations then sends data to the `EvolutionComponent` via
27  * `Cce::Actions::ReceiveWorldtubeData`. Requests the current
28  * `Tags::TimeStepId`. For the majority of these requests, it's better to issue
29  * them as early as possible to maximize the degree of parallelism for the
30  * system, so most calls should use `Cce::Actions::RequestNextBoundaryData`,
31  * because it can be called the substep prior to when the data will actually be
32  * used.
33  *
34  * Uses:
35  * - DataBox:
36  * - `Tags::TimeStepId`
37  *
38  * \ref DataBoxGroup changes
39  * - Adds: nothing
40  * - Removes: nothing
41  * - Modifies: nothing
42  */
43 template <typename WorldtubeBoundaryComponent, typename EvolutionComponent>
45  template <typename DbTags, typename... InboxTags, typename Metavariables,
46  typename ArrayIndex, typename ActionList,
47  typename ParallelComponent>
48  static auto apply(db::DataBox<DbTags>& box,
49  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
51  const ArrayIndex& /*array_index*/,
52  const ActionList /*meta*/,
53  const ParallelComponent* const /*meta*/) noexcept {
55  WorldtubeBoundaryComponent, EvolutionComponent>>(
56  Parallel::get_parallel_component<WorldtubeBoundaryComponent>(cache),
57  db::get<::Tags::TimeStepId>(box));
58  return std::forward_as_tuple(std::move(box));
59  }
60 };
61 
62 /*!
63  * \ingroup ActionsGroup
64  * \brief Requests boundary data be sent from `WorldtubeBoundaryComponent` to
65  * `EvolutionComponent`.
66  *
67  * \details Calls the simple action
68  * `Cce::Actions::BoundaryComputeAndSendToEvolution<WorldtubeBoundaryComponent,
69  * EvolutionComponent>` on the `WorldtubeBoundaryComponent`, which performs
70  * boundary computations then sends data to the `EvolutionComponent` via
71  * `Cce::Actions::ReceiveWorldtubeData`. Requests the
72  * `Tags::Next<Tags::TimeStepId>` (for the next timestep).
73  *
74  * Uses:
75  * - DataBox:
76  * - `Tags::Next<Tags::TimeStepId>`
77  *
78  * \ref DataBoxGroup changes
79  * - Adds: nothing
80  * - Removes: nothing
81  * - Modifies: nothing
82  */
83 template <typename WorldtubeBoundaryComponent, typename EvolutionComponent>
85  using const_global_cache_tags =
86  tmpl::list<typename WorldtubeBoundaryComponent::end_time_tag>;
87 
88  template <typename DbTags, typename... InboxTags, typename Metavariables,
89  typename ArrayIndex, typename ActionList,
90  typename ParallelComponent>
91  static auto apply(db::DataBox<DbTags>& box,
92  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
94  const ArrayIndex& /*array_index*/,
95  const ActionList /*meta*/,
96  const ParallelComponent* const /*meta*/) noexcept {
97  // only request the data if the next step is not after the end time.
98  if (db::get<::Tags::Next<::Tags::TimeStepId>>(box).substep_time().value() <
99  db::get<Tags::EndTime>(box)) {
101  WorldtubeBoundaryComponent, EvolutionComponent>>(
102  Parallel::get_parallel_component<WorldtubeBoundaryComponent>(cache),
103  db::get<::Tags::Next<::Tags::TimeStepId>>(box));
104  }
105  return std::forward_as_tuple(std::move(box));
106  }
107 };
108 } // namespace Actions
109 } // namespace Cce
Parallel::ConstGlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
Cce::Actions::RequestNextBoundaryData
Requests boundary data be sent from WorldtubeBoundaryComponent to EvolutionComponent.
Definition: RequestBoundaryData.hpp:84
utility
Cce::Actions::RequestBoundaryData
Requests boundary data be sent from WorldtubeBoundaryComponent to EvolutionComponent (template parame...
Definition: RequestBoundaryData.hpp:44
tuple
db::get
const auto & get(const DataBox< TagList > &box) noexcept
Retrieve the item with tag Tag from the DataBox.
Definition: DataBox.hpp:1134
Tags::Next
Prefix indicating the value a quantity will take on the next iteration of the algorithm.
Definition: Prefixes.hpp:118
DataBox.hpp
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Parallel::simple_action
void simple_action(Proxy &&proxy) noexcept
Invoke a simple action on proxy
Definition: Invoke.hpp:111
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Cce::Actions::BoundaryComputeAndSendToEvolution
Obtains the CCE boundary data at the specified time, and reports it to the EvolutionComponent via Act...
Definition: BoundaryComputeAndSendToEvolution.hpp:40
ConstGlobalCache.hpp