InitializeCharacteristicEvolutionScri.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 #include <utility>
9 
11 #include "Evolution/Systems/Cce/OptionTags.hpp"
12 #include "Evolution/Systems/Cce/ScriPlusInterpolationManager.hpp"
13 #include "Parallel/GlobalCache.hpp"
14 #include "ParallelAlgorithms/Initialization/MutateAssign.hpp"
15 #include "Utilities/Rational.hpp"
16 #include "Utilities/Requires.hpp"
17 #include "Utilities/TMPL.hpp"
18 #include "Utilities/TaggedTuple.hpp"
19 
20 namespace Cce {
21 namespace Actions {
22 
23 /*!
24  * \ingroup ActionsGroup
25  * \brief Initializes the `CharacteristicEvolution` component with contents
26  * needed to perform the interpolation at scri+.
27  *
28  * \details Sets up the \ref DataBoxGroup to be ready to store data in the scri+
29  * interpolators and perform interpolation for the final scri+ outputs.
30  *
31  * \ref DataBoxGroup changes:
32  * - Modifies: nothing
33  * - Adds:
34  * - `Cce::Tags::InterpolationManager<ComplexDataVector, Tag>` for each `Tag`
35  * in `scri_values_to_observe`
36  * - Removes: nothing
37  *
38  * \note This action relies on the `SetupDataBox` aggregated initialization
39  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
40  * phase action list prior to this action.
41  */
42 template <typename ScriValuesToObserve>
44  using initialization_tags =
45  tmpl::list<InitializationTags::ScriInterpolationOrder>;
46  using const_global_cache_tags =
47  tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>;
48 
49  using simple_tags =
50  tmpl::transform<ScriValuesToObserve,
51  tmpl::bind<Tags::InterpolationManager,
52  tmpl::pin<ComplexDataVector>, tmpl::_1>>;
53 
54  using compute_tags = tmpl::list<>;
55 
56  template <typename DbTags, typename... InboxTags, typename Metavariables,
57  typename ArrayIndex, typename ActionList,
58  typename ParallelComponent>
59  static auto apply(db::DataBox<DbTags>& box,
60  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
61  const Parallel::GlobalCache<Metavariables>& /*cache*/,
62  const ArrayIndex& /*array_index*/,
63  const ActionList /*meta*/,
64  const ParallelComponent* const /*meta*/) noexcept {
65  initialize_impl(make_not_null(&box),
66  typename Metavariables::scri_values_to_observe{});
67  return std::make_tuple(std::move(box));
68  }
69 
70  template <typename TagList, typename... TagPack>
71  static void initialize_impl(const gsl::not_null<db::DataBox<TagList>*> box,
72  tmpl::list<TagPack...> /*meta*/) noexcept {
73  const size_t target_number_of_points =
74  db::get<InitializationTags::ScriInterpolationOrder>(*box);
75  const size_t vector_size =
77  db::get<Spectral::Swsh::Tags::LMaxBase>(*box));
78  // silence compiler warnings when pack is empty
79  (void)vector_size;
80  if constexpr (sizeof...(TagPack) > 0) {
81  Initialization::mutate_assign<simple_tags>(
83  target_number_of_points, vector_size,
84  std::make_unique<intrp::BarycentricRationalSpanInterpolator>(
85  2 * target_number_of_points - 1,
86  2 * target_number_of_points + 2)}...);
87  }
88  }
89 };
90 } // namespace Actions
91 } // namespace Cce
utility
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:15
GlobalCache.hpp
Cce::Tags::InterpolationManager
Definition: Tags.hpp:374
Cce::Actions::InitializeCharacteristicEvolutionScri
Initializes the CharacteristicEvolution component with contents needed to perform the interpolation a...
Definition: InitializeCharacteristicEvolutionScri.hpp:43
tuple
DataBox.hpp
cstddef
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Requires.hpp
Cce::ScriPlusInterpolationManager
Stores necessary data and interpolates on to new time points at scri+.
Definition: ScriPlusInterpolationManager.hpp:48
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:880
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecThirdOrderPiecewisePolynomial.hpp:13
Spectral::Swsh::number_of_swsh_collocation_points
constexpr size_t number_of_swsh_collocation_points(const size_t l_max) noexcept
Convenience function for determining the number of spin-weighted spherical harmonic collocation value...
Definition: SwshCollocation.hpp:25