Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "Evolution/Systems/Cce/OptionTags.hpp" 7 : #include "ParallelAlgorithms/Initialization/MutateAssign.hpp" 8 : 9 : namespace Cce::Actions { 10 : 11 : /*! 12 : * \ingroup ActionsGroup 13 : * \brief Initialize the data storage for the scalar field in the 14 : * `KleinGordonCharacteristicExtract` component, which is the singleton that 15 : * handles the main evolution system for Klein-Gordon CCE computations. 16 : * 17 : * \details Sets up the \ref DataBoxGroup to be ready to take data from the 18 : * worldtube component, calculate initial data, and start the hypersurface 19 : * computations. 20 : * 21 : * \ref DataBoxGroup changes: 22 : * - Modifies: nothing 23 : * - Adds: 24 : * - `Tags::Variables<metavariables::klein_gordon_boundary_communication_tags>` 25 : * - `Tags::Variables<metavariables::klein_gordon_gauge_boundary_tags>` 26 : * - `Tags::Variables<metavariables::klein_gordon_scri_tags>` 27 : * - `Tags::Variables<metavariables::klein_gordon_pre_swsh_derivative_tags>` 28 : * - `Tags::Variables<metavariables::klein_gordon_swsh_derivative_tags>` 29 : * - `Tags::Variables<metavariables::klein_gordon_transform_buffer_tags>` 30 : * - `Tags::Variables<metavariables::klein_gordon_source_tags>` 31 : * - `Tags::Variables<metavariables::klein_gordon_cce_integrand_tags>` 32 : * - Removes: nothing 33 : */ 34 : template <typename Metavariables> 35 1 : struct InitializeKleinGordonVariables { 36 0 : using const_global_cache_tags = 37 : tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>; 38 : 39 0 : using klein_gordon_boundary_communication_tags = ::Tags::Variables< 40 : typename Metavariables::klein_gordon_boundary_communication_tags>; 41 0 : using klein_gordon_gauge_boundary_tags = ::Tags::Variables< 42 : typename Metavariables::klein_gordon_gauge_boundary_tags>; 43 0 : using klein_gordon_scri_tags = 44 : ::Tags::Variables<typename Metavariables::klein_gordon_scri_tags>; 45 0 : using klein_gordon_pre_swsh_derivatives_variables_tag = ::Tags::Variables< 46 : typename Metavariables::klein_gordon_pre_swsh_derivative_tags>; 47 0 : using klein_gordon_swsh_derivatives_variables_tag = ::Tags::Variables< 48 : typename Metavariables::klein_gordon_swsh_derivative_tags>; 49 0 : using klein_gordon_transform_buffer_variables_tag = ::Tags::Variables< 50 : typename Metavariables::klein_gordon_transform_buffer_tags>; 51 0 : using klein_gordon_source_variables_tag = 52 : ::Tags::Variables<typename Metavariables::klein_gordon_source_tags>; 53 0 : using klein_gordon_integrand_variables_tag = ::Tags::Variables< 54 : typename Metavariables::klein_gordon_cce_integrand_tags>; 55 : 56 0 : using simple_tags = 57 : tmpl::list<klein_gordon_boundary_communication_tags, 58 : klein_gordon_gauge_boundary_tags, klein_gordon_scri_tags, 59 : klein_gordon_pre_swsh_derivatives_variables_tag, 60 : klein_gordon_swsh_derivatives_variables_tag, 61 : klein_gordon_transform_buffer_variables_tag, 62 : klein_gordon_source_variables_tag, 63 : klein_gordon_integrand_variables_tag>; 64 : 65 : template <typename DbTags, typename... InboxTags, typename ArrayIndex, 66 : typename ActionList, typename ParallelComponent> 67 0 : static Parallel::iterable_action_return_t apply( 68 : db::DataBox<DbTags>& box, 69 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 70 : const Parallel::GlobalCache<Metavariables>& /*cache*/, 71 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 72 : const ParallelComponent* const /*meta*/) { 73 : const size_t l_max = db::get<Spectral::Swsh::Tags::LMaxBase>(box); 74 : const size_t number_of_radial_points = 75 : db::get<Spectral::Swsh::Tags::NumberOfRadialPointsBase>(box); 76 : const size_t boundary_size = 77 : Spectral::Swsh::number_of_swsh_collocation_points(l_max); 78 : const size_t volume_size = boundary_size * number_of_radial_points; 79 : const size_t transform_buffer_size = 80 : number_of_radial_points * 81 : Spectral::Swsh::size_of_libsharp_coefficient_vector(l_max); 82 : 83 : Initialization::mutate_assign<simple_tags>( 84 : make_not_null(&box), 85 : typename klein_gordon_boundary_communication_tags::type{boundary_size}, 86 : typename klein_gordon_gauge_boundary_tags::type{boundary_size}, 87 : typename klein_gordon_scri_tags::type{boundary_size}, 88 : typename klein_gordon_pre_swsh_derivatives_variables_tag::type{ 89 : volume_size}, 90 : typename klein_gordon_swsh_derivatives_variables_tag::type{volume_size}, 91 : typename klein_gordon_transform_buffer_variables_tag::type{ 92 : transform_buffer_size}, 93 : typename klein_gordon_source_variables_tag::type{volume_size}, 94 : typename klein_gordon_integrand_variables_tag::type{volume_size}); 95 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 96 : } 97 : }; 98 : } // namespace Cce::Actions