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