Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "DataStructures/DataBox/DataBox.hpp" 7 : #include "DataStructures/DataBox/Tag.hpp" 8 : #include "Evolution/Initialization/Evolution.hpp" 9 : #include "Evolution/Systems/CurvedScalarWave/Tags.hpp" 10 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/ChangeSlabSize.hpp" 11 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeElementFacesGridCoordinates.hpp" 12 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp" 13 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/IterateAccelerationTerms.hpp" 14 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/ObserveWorldtubeSolution.hpp" 15 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/ReceiveElementData.hpp" 16 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/SendAccelerationTerms.hpp" 17 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/SendToElements.hpp" 18 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/UpdateAcceleration.hpp" 19 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/UpdateFunctionsOfTime.hpp" 20 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/System.hpp" 21 : #include "IO/Observer/Actions/RegisterSingleton.hpp" 22 : #include "Options/String.hpp" 23 : #include "Parallel/Algorithms/AlgorithmSingleton.hpp" 24 : #include "Parallel/GlobalCache.hpp" 25 : #include "Parallel/Invoke.hpp" 26 : #include "Parallel/ParallelComponentHelpers.hpp" 27 : #include "Parallel/PhaseControl/ExecutePhaseChange.hpp" 28 : #include "Parallel/PhaseDependentActionList.hpp" 29 : #include "Parallel/Tags/ResourceInfo.hpp" 30 : #include "ParallelAlgorithms/Actions/AddComputeTags.hpp" 31 : #include "ParallelAlgorithms/Actions/FunctionsOfTimeAreReady.hpp" 32 : #include "ParallelAlgorithms/Actions/InitializeItems.hpp" 33 : #include "ParallelAlgorithms/Actions/MutateApply.hpp" 34 : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp" 35 : #include "Time/Actions/AdvanceTime.hpp" 36 : #include "Time/Actions/CleanHistory.hpp" 37 : #include "Time/Actions/SelfStartActions.hpp" 38 : #include "Time/RecordTimeStepperData.hpp" 39 : #include "Time/SelfStart.hpp" 40 : #include "Time/UpdateU.hpp" 41 : #include "Utilities/System/ParallelInfo.hpp" 42 : 43 : namespace CurvedScalarWave::Worldtube { 44 : 45 0 : struct Registration { 46 : template <typename ParallelComponent, typename DbTagsList, 47 : typename ArrayIndex> 48 : static std::pair<observers::TypeOfObservation, observers::ObservationKey> 49 0 : register_info(const db::DataBox<DbTagsList>& /*box*/, 50 : const ArrayIndex& /*array_index*/) { 51 : return {observers::TypeOfObservation::Reduction, 52 : observers::ObservationKey{"/Worldtube"}}; 53 : } 54 : }; 55 : 56 : /*! 57 : * \brief The singleton component that represents the worldtube. 58 : * 59 : * \details The component receives from and sends data to the elements abutting 60 : * the worldtube. It holds and calculates a solution for the regular field 61 : * \f$\Psi^R\f$ which valid in a neighborhood of the scalar charge. 62 : */ 63 : template <class Metavariables> 64 1 : struct WorldtubeSingleton { 65 0 : static constexpr size_t Dim = Metavariables::volume_dim; 66 0 : using chare_type = ::Parallel::Algorithms::Singleton; 67 0 : static constexpr bool checkpoint_data = true; 68 0 : using metavariables = Metavariables; 69 0 : using evolved_vars = ::Tags::Variables< 70 : tmpl::list<CurvedScalarWave::Tags::Psi, CurvedScalarWave::Tags::Pi>>; 71 : // LTS not currently supported 72 0 : using TimeStepperBase = TimeStepper; 73 : 74 0 : static constexpr bool local_time_stepping = 75 : TimeStepperBase::local_time_stepping; 76 : 77 0 : using initialization_actions = tmpl::list< 78 : ::Initialization::Actions::InitializeItems< 79 : ::Initialization::TimeStepping<Metavariables, TimeStepperBase>, 80 : Initialization::InitializeEvolvedVariables, 81 : Initialization::InitializeElementFacesGridCoordinates<Dim>>, 82 : ::Initialization::Actions::AddComputeTags< 83 : tmpl::list<Tags::EvolvedParticlePositionVelocityCompute<Dim>, 84 : Tags::GeodesicAccelerationCompute<Dim>, 85 : Tags::BackgroundQuantitiesCompute<Dim>>>, 86 : Parallel::Actions::TerminatePhase>; 87 : 88 0 : using worldtube_system = System<Dim>; 89 0 : using step_actions = tmpl::list< 90 : Actions::UpdateFunctionsOfTime, Actions::ChangeSlabSize, 91 : Actions::ReceiveElementData, 92 : ::Actions::MutateApply<IterateAccelerationTerms>, 93 : Actions::SendAccelerationTerms<Metavariables>, 94 : ::Actions::MutateApply<UpdateAcceleration>, 95 : ::Actions::MutateApply<RecordTimeStepperData<worldtube_system>>, 96 : ::Actions::MutateApply<UpdateU<worldtube_system, local_time_stepping>>, 97 : ::Actions::CleanHistory<worldtube_system, false>, 98 : Actions::SendToElements<Metavariables>, 99 : domain::Actions::CheckFunctionsOfTimeAreReady<Dim>>; 100 0 : using phase_dependent_action_list = tmpl::list< 101 : Parallel::PhaseActions<Parallel::Phase::Initialization, 102 : initialization_actions>, 103 : Parallel::PhaseActions< 104 : Parallel::Phase::InitializeTimeStepperHistory, 105 : SelfStart::self_start_procedure<step_actions, worldtube_system>>, 106 : Parallel::PhaseActions< 107 : Parallel::Phase::Register, 108 : tmpl::list<observers::Actions::RegisterSingletonWithObserverWriter< 109 : Registration>, 110 : Parallel::Actions::TerminatePhase>>, 111 : Parallel::PhaseActions< 112 : Parallel::Phase::Restart, 113 : tmpl::list<observers::Actions::RegisterSingletonWithObserverWriter< 114 : Registration>, 115 : Parallel::Actions::TerminatePhase>>, 116 : Parallel::PhaseActions< 117 : Parallel::Phase::Evolve, 118 : tmpl::list<step_actions, Actions::ObserveWorldtubeSolution, 119 : ::Actions::AdvanceTime, 120 : PhaseControl::Actions::ExecutePhaseChange>>>; 121 : 122 0 : using simple_tags_from_options = Parallel::get_simple_tags_from_options< 123 : Parallel::get_initialization_actions_list<phase_dependent_action_list>>; 124 : 125 0 : static void execute_next_phase( 126 : const typename Parallel::Phase next_phase, 127 : Parallel::CProxy_GlobalCache<Metavariables>& global_cache) { 128 : auto& local_cache = *Parallel::local_branch(global_cache); 129 : Parallel::get_parallel_component<WorldtubeSingleton<metavariables>>( 130 : local_cache) 131 : .start_phase(next_phase); 132 : } 133 : }; 134 : } // namespace CurvedScalarWave::Worldtube