Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : #include <optional> 8 : #include <tuple> 9 : #include <utility> 10 : 11 : #include "DataStructures/DataBox/DataBox.hpp" 12 : #include "DataStructures/TaggedTuple.hpp" 13 : #include "DataStructures/Variables.hpp" 14 : #include "DataStructures/VariablesTag.hpp" 15 : #include "Evolution/Systems/Cce/OptionTags.hpp" 16 : #include "NumericalAlgorithms/SpinWeightedSphericalHarmonics/SwshInterpolation.hpp" 17 : #include "Parallel/AlgorithmExecution.hpp" 18 : #include "Parallel/GlobalCache.hpp" 19 : #include "ParallelAlgorithms/Initialization/MutateAssign.hpp" 20 : #include "Time/StepChoosers/StepChooser.hpp" 21 : #include "Utilities/Requires.hpp" 22 : #include "Utilities/TMPL.hpp" 23 : 24 : namespace Cce { 25 : /// \brief The set of actions for use in the CCE evolution system 26 : namespace Actions { 27 : 28 : namespace detail { 29 : CREATE_HAS_TYPE_ALIAS(compute_tags) 30 : CREATE_HAS_TYPE_ALIAS_V(compute_tags) 31 : CREATE_GET_TYPE_ALIAS_OR_DEFAULT(compute_tags) 32 : } // namespace detail 33 : 34 : /*! 35 : * \ingroup ActionsGroup 36 : * \brief Initializes the main data storage for the `CharacteristicEvolution` 37 : * component, which is the singleton that handles the main evolution system for 38 : * CCE computations. 39 : * 40 : * \details Sets up the \ref DataBoxGroup to be ready to take data from the 41 : * worldtube component, calculate initial data, and start the hypersurface 42 : * computations. 43 : * 44 : * \ref DataBoxGroup changes: 45 : * - Modifies: nothing 46 : * - Adds: 47 : * - `metavariables::evolved_coordinates_variables_tag` 48 : * - `Tags::Variables<metavariables::cce_angular_coordinate_tags>` 49 : * - `Tags::Variables<metavariables::cce_scri_tags>` 50 : * - 51 : * ``` 52 : * Tags::Variables<tmpl::append< 53 : * metavariables::cce_integrand_tags, 54 : * metavariables::cce_integration_independent_tags, 55 : * metavariables::cce_temporary_equations_tags>> 56 : * ``` 57 : * - `Tags::Variables<metavariables::cce_pre_swsh_derivatives_tags>` 58 : * - `Tags::Variables<metavariables::cce_transform_buffer_tags>` 59 : * - `Tags::Variables<metavariables::cce_swsh_derivative_tags>` 60 : * - `Spectral::Swsh::Tags::SwshInterpolator< Tags::CauchyAngularCoords>` 61 : * - `Spectral::Swsh::Tags::SwshInterpolator<Tags::PartiallyFlatAngularCoords>` 62 : * - Removes: nothing 63 : */ 64 : template <typename Metavariables> 65 1 : struct InitializeCharacteristicEvolutionVariables { 66 0 : using const_global_cache_tags = 67 : tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>; 68 : 69 0 : using boundary_value_variables_tag = ::Tags::Variables< 70 : tmpl::append<typename Metavariables::cce_boundary_communication_tags, 71 : typename Metavariables::cce_gauge_boundary_tags>>; 72 0 : using scri_variables_tag = 73 : ::Tags::Variables<typename Metavariables::cce_scri_tags>; 74 0 : using volume_variables_tag = ::Tags::Variables< 75 : tmpl::append<typename Metavariables::cce_integrand_tags, 76 : typename Metavariables::cce_integration_independent_tags, 77 : typename Metavariables::cce_temporary_equations_tags>>; 78 0 : using pre_swsh_derivatives_variables_tag = 79 : ::Tags::Variables<typename Metavariables::cce_pre_swsh_derivatives_tags>; 80 0 : using transform_buffer_variables_tag = 81 : ::Tags::Variables<typename Metavariables::cce_transform_buffer_tags>; 82 0 : using swsh_derivative_variables_tag = 83 : ::Tags::Variables<typename Metavariables::cce_swsh_derivative_tags>; 84 0 : using angular_coordinates_variables_tag = 85 : ::Tags::Variables<typename Metavariables::cce_angular_coordinate_tags>; 86 0 : using coordinate_variables_tag = 87 : typename Metavariables::evolved_coordinates_variables_tag; 88 0 : using evolved_swsh_variables_tag = 89 : ::Tags::Variables<typename Metavariables::evolved_swsh_tags>; 90 0 : using ccm_tag = ::Tags::Variables<typename Metavariables::ccm_psi0>; 91 : 92 0 : using simple_tags_for_evolution = tmpl::list< 93 : boundary_value_variables_tag, coordinate_variables_tag, 94 : evolved_swsh_variables_tag, angular_coordinates_variables_tag, 95 : scri_variables_tag, volume_variables_tag, 96 : pre_swsh_derivatives_variables_tag, transform_buffer_variables_tag, 97 : swsh_derivative_variables_tag, 98 : Spectral::Swsh::Tags::SwshInterpolator<Tags::CauchyAngularCoords>, 99 : Spectral::Swsh::Tags::SwshInterpolator<Tags::PartiallyFlatAngularCoords>, 100 : ccm_tag>; 101 0 : using simple_tags = 102 : tmpl::append<StepChoosers::step_chooser_simple_tags<Metavariables>, 103 : simple_tags_for_evolution>; 104 : 105 0 : using compute_tags = tmpl::remove_duplicates<tmpl::join< 106 : tmpl::transform<typename Metavariables::cce_step_choosers, 107 : tmpl::bind<detail::get_compute_tags_or_default_t, 108 : tmpl::_1, tmpl::pin<tmpl::list<>>>>>>; 109 : 110 : template <typename DbTags, typename... InboxTags, typename ArrayIndex, 111 : typename ActionList, typename ParallelComponent> 112 0 : static Parallel::iterable_action_return_t apply( 113 : db::DataBox<DbTags>& box, 114 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 115 : const Parallel::GlobalCache<Metavariables>& /*cache*/, 116 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 117 : const ParallelComponent* const /*meta*/) { 118 : initialize_impl(make_not_null(&box)); 119 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 120 : } 121 : 122 : template <typename TagList> 123 0 : static void initialize_impl(const gsl::not_null<db::DataBox<TagList>*> box) { 124 : const size_t l_max = db::get<Spectral::Swsh::Tags::LMax>(*box); 125 : const size_t number_of_radial_points = 126 : db::get<Spectral::Swsh::Tags::NumberOfRadialPoints>(*box); 127 : const size_t boundary_size = 128 : Spectral::Swsh::number_of_swsh_collocation_points(l_max); 129 : const size_t volume_size = boundary_size * number_of_radial_points; 130 : const size_t transform_buffer_size = 131 : number_of_radial_points * 132 : Spectral::Swsh::size_of_libsharp_coefficient_vector(l_max); 133 : Initialization::mutate_assign<simple_tags_for_evolution>( 134 : box, typename boundary_value_variables_tag::type{boundary_size}, 135 : typename coordinate_variables_tag::type{boundary_size}, 136 : typename evolved_swsh_variables_tag::type{volume_size}, 137 : typename angular_coordinates_variables_tag::type{boundary_size}, 138 : typename scri_variables_tag::type{boundary_size}, 139 : typename volume_variables_tag::type{volume_size}, 140 : typename pre_swsh_derivatives_variables_tag::type{volume_size, 0.0}, 141 : typename transform_buffer_variables_tag::type{transform_buffer_size, 142 : 0.0}, 143 : typename swsh_derivative_variables_tag::type{volume_size, 0.0}, 144 : Spectral::Swsh::SwshInterpolator{}, Spectral::Swsh::SwshInterpolator{}, 145 : typename ccm_tag::type{boundary_size}); 146 : } 147 : }; 148 : 149 : } // namespace Actions 150 : } // namespace Cce