InitializeCharacteristicEvolutionVariables.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 "DataStructures/DataBox/PrefixHelpers.hpp"
13 #include "DataStructures/VariablesTag.hpp"
14 #include "Evolution/Systems/Cce/OptionTags.hpp"
15 #include "NumericalAlgorithms/Spectral/SwshInterpolation.hpp"
16 #include "Parallel/GlobalCache.hpp"
17 #include "ParallelAlgorithms/Initialization/MutateAssign.hpp"
18 #include "Utilities/Requires.hpp"
19 #include "Utilities/TMPL.hpp"
20 #include "Utilities/TaggedTuple.hpp"
21 
22 namespace Cce {
23 /// \brief The set of actions for use in the CCE evolution system
24 namespace Actions {
25 
26 /*!
27  * \ingroup ActionsGroup
28  * \brief Initializes the main data storage for the `CharacteristicEvolution`
29  * component, which is the singleton that handles the main evolution system for
30  * CCE computations.
31  *
32  * \details Sets up the \ref DataBoxGroup to be ready to take data from the
33  * worldtube component, calculate initial data, and start the hypersurface
34  * computations.
35  *
36  * \ref DataBoxGroup changes:
37  * - Modifies: nothing
38  * - Adds:
39  * - `metavariables::evolved_coordinates_variables_tag`
40  * -
41  * ```
42  * db::add_tag_prefix<Tags::dt,
43  * metavariables::evolved_coordinates_variables_tag>
44  * ```
45  * - `Tags::Variables<metavariables::cce_angular_coordinate_tags>`
46  * - `Tags::Variables<metavariables::cce_scri_tags>`
47  * -
48  * ```
49  * Tags::Variables<tmpl::append<
50  * metavariables::cce_integrand_tags,
51  * metavariables::cce_integration_independent_tags,
52  * metavariables::cce_temporary_equations_tags>>
53  * ```
54  * - `Tags::Variables<metavariables::cce_pre_swsh_derivatives_tags>`
55  * - `Tags::Variables<metavariables::cce_transform_buffer_tags>`
56  * - `Tags::Variables<metavariables::cce_swsh_derivative_tags>`
57  * - `Spectral::Swsh::Tags::SwshInterpolator< Tags::CauchyAngularCoords>`
58  * - Removes: nothing
59  *
60  * \note This action relies on the `SetupDataBox` aggregated initialization
61  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
62  * phase action list prior to this action.
63  */
64 template <typename Metavariables>
66  using const_global_cache_tags =
67  tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>;
68 
70  tmpl::append<typename Metavariables::cce_boundary_communication_tags,
71  typename Metavariables::cce_gauge_boundary_tags>>;
72  using scri_variables_tag =
75  tmpl::append<typename Metavariables::cce_integrand_tags,
76  typename Metavariables::cce_integration_independent_tags,
77  typename Metavariables::cce_temporary_equations_tags>>;
79  typename Metavariables::cce_pre_swsh_derivatives_tags>;
86  using coordinate_variables_tag =
87  typename Metavariables::evolved_coordinates_variables_tag;
88  using dt_coordinate_variables_tag =
92  using evolved_swsh_dt_variables_tag =
94 
95  using simple_tags = tmpl::list<
96  boundary_value_variables_tag, coordinate_variables_tag,
97  dt_coordinate_variables_tag, evolved_swsh_variables_tag,
98  evolved_swsh_dt_variables_tag, angular_coordinates_variables_tag,
103 
104  using compute_tags = tmpl::list<>;
105 
106  template <
107  typename DbTags, typename... InboxTags, typename ArrayIndex,
108  typename ActionList, typename ParallelComponent>
109  static auto apply(db::DataBox<DbTags>& box,
110  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
111  const Parallel::GlobalCache<Metavariables>& /*cache*/,
112  const ArrayIndex& /*array_index*/,
113  const ActionList /*meta*/,
114  const ParallelComponent* const /*meta*/) noexcept {
115 
116  const size_t l_max = db::get<Spectral::Swsh::Tags::LMaxBase>(box);
117  const size_t number_of_radial_points =
118  db::get<Spectral::Swsh::Tags::NumberOfRadialPointsBase>(box);
119  const size_t boundary_size =
121  const size_t volume_size = boundary_size * number_of_radial_points;
122  const size_t transform_buffer_size =
123  number_of_radial_points *
125  Initialization::mutate_assign<simple_tags>(
126  make_not_null(&box),
127  typename boundary_value_variables_tag::type{boundary_size},
128  typename coordinate_variables_tag::type{boundary_size},
129  typename dt_coordinate_variables_tag::type{boundary_size},
130  typename evolved_swsh_variables_tag::type{volume_size},
131  typename evolved_swsh_dt_variables_tag::type{volume_size},
132  typename angular_coordinates_variables_tag::type{boundary_size},
133  typename scri_variables_tag::type{boundary_size},
134  typename volume_variables_tag::type{volume_size},
135  typename pre_swsh_derivatives_variables_tag::type{volume_size, 0.0},
136  typename transform_buffer_variables_tag::type{transform_buffer_size,
137  0.0},
138  typename swsh_derivative_variables_tag::type{volume_size, 0.0},
140 
141  return std::make_tuple(std::move(box));
142  }
143 };
144 
145 } // namespace Actions
146 } // namespace Cce
Spectral::Swsh::SwshInterpolator
Performs interpolation for spin-weighted spherical harmonics by taking advantage of the Clenshaw meth...
Definition: SwshInterpolation.hpp:232
utility
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:15
GlobalCache.hpp
db::add_tag_prefix
typename detail::add_tag_prefix_impl< Prefix, Tag, Args... >::type add_tag_prefix
Definition: PrefixHelpers.hpp:51
Tags::Variables
Definition: VariablesTag.hpp:21
tuple
Spectral::Swsh::size_of_libsharp_coefficient_vector
constexpr size_t size_of_libsharp_coefficient_vector(const size_t l_max) noexcept
Convenience function for determining the number of spin-weighted spherical harmonics coefficients tha...
Definition: SwshCoefficients.hpp:34
Spectral::Swsh::Tags::SwshInterpolator
Tag for a SwshInterpolator associated with a particular set of angular coordinates.
Definition: SwshTags.hpp:227
DataBox.hpp
cstddef
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Variables.hpp
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: CharacteristicExtractFwd.hpp:6
Requires.hpp
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
Cce::Actions::InitializeCharacteristicEvolutionVariables
Initializes the main data storage for the CharacteristicEvolution component, which is the singleton t...
Definition: InitializeCharacteristicEvolutionVariables.hpp:65
TMPL.hpp
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