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 
12 #include "Evolution/Systems/Cce/OptionTags.hpp"
13 #include "Evolution/Systems/Cce/ScriPlusInterpolationManager.hpp"
15 #include "ParallelAlgorithms/Initialization/MergeIntoDataBox.hpp"
16 #include "Utilities/Rational.hpp"
17 #include "Utilities/Requires.hpp"
18 #include "Utilities/TMPL.hpp"
19 #include "Utilities/TaggedTuple.hpp"
20 
21 namespace Cce {
22 namespace Actions {
23 
24 /*!
25  * \ingroup ActionsGroup
26  * \brief Initializes the `CharacteristicEvolution` component with contents
27  * needed to perform the interpolation at scri+.
28  *
29  * \details Sets up the \ref DataBoxGroup to be ready to store data in the scri+
30  * interpolators and perform interpolation for the final scri+ outputs.
31  *
32  * \ref DataBoxGroup changes:
33  * - Modifies: nothing
34  * - Adds:
35  * - `Cce::Tags::InterpolationManager<ComplexDataVector, Tag>` for each `Tag`
36  * in `scri_values_to_observe`
37  * - Removes: nothing
38  */
40  using initialization_tags =
41  tmpl::list<InitializationTags::ScriInterpolationOrder>;
42  using const_global_cache_tags =
43  tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>;
44 
45  template <
46  typename DbTags, typename... InboxTags, typename Metavariables,
47  typename ArrayIndex, typename ActionList, typename ParallelComponent,
48  Requires<tmpl::list_contains_v<
50  static auto apply(db::DataBox<DbTags>& box,
51  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
53  const ArrayIndex& /*array_index*/,
54  const ActionList /*meta*/,
55  const ParallelComponent* const /*meta*/) noexcept {
56  return std::make_tuple(initialize_impl(
57  std::move(box), typename Metavariables::scri_values_to_observe{}));
58  }
59 
60  template <typename TagList, typename... TagPack>
61  static auto initialize_impl(db::DataBox<TagList>&& box,
62  tmpl::list<TagPack...> /*meta*/) noexcept {
63  const size_t target_number_of_points =
64  db::get<InitializationTags::ScriInterpolationOrder>(box);
65  const size_t vector_size =
67  db::get<Spectral::Swsh::Tags::LMaxBase>(box));
68  // silence compiler warnings when pack is empty
69  (void)vector_size;
74  db::AddComputeTags<>, Initialization::MergePolicy::Overwrite>(
75  std::move(box),
77  target_number_of_points, vector_size,
78  std::make_unique<intrp::BarycentricRationalSpanInterpolator>(
79  2 * target_number_of_points - 1,
80  2 * target_number_of_points + 2)}...);
81  }
82 
83  template <typename DbTags, typename... InboxTags, typename Metavariables,
84  typename ArrayIndex, typename ActionList,
85  typename ParallelComponent,
86  Requires<not tmpl::list_contains_v<
87  DbTags, InitializationTags::ScriInterpolationOrder>> = nullptr>
88  static std::tuple<db::DataBox<DbTags>&&> apply(
89  const db::DataBox<DbTags>& /*box*/,
90  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
92  const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
93  const ParallelComponent* const /*meta*/) noexcept {
94  ERROR(
95  "The DataBox is missing required dependency "
96  "`Cce::InitializationTags::ScriPlusInterpolationOrder.`");
97  }
98 };
99 } // namespace Actions
100 } // namespace Cce
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:36
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:24
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
Stores necessary data and interpolates on to new time points at scri+.
Definition: ScriPlusInterpolationManager.hpp:45
Defines the type alias Requires.
auto merge_into_databox(db::DataBox< DbTagsList > &&box, Args &&... args) noexcept
Add tags that are not yet in the DataBox.
Definition: MergeIntoDataBox.hpp:133
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Defines classes and functions used for manipulating DataBox&#39;s.
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1150
Definition: InterpolationTargetWedgeSectionTorus.hpp:25
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:136
Definition: Tags.hpp:401
Initializes the CharacteristicEvolution component with contents needed to perform the interpolation a...
Definition: InitializeCharacteristicEvolutionScri.hpp:39
Wraps the template metaprogramming library used (brigand)
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
Definition: Test_ActionTesting.cpp:365
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Defines class template ConstGlobalCache.
Definition: ComputeTimeDerivative.hpp:29
tmpl::flatten< tmpl::list< Tags... > > AddComputeTags
List of Compute Item Tags to add to the DataBox.
Definition: DataBox.hpp:1171