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/Actions/InitializeWorldtubeBoundary.hpp" 7 : #include "Evolution/Systems/Cce/BoundaryData.hpp" 8 : #include "Parallel/GlobalCache.hpp" 9 : #include "Parallel/Invoke.hpp" 10 : #include "Parallel/Local.hpp" 11 : #include "Parallel/Phase.hpp" 12 : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp" 13 : 14 : namespace Cce { 15 : 16 : /*! 17 : * \brief Generic base class for components that supply CCE worldtube boundary 18 : * data. See class specializations for specific worldtube boundary components. 19 : */ 20 : template <typename WorldtubeComponent, typename Metavariables> 21 1 : struct WorldtubeComponentBase { 22 0 : using chare_type = Parallel::Algorithms::Singleton; 23 0 : using metavariables = Metavariables; 24 0 : using initialize_action_list = 25 : tmpl::list<Actions::InitializeWorldtubeBoundary<WorldtubeComponent>, 26 : Parallel::Actions::TerminatePhase>; 27 : 28 0 : using simple_tags_from_options = 29 : Parallel::get_simple_tags_from_options<initialize_action_list>; 30 : 31 0 : using worldtube_boundary_computation_steps = tmpl::list<>; 32 : 33 0 : using phase_dependent_action_list = 34 : tmpl::list<Parallel::PhaseActions<Parallel::Phase::Initialization, 35 : initialize_action_list>, 36 : Parallel::PhaseActions<Parallel::Phase::Evolve, 37 : worldtube_boundary_computation_steps>>; 38 : 39 0 : using options = tmpl::list<>; 40 : 41 0 : static void initialize( 42 : Parallel::CProxy_GlobalCache<Metavariables>& /*global_cache*/) {} 43 : 44 0 : static void execute_next_phase( 45 : const Parallel::Phase next_phase, 46 : const Parallel::CProxy_GlobalCache<Metavariables>& global_cache) { 47 : auto& local_cache = *Parallel::local_branch(global_cache); 48 : if (next_phase == Parallel::Phase::Evolve) { 49 : Parallel::get_parallel_component<WorldtubeComponent>(local_cache) 50 : .start_phase(next_phase); 51 : } 52 : } 53 : }; 54 : 55 : /*! 56 : * \brief Component that supplies CCE worldtube boundary data. 57 : * 58 : * \details The \ref DataBoxGroup associated with the worldtube boundary 59 : * component contains a data manager (e.g. `WorldtubeDataManager`) linked to 60 : * an H5 file. The data manager handles buffering and interpolating to desired 61 : * target time points when requested via the simple action 62 : * `BoundaryComputeAndSendToEvolution`, at which point it will send the required 63 : * collection of boundary quantities to the identified 'CharacteristicEvolution' 64 : * component. It is assumed that the simple action 65 : * `BoundaryComputeAndSendToEvolution` will only be called during the 66 : * `Evolve` phase. 67 : * 68 : * Uses const global tags: 69 : * - `Tags::LMax` 70 : * 71 : * `Metavariables` must contain: 72 : * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases. 73 : * - a type alias `cce_boundary_communication_tags` for the set of tags to send 74 : * from the worldtube to the evolution component. This will typically be 75 : * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`. 76 : */ 77 : template <class Metavariables> 78 1 : struct H5WorldtubeBoundary 79 : : public WorldtubeComponentBase<H5WorldtubeBoundary<Metavariables>, 80 : Metavariables> { 81 0 : using base_type = 82 : WorldtubeComponentBase<H5WorldtubeBoundary<Metavariables>, Metavariables>; 83 : using base_type::execute_next_phase; 84 : using base_type::initialize; 85 : using typename base_type::chare_type; 86 0 : using const_global_cache_tags = 87 : tmpl::list<Tags::InitializeJ<Metavariables::evolve_ccm>>; 88 : using typename base_type::metavariables; 89 : using typename base_type::options; 90 : using typename base_type::phase_dependent_action_list; 91 : using typename base_type::simple_tags_from_options; 92 0 : using end_time_tag = Tags::EndTimeFromFile; 93 : }; 94 : 95 : /*! 96 : * \brief Component that supplies scalar-tensor worldtube boundary data. 97 : * 98 : * \details The \ref DataBoxGroup associated with the worldtube boundary 99 : * component contains two data managers (`WorldtubeDataManager`) linked to 100 : * one or two H5 files (scalar and tensor sectors, respectively). The data 101 : * managers handle buffering and interpolating to desired target time points 102 : * when requested via the simple action `BoundaryComputeAndSendToEvolution`, at 103 : * which point they will send the required collection of boundary quantities to 104 : * the identified `KleinGordonCharacteristicEvolution` component. It is assumed 105 : * that the simple action `BoundaryComputeAndSendToEvolution` will only be 106 : * called during the `Evolve` phase. 107 : * 108 : * Uses const global tags: 109 : * - `Tags::LMax` 110 : * 111 : * `Metavariables` must contain: 112 : * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases. 113 : * - a type alias `cce_boundary_communication_tags` for the set of tensor tags 114 : * to send from the worldtube to the evolution component. This will typically be 115 : * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`. 116 : * - a type alias `klein_gordon_boundary_communication_tags` for the set of 117 : * scalar tags to send from the worldtube to the evolution component. This will 118 : * typically be `Cce::Tags::klein_gordon_worldtube_boundary_tags`. 119 : */ 120 : template <class Metavariables> 121 1 : struct KleinGordonH5WorldtubeBoundary 122 : : public WorldtubeComponentBase< 123 : KleinGordonH5WorldtubeBoundary<Metavariables>, Metavariables> { 124 0 : using base_type = 125 : WorldtubeComponentBase<KleinGordonH5WorldtubeBoundary<Metavariables>, 126 : Metavariables>; 127 : using base_type::execute_next_phase; 128 : using base_type::initialize; 129 : using typename base_type::chare_type; 130 0 : using const_global_cache_tags = 131 : tmpl::list<Tags::InitializeJ<Metavariables::evolve_ccm>>; 132 : using typename base_type::metavariables; 133 : using typename base_type::options; 134 : using typename base_type::phase_dependent_action_list; 135 : using typename base_type::simple_tags_from_options; 136 0 : using end_time_tag = Tags::EndTimeFromFile; 137 : }; 138 : 139 : /*! 140 : * \brief Component that supplies CCE worldtube boundary data sourced from an 141 : * analytic solution. 142 : * 143 : * \details The \ref DataBoxGroup associated with the worldtube boundary 144 : * component contains a data manager (e.g. `AnalyticBoundaryDataManager`) that 145 : * contains the analytic solution being provided. The data manager handles 146 : * computation of the analytic solution boundary data when requested via 147 : * the simple action `BoundaryComputeAndSendToEvolution`, at which point it will 148 : * send the required collection of boundary quantities to the identified 149 : * 'CharacteristicEvolution' component. It is assumed that the simple action 150 : * `BoundaryComputeAndSendToEvolution` will only be called during the 151 : * `Evolve` phase. 152 : * 153 : * Uses const global tags: 154 : * - `Tags::LMax` 155 : * - `Tags::SpecifiedEndTime` 156 : * 157 : * `Metavariables` must contain: 158 : * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases. 159 : * - a type alias `cce_boundary_communication_tags` for the set of tags to send 160 : * from the worldtube to the evolution component. This will typically be 161 : * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`. 162 : */ 163 : template <class Metavariables> 164 1 : struct AnalyticWorldtubeBoundary 165 : : public WorldtubeComponentBase<AnalyticWorldtubeBoundary<Metavariables>, 166 : Metavariables> { 167 0 : using base_type = 168 : WorldtubeComponentBase<AnalyticWorldtubeBoundary<Metavariables>, 169 : Metavariables>; 170 : using base_type::execute_next_phase; 171 : using base_type::initialize; 172 : using typename base_type::chare_type; 173 0 : using const_global_cache_tags = tmpl::list<Tags::AnalyticInitializeJ>; 174 : using typename base_type::metavariables; 175 : using typename base_type::options; 176 : using typename base_type::phase_dependent_action_list; 177 : using typename base_type::simple_tags_from_options; 178 0 : using end_time_tag = Tags::SpecifiedEndTime; 179 : }; 180 : 181 : /*! 182 : * \brief Component that supplies CCE worldtube boundary data sourced from a 183 : * running GH system. 184 : * 185 : * \details The \ref DataBoxGroup associated with the worldtube boundary 186 : * component contains an interface manager (derived from 187 : * `Cce::GhWorldtubeInterfaceManager`) that stores and provides the data 188 : * received from the GH system. The data manager handles buffering 189 : * and interpolating to desired target time points when requested via the simple 190 : * action `Cce::Actions::BoundaryComputeAndSendToEvolution`, at which point it 191 : * will send the required collection of boundary quantities to the identified 192 : * `CharacteristicEvolution` component. It is assumed that the simple action 193 : * `Cce::Actions::BoundaryComputeAndSendToEvolution` will only be called during 194 : * the `Evolve` phase. 195 : * 196 : * Uses const global tags: 197 : * - `InitializationTags::LMax` 198 : * - `InitializationTags::ExtractionRadius` 199 : * 200 : * `Metavariables` must contain: 201 : * - the `enum` `Phase` with at least `Initialization` and `Evolve` phases. 202 : * - a type alias `cce_boundary_communication_tags` for the set of tags to send 203 : * from the worldtube to the evolution component. This will typically be 204 : * `Cce::Tags::characteristic_worldtube_boundary_tags<Tags::BoundaryValue>`. 205 : */ 206 : template <class Metavariables> 207 1 : struct GhWorldtubeBoundary 208 : : public WorldtubeComponentBase<GhWorldtubeBoundary<Metavariables>, 209 : Metavariables> { 210 0 : using base_type = 211 : WorldtubeComponentBase<GhWorldtubeBoundary<Metavariables>, Metavariables>; 212 : using base_type::execute_next_phase; 213 : using base_type::initialize; 214 : using typename base_type::chare_type; 215 0 : using const_global_cache_tags = 216 : tmpl::list<Tags::InitializeJ<Metavariables::evolve_ccm>>; 217 : using typename base_type::metavariables; 218 : using typename base_type::options; 219 : using typename base_type::phase_dependent_action_list; 220 : using typename base_type::simple_tags_from_options; 221 0 : using end_time_tag = Tags::NoEndTime; 222 : }; 223 : } // namespace Cce