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