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 "Time/StepChoosers/ErrorControl.hpp"
19 #include "Utilities/Requires.hpp"
20 #include "Utilities/TMPL.hpp"
21 #include "Utilities/TaggedTuple.hpp"
22 
23 namespace Cce {
24 /// \brief The set of actions for use in the CCE evolution system
25 namespace Actions {
26 
27 /*!
28  * \ingroup ActionsGroup
29  * \brief Initializes the main data storage for the `CharacteristicEvolution`
30  * component, which is the singleton that handles the main evolution system for
31  * CCE computations.
32  *
33  * \details Sets up the \ref DataBoxGroup to be ready to take data from the
34  * worldtube component, calculate initial data, and start the hypersurface
35  * computations.
36  *
37  * \ref DataBoxGroup changes:
38  * - Modifies: nothing
39  * - Adds:
40  * - `metavariables::evolved_coordinates_variables_tag`
41  * -
42  * ```
43  * db::add_tag_prefix<Tags::dt,
44  * metavariables::evolved_coordinates_variables_tag>
45  * ```
46  * - `Tags::Variables<metavariables::cce_angular_coordinate_tags>`
47  * - `Tags::Variables<metavariables::cce_scri_tags>`
48  * -
49  * ```
50  * Tags::Variables<tmpl::append<
51  * metavariables::cce_integrand_tags,
52  * metavariables::cce_integration_independent_tags,
53  * metavariables::cce_temporary_equations_tags>>
54  * ```
55  * - `Tags::Variables<metavariables::cce_pre_swsh_derivatives_tags>`
56  * - `Tags::Variables<metavariables::cce_transform_buffer_tags>`
57  * - `Tags::Variables<metavariables::cce_swsh_derivative_tags>`
58  * - `Spectral::Swsh::Tags::SwshInterpolator< Tags::CauchyAngularCoords>`
59  * - Removes: nothing
60  *
61  * \note This action relies on the `SetupDataBox` aggregated initialization
62  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
63  * phase action list prior to this action.
64  */
65 template <typename Metavariables>
67  using const_global_cache_tags =
68  tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>;
69 
71  tmpl::append<typename Metavariables::cce_boundary_communication_tags,
72  typename Metavariables::cce_gauge_boundary_tags>>;
73  using scri_variables_tag =
76  tmpl::append<typename Metavariables::cce_integrand_tags,
77  typename Metavariables::cce_integration_independent_tags,
78  typename Metavariables::cce_temporary_equations_tags>>;
87  using coordinate_variables_tag =
88  typename Metavariables::evolved_coordinates_variables_tag;
89  using dt_coordinate_variables_tag =
91  using stepper_error_coordinate_variables_tag =
95  using evolved_swsh_dt_variables_tag =
97  using evolved_swsh_stepper_error_variables_tag =
99 
100  using simple_tags_for_evolution = tmpl::list<
101  boundary_value_variables_tag, coordinate_variables_tag,
102  dt_coordinate_variables_tag, stepper_error_coordinate_variables_tag,
103  evolved_swsh_variables_tag, evolved_swsh_dt_variables_tag,
104  evolved_swsh_stepper_error_variables_tag,
110  using simple_tags =
111  tmpl::append<StepChoosers::step_chooser_simple_tags<Metavariables>,
112  simple_tags_for_evolution>;
113 
114  using compute_tags = StepChoosers::step_chooser_compute_tags<Metavariables>;
115 
116  template <typename DbTags, typename... InboxTags, typename ArrayIndex,
117  typename ActionList, typename ParallelComponent>
118  static auto apply(db::DataBox<DbTags>& box,
119  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
120  const Parallel::GlobalCache<Metavariables>& /*cache*/,
121  const ArrayIndex& /*array_index*/,
122  const ActionList /*meta*/,
123  const ParallelComponent* const /*meta*/) noexcept {
124  const size_t l_max = db::get<Spectral::Swsh::Tags::LMaxBase>(box);
125  const size_t number_of_radial_points =
126  db::get<Spectral::Swsh::Tags::NumberOfRadialPointsBase>(box);
127  const size_t boundary_size =
129  const size_t volume_size = boundary_size * number_of_radial_points;
130  const size_t transform_buffer_size =
131  number_of_radial_points *
133  const bool is_using_error_control =
134  db::get<::Tags::IsUsingTimeSteppingErrorControlBase>(box);
135  Initialization::mutate_assign<simple_tags_for_evolution>(
136  make_not_null(&box),
137  typename boundary_value_variables_tag::type{boundary_size},
138  typename coordinate_variables_tag::type{boundary_size},
139  typename dt_coordinate_variables_tag::type{boundary_size},
140  typename stepper_error_coordinate_variables_tag::type{
141  is_using_error_control ? boundary_size : 0},
142  typename evolved_swsh_variables_tag::type{volume_size},
143  typename evolved_swsh_dt_variables_tag::type{volume_size},
144  typename evolved_swsh_stepper_error_variables_tag::type{
145  is_using_error_control ? volume_size : 0},
146  typename angular_coordinates_variables_tag::type{boundary_size},
147  typename scri_variables_tag::type{boundary_size},
148  typename volume_variables_tag::type{volume_size},
149  typename pre_swsh_derivatives_variables_tag::type{volume_size, 0.0},
150  typename transform_buffer_variables_tag::type{transform_buffer_size,
151  0.0},
152  typename swsh_derivative_variables_tag::type{volume_size, 0.0},
154 
155  return std::make_tuple(std::move(box));
156  }
157 };
158 
159 } // namespace Actions
160 } // 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:33
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
Tags::StepperErrorUpdated
Tag indicating whether the stepper error has been updated on the current step.
Definition: Tags.hpp:129
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:66
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:24