GhInterfaceManager.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <boost/optional.hpp>
7 #include <memory>
8 #include <tuple>
9 
12 #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
13 #include "Options/Options.hpp"
15 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
16 #include "Time/TimeStepId.hpp"
17 
18 namespace Cce {
19 namespace InterfaceManagers {
20 
21 /// \cond
22 class GhLocalTimeStepping;
23 class GhLockstep;
24 /// \endcond
25 
26 /*!
27  * \brief Abstract base class for storage and retrieval of generalized harmonic
28  * quantities communicated from a Cauchy simulation to the Cce system.
29  *
30  * \details The functions that are required to be overriden in the derived
31  * classes are:
32  * - `GhInterfaceManager::get_clone()`: should return a
33  * `std::unique_ptr<GhInterfaceManager>` with cloned state.
34  * - `GhInterfaceManager::insert_gh_data()`: should store the portions
35  * of the provided generalized harmonic data that are required to provide useful
36  * boundary values for the CCE evolution at requested timesteps.
37  * - `GhInterfaceManager::request_gh_data()`: should register requests
38  * from the CCE evolution for boundary data.
39  * - `GhInterfaceManager::retrieve_and_remove_first_ready_gh_data()`:
40  * should return a `boost::optional<std::tuple<TimeStepId,
41  * tnsr::aa<DataVector, 3>, tnsr::iaa<DataVector, 3>, tnsr::aa<DataVector, 3>>>`
42  * containing the boundary data associated with the oldest requested timestep if
43  * enough data has been supplied via `insert_gh_data()` to determine the
44  * boundary data. Otherwise, return a `boost::none` to indicate that the CCE
45  * system must continue waiting for generalized harmonic input.
46  * - `GhInterfaceManager::number_of_pending_requests()`: should return
47  * the number of requests that have been registered to the class that do not yet
48  * been retrieved via `retrieve_and_remove_first_ready_gh_data()`.
49  * - `GhInterfaceManager::number_of_gh_times()`: should return the
50  * number of time steps sent to `insert_gh_data()` that have not yet been
51  * retrieved via `retrieve_and_remove_first_ready_gh_data()`.
52  */
53 class GhInterfaceManager : public PUP::able {
54  public:
55  using gh_variables = Variables<
56  tmpl::list<gr::Tags::SpacetimeMetric<3, ::Frame::Inertial, DataVector>,
59 
60  using creatable_classes = tmpl::list<GhLocalTimeStepping, GhLockstep>;
61 
62  WRAPPED_PUPable_abstract(GhInterfaceManager); // NOLINT
63 
64  virtual std::unique_ptr<GhInterfaceManager> get_clone() const noexcept = 0;
65 
66  virtual void insert_gh_data(
67  TimeStepId time_id, const tnsr::aa<DataVector, 3>& spacetime_metric,
68  const tnsr::iaa<DataVector, 3>& phi, const tnsr::aa<DataVector, 3>& pi,
69  TimeStepId next_time_id,
70  const tnsr::aa<DataVector, 3>& dt_spacetime_metric,
71  const tnsr::iaa<DataVector, 3>& dt_phi,
72  const tnsr::aa<DataVector, 3>& dt_pi) noexcept = 0;
73 
74  virtual void request_gh_data(const TimeStepId&) noexcept = 0;
75 
76  virtual auto retrieve_and_remove_first_ready_gh_data() noexcept
77  -> boost::optional<std::tuple<TimeStepId, gh_variables>> = 0;
78 
79  virtual size_t number_of_pending_requests() const noexcept = 0;
80 
81  virtual size_t number_of_gh_times() const noexcept = 0;
82 };
83 
84 } // namespace InterfaceManagers
85 } // namespace Cce
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 .
CharmPupable.hpp
Options.hpp
tuple
Cce::InterfaceManagers::GhInterfaceManager
Abstract base class for storage and retrieval of generalized harmonic quantities communicated from a ...
Definition: GhInterfaceManager.hpp:53
GeneralizedHarmonic::Tags::Pi
Conjugate momentum to the spacetime metric.
Definition: Tags.hpp:29
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...
memory
TimeStepId
Definition: TimeStepId.hpp:25
TimeStepId.hpp
GeneralizedHarmonic::Tags::Phi
Auxiliary variable which is analytically the spatial derivative of the spacetime metric.
Definition: Tags.hpp:40
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
TypeAliases.hpp
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
std::unique_ptr