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 "Evolution/Systems/Cce/OptionTags.hpp" 13 : #include "Evolution/Systems/Cce/ScriPlusInterpolationManager.hpp" 14 : #include "Parallel/AlgorithmExecution.hpp" 15 : #include "Parallel/GlobalCache.hpp" 16 : #include "ParallelAlgorithms/Initialization/MutateAssign.hpp" 17 : #include "Utilities/Rational.hpp" 18 : #include "Utilities/Requires.hpp" 19 : #include "Utilities/TMPL.hpp" 20 : #include "Utilities/TaggedTuple.hpp" 21 : #include "Utilities/TypeTraits/IsA.hpp" 22 : 23 : namespace Cce { 24 : 25 : /// \cond 26 : template <class Metavariables> 27 : struct AnalyticWorldtubeBoundary; 28 : /// \endcond 29 : namespace Actions { 30 : 31 : /*! 32 : * \ingroup ActionsGroup 33 : * \brief Initializes the `CharacteristicEvolution` component with contents 34 : * needed to perform the interpolation at scri+. 35 : * 36 : * \details Sets up the \ref DataBoxGroup to be ready to store data in the scri+ 37 : * interpolators and perform interpolation for the final scri+ outputs. 38 : * 39 : * \ref DataBoxGroup changes: 40 : * - Modifies: nothing 41 : * - Adds: 42 : * - `Cce::Tags::InterpolationManager<ComplexDataVector, Tag>` for each `Tag` 43 : * in `scri_values_to_observe` 44 : * - Removes: nothing 45 : */ 46 : template <typename ScriValuesToObserve, typename BoundaryComponent> 47 1 : struct InitializeCharacteristicEvolutionScri { 48 0 : using simple_tags_from_options = tmpl::flatten<tmpl::list< 49 : InitializationTags::ScriInterpolationOrder, 50 : tmpl::conditional_t< 51 : tt::is_a_v<AnalyticWorldtubeBoundary, BoundaryComponent>, 52 : tmpl::list<Tags::AnalyticBoundaryDataManager>, tmpl::list<>>>>; 53 : 54 0 : using const_global_cache_tags = 55 : tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>; 56 : 57 0 : using simple_tags = 58 : tmpl::transform<ScriValuesToObserve, 59 : tmpl::bind<Tags::InterpolationManager, 60 : tmpl::pin<ComplexDataVector>, tmpl::_1>>; 61 : 62 0 : using compute_tags = tmpl::list<>; 63 : 64 : template <typename DbTags, typename... InboxTags, typename Metavariables, 65 : typename ArrayIndex, typename ActionList, 66 : 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 : initialize_impl(make_not_null(&box), 74 : typename Metavariables::scri_values_to_observe{}); 75 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 76 : } 77 : 78 : template <typename TagList, typename... TagPack> 79 0 : static void initialize_impl(const gsl::not_null<db::DataBox<TagList>*> box, 80 : tmpl::list<TagPack...> /*meta*/) { 81 : const size_t target_number_of_points = 82 : db::get<InitializationTags::ScriInterpolationOrder>(*box); 83 : const size_t vector_size = 84 : Spectral::Swsh::number_of_swsh_collocation_points( 85 : db::get<Spectral::Swsh::Tags::LMaxBase>(*box)); 86 : // silence compiler warnings when pack is empty 87 : (void)vector_size; 88 : if constexpr (sizeof...(TagPack) > 0) { 89 : Initialization::mutate_assign<simple_tags>( 90 : box, ScriPlusInterpolationManager<ComplexDataVector, TagPack>{ 91 : target_number_of_points, vector_size, 92 : std::make_unique<intrp::BarycentricRationalSpanInterpolator>( 93 : 2 * target_number_of_points - 1, 94 : 2 * target_number_of_points + 2)}...); 95 : } 96 : } 97 : }; 98 : } // namespace Actions 99 : } // namespace Cce