ReceiveGhWorldtubeData.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <string>
7 #include <tuple>
8 
10 #include "DataStructures/DataVector.hpp"
13 #include "Evolution/Systems/Cce/Actions/BoundaryComputeAndSendToEvolution.hpp"
14 #include "Evolution/Systems/Cce/InterfaceManagers/GhInterfaceManager.hpp"
15 #include "Evolution/Systems/Cce/OptionTags.hpp"
16 #include "Evolution/Systems/Cce/ReadBoundaryDataH5.hpp"
18 #include "Parallel/Invoke.hpp"
19 #include "Time/Tags.hpp"
20 #include "Time/TimeStepId.hpp"
21 #include "Utilities/Gsl.hpp"
22 #include "Utilities/Requires.hpp"
23 #include "Utilities/TMPL.hpp"
24 #include "Utilities/TypeTraits.hpp"
25 
26 namespace Cce {
27 namespace Actions {
28 
29 /*!
30  * \ingroup ActionsGroup
31  * \brief Stores the boundary data from the GH evolution in the
32  * `Cce::InterfaceManagers::GhInterfaceManager`, and sends to the
33  * `EvolutionComponent` (template argument) if the data fulfills a prior
34  * request.
35  *
36  * \details If the new data fulfills a prior request submitted to the
37  * `Cce::InterfaceManagers::GhInterfaceManager`, this will dispatch the result
38  * to `Cce::Actions::SendToEvolution<GhWorldtubeBoundary<Metavariables>,
39  * EvolutionComponent>` for sending the processed boundary data to
40  * the `EvolutionComponent`.
41  *
42  * \ref DataBoxGroup changes:
43  * - Adds: nothing
44  * - Removes: nothing
45  * - Modifies:
46  * - `Tags::GhInterfaceManager`
47  */
48 template <typename EvolutionComponent>
50  template <typename ParallelComponent, typename... DbTags,
51  typename Metavariables, typename ArrayIndex,
52  Requires<tmpl::list_contains_v<tmpl::list<DbTags...>,
53  Tags::GhInterfaceManager>> = nullptr>
54  static void apply(
55  db::DataBox<tmpl::list<DbTags...>>& box,
57  const ArrayIndex& /*array_index*/, const TimeStepId& time,
58  const tnsr::aa<DataVector, 3>& spacetime_metric,
59  const tnsr::iaa<DataVector, 3>& phi, const tnsr::aa<DataVector, 3>& pi,
60  const TimeStepId& next_time = TimeStepId{},
61  const tnsr::aa<DataVector, 3>& dt_spacetime_metric =
62  tnsr::aa<DataVector, 3>{},
63  const tnsr::iaa<DataVector, 3>& dt_phi = tnsr::iaa<DataVector, 3>{},
64  const tnsr::aa<DataVector, 3>& dt_pi =
65  tnsr::aa<DataVector, 3>{}) noexcept {
66  db::mutate<Tags::GhInterfaceManager>(
67  make_not_null(&box),
68  [&spacetime_metric, &phi, &pi, &dt_spacetime_metric, &dt_phi, &dt_pi,
69  &next_time, &time,
70  &cache](const gsl::not_null<
72  interface_manager) noexcept {
73  (*interface_manager)
74  ->insert_gh_data(time, spacetime_metric, phi, pi, next_time,
75  dt_spacetime_metric, dt_phi, dt_pi);
76  const auto gh_data =
77  (*interface_manager)->retrieve_and_remove_first_ready_gh_data();
78  if (static_cast<bool>(gh_data)) {
80  GhWorldtubeBoundary<Metavariables>, EvolutionComponent>>(
83  get<0>(*gh_data), get<1>(*gh_data));
84  }
85  });
86  }
87 };
88 } // namespace Actions
89 } // namespace Cce
Parallel::ConstGlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
GeneralizedHarmonic::pi
void pi(gsl::not_null< tnsr::aa< DataType, SpatialDim, Frame > * > pi, const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the conjugate momentum of the spacetime metric .
tuple
DataBox.hpp
GeneralizedHarmonic::phi
void phi(gsl::not_null< tnsr::iaa< DataType, SpatialDim, Frame > * > phi, const Scalar< DataType > &lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes the auxiliary variable used by the generalized harmonic formulation of Einstein's equations...
TimeStepId
Definition: TimeStepId.hpp:25
Variables.hpp
TimeStepId.hpp
Cce::Tags::GhInterfaceManager
Definition: OptionTags.hpp:322
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Cce::Actions::ReceiveGhWorldtubeData
Stores the boundary data from the GH evolution in the Cce::InterfaceManagers::GhInterfaceManager,...
Definition: ReceiveGhWorldtubeData.hpp:49
Gsl.hpp
Parallel::get_parallel_component
auto get_parallel_component(ConstGlobalCache< Metavariables > &cache) noexcept -> Parallel::proxy_from_parallel_component< ConstGlobalCache_detail::get_component_if_mocked< typename Metavariables::component_list, ParallelComponentTag >> &
Access the Charm++ proxy associated with a ParallelComponent.
Definition: ConstGlobalCache.hpp:223
gr::spacetime_metric
void spacetime_metric(gsl::not_null< tnsr::aa< DataType, Dim, Frame > * > spacetime_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, Dim, Frame > &shift, const tnsr::ii< DataType, Dim, Frame > &spatial_metric) noexcept
Computes the spacetime metric from the spatial metric, lapse, and shift.
Tensor.hpp
Requires.hpp
Cce::Actions::SendToEvolution
Computes Bondi boundary data from GH evolution variables and sends the result to the EvolutionCompone...
Definition: BoundaryComputeAndSendToEvolution.hpp:60
Cce::GhWorldtubeBoundary
Component that supplies CCE worldtube boundary data sourced from a running GH system.
Definition: WorldtubeBoundary.hpp:105
Parallel::simple_action
void simple_action(Proxy &&proxy) noexcept
Invoke a simple action on proxy
Definition: Invoke.hpp:111
make_not_null
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion,...
Definition: Gsl.hpp:879
Requires
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t
Definition: Requires.hpp:67
std::unique_ptr
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
TMPL.hpp
ConstGlobalCache.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:182
string