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/SelfStartActions.hpp" 36 : #include "Time/AdvanceTime.hpp" 37 : #include "Time/CleanHistory.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 : 72 0 : using initialization_actions = tmpl::list< 73 : ::Initialization::Actions::InitializeItems< 74 : ::Initialization::TimeStepping<Metavariables, TimeStepper, false, 75 : false>, 76 : Initialization::InitializeEvolvedVariables, 77 : Initialization::InitializeElementFacesGridCoordinates<Dim>>, 78 : ::Initialization::Actions::AddComputeTags< 79 : tmpl::list<Tags::EvolvedParticlePositionVelocityCompute<Dim>, 80 : Tags::GeodesicAccelerationCompute<Dim>, 81 : Tags::BackgroundQuantitiesCompute<Dim>>>, 82 : Parallel::Actions::TerminatePhase>; 83 : 84 0 : using worldtube_system = System<Dim>; 85 0 : using step_actions = tmpl::list< 86 : Actions::UpdateFunctionsOfTime, Actions::ChangeSlabSize, 87 : Actions::ReceiveElementData, 88 : ::Actions::MutateApply<IterateAccelerationTerms>, 89 : Actions::SendAccelerationTerms<Metavariables>, 90 : ::Actions::MutateApply<UpdateAcceleration>, 91 : ::Actions::MutateApply<RecordTimeStepperData<worldtube_system>>, 92 : ::Actions::MutateApply<UpdateU<worldtube_system>>, 93 : ::Actions::MutateApply<CleanHistory<worldtube_system>>, 94 : Actions::SendToElements<Metavariables>, 95 : domain::Actions::CheckFunctionsOfTimeAreReady<Dim>>; 96 0 : using phase_dependent_action_list = tmpl::list< 97 : Parallel::PhaseActions<Parallel::Phase::Initialization, 98 : initialization_actions>, 99 : Parallel::PhaseActions< 100 : Parallel::Phase::InitializeTimeStepperHistory, 101 : SelfStart::self_start_procedure<step_actions, worldtube_system>>, 102 : Parallel::PhaseActions< 103 : Parallel::Phase::Register, 104 : tmpl::list<observers::Actions::RegisterSingletonWithObserverWriter< 105 : Registration>, 106 : Parallel::Actions::TerminatePhase>>, 107 : Parallel::PhaseActions< 108 : Parallel::Phase::Restart, 109 : tmpl::list<observers::Actions::RegisterSingletonWithObserverWriter< 110 : Registration>, 111 : Parallel::Actions::TerminatePhase>>, 112 : Parallel::PhaseActions< 113 : Parallel::Phase::Evolve, 114 : tmpl::list<Actions::ObserveWorldtubeSolution, step_actions, 115 : ::Actions::MutateApply<AdvanceTime<>>, 116 : PhaseControl::Actions::ExecutePhaseChange>>>; 117 : 118 0 : using simple_tags_from_options = Parallel::get_simple_tags_from_options< 119 : Parallel::get_initialization_actions_list<phase_dependent_action_list>>; 120 : 121 0 : static void execute_next_phase( 122 : const typename Parallel::Phase next_phase, 123 : Parallel::CProxy_GlobalCache<Metavariables>& global_cache) { 124 : auto& local_cache = *Parallel::local_branch(global_cache); 125 : Parallel::get_parallel_component<WorldtubeSingleton<metavariables>>( 126 : local_cache) 127 : .start_phase(next_phase); 128 : } 129 : }; 130 : } // namespace CurvedScalarWave::Worldtube