Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstdint>
7 : #include <vector>
8 :
9 : #include "Evolution/Actions/RunEventsAndTriggers.hpp"
10 : #include "Evolution/Executables/GeneralizedHarmonic/GeneralizedHarmonicBase.hpp"
11 : #include "Options/Protocols/FactoryCreation.hpp"
12 : #include "Options/String.hpp"
13 : #include "Parallel/ArrayCollection/DgElementCollection.hpp"
14 : #include "Parallel/MemoryMonitor/MemoryMonitor.hpp"
15 : #include "Parallel/PhaseControl/PhaseControlTags.hpp"
16 : #include "Parallel/Protocols/RegistrationMetavariables.hpp"
17 : #include "ParallelAlgorithms/Actions/MutateApply.hpp"
18 : #include "ParallelAlgorithms/Amr/Projectors/CopyFromCreatorOrLeaveAsIs.hpp"
19 : #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/GaugeWave.hpp"
20 : #include "Time/Actions/SelfStartActions.hpp"
21 : #include "Time/AdvanceTime.hpp"
22 : #include "Time/ChangeSlabSize/Action.hpp"
23 : #include "Time/ChangeSlabSize/Tags.hpp"
24 : #include "Time/Tags/StepperErrors.hpp"
25 : #include "Utilities/ErrorHandling/Error.hpp"
26 : #include "Utilities/ProtocolHelpers.hpp"
27 :
28 : template <size_t VolumeDim, bool UseLts>
29 : struct EvolutionMetavars
30 : : public GeneralizedHarmonicTemplateBase<VolumeDim, UseLts> {
31 : static constexpr size_t volume_dim = VolumeDim;
32 0 : using gh_base = GeneralizedHarmonicTemplateBase<volume_dim, UseLts>;
33 0 : using typename gh_base::const_global_cache_tags;
34 0 : using typename gh_base::dg_registration_list;
35 0 : using initialization_actions =
36 : typename gh_base::template initialization_actions<EvolutionMetavars,
37 : false>;
38 0 : using typename gh_base::initialize_initial_data_dependent_quantities_actions;
39 0 : using typename gh_base::observed_reduction_data_tags;
40 0 : using typename gh_base::system;
41 : static constexpr bool local_time_stepping = gh_base::local_time_stepping;
42 : static constexpr bool use_dg_element_collection =
43 : gh_base::use_dg_element_collection;
44 :
45 0 : using step_actions =
46 : typename gh_base::template step_actions<EvolutionMetavars, tmpl::list<>>;
47 :
48 0 : using gh_dg_element_array = DgElementArray<
49 : EvolutionMetavars,
50 : tmpl::flatten<tmpl::list<
51 : Parallel::PhaseActions<Parallel::Phase::Initialization,
52 : initialization_actions>,
53 : Parallel::PhaseActions<
54 : Parallel::Phase::RegisterWithElementDataReader,
55 : tmpl::list<importers::Actions::RegisterWithElementDataReader,
56 : Parallel::Actions::TerminatePhase>>,
57 : Parallel::PhaseActions<
58 : Parallel::Phase::ImportInitialData,
59 : tmpl::list<
60 : gh::Actions::SetInitialData,
61 : tmpl::conditional_t<VolumeDim == 3,
62 : gh::Actions::ReceiveNumericInitialData,
63 : tmpl::list<>>,
64 : Parallel::Actions::TerminatePhase>>,
65 : Parallel::PhaseActions<
66 : Parallel::Phase::InitializeInitialDataDependentQuantities,
67 : initialize_initial_data_dependent_quantities_actions>,
68 : Parallel::PhaseActions<
69 : Parallel::Phase::InitializeTimeStepperHistory,
70 : SelfStart::self_start_procedure<step_actions, system>>,
71 : Parallel::PhaseActions<Parallel::Phase::Register,
72 : tmpl::list<dg_registration_list,
73 : Parallel::Actions::TerminatePhase>>,
74 : Parallel::PhaseActions<Parallel::Phase::Restart,
75 : tmpl::list<dg_registration_list,
76 : Parallel::Actions::TerminatePhase>>,
77 : Parallel::PhaseActions<
78 : Parallel::Phase::WriteCheckpoint,
79 : tmpl::list<evolution::Actions::RunEventsAndTriggers<
80 : Triggers::WhenToCheck::AtCheckpoints>,
81 : Parallel::Actions::TerminatePhase>>,
82 : Parallel::PhaseActions<Parallel::Phase::CheckDomain,
83 : tmpl::list<::amr::Actions::SendAmrDiagnostics,
84 : Parallel::Actions::TerminatePhase>>,
85 : Parallel::PhaseActions<
86 : Parallel::Phase::Evolve,
87 : tmpl::flatten<tmpl::list<
88 : std::conditional_t<local_time_stepping,
89 : evolution::Actions::RunEventsAndTriggers<
90 : Triggers::WhenToCheck::AtSteps>,
91 : tmpl::list<>>,
92 : ::evolution::Actions::RunEventsAndTriggers<
93 : Triggers::WhenToCheck::AtSlabs>,
94 : Actions::ChangeSlabSize, step_actions,
95 : Actions::MutateApply<AdvanceTime>,
96 : PhaseControl::Actions::ExecutePhaseChange>>>>>>;
97 :
98 : struct amr : tt::ConformsTo<::amr::protocols::AmrMetavariables> {
99 0 : using element_array = gh_dg_element_array;
100 0 : using projectors = tmpl::list<
101 : Initialization::ProjectTimeStepping<volume_dim>,
102 : evolution::dg::Initialization::ProjectDomain<volume_dim>,
103 : Initialization::ProjectTimeStepperHistory<EvolutionMetavars>,
104 : ::amr::projectors::ProjectVariables<volume_dim,
105 : typename system::variables_tag>,
106 : evolution::dg::Initialization::ProjectMortars<EvolutionMetavars>,
107 : evolution::Actions::ProjectRunEventsAndDenseTriggers,
108 : ::amr::projectors::DefaultInitialize<
109 : Initialization::Tags::InitialTimeDelta,
110 : Initialization::Tags::InitialSlabSize<local_time_stepping>,
111 : ::domain::Tags::InitialExtents<volume_dim>,
112 : ::domain::Tags::InitialRefinementLevels<volume_dim>,
113 : evolution::dg::Tags::Quadrature,
114 : Tags::StepperErrors<typename system::variables_tag>,
115 : SelfStart::Tags::InitialValue<typename system::variables_tag>,
116 : SelfStart::Tags::InitialValue<Tags::TimeStep>>,
117 : ::amr::projectors::CopyFromCreatorOrLeaveAsIs<
118 : Tags::ChangeSlabSize::NumberOfExpectedMessages,
119 : Tags::ChangeSlabSize::NewSlabSize>>;
120 : static constexpr bool keep_coarse_grids = false;
121 : static constexpr bool p_refine_only_in_event = true;
122 : };
123 :
124 : struct registration
125 : : tt::ConformsTo<Parallel::protocols::RegistrationMetavariables> {
126 0 : using element_registrars =
127 : tmpl::map<tmpl::pair<gh_dg_element_array, dg_registration_list>>;
128 : };
129 :
130 0 : using component_list =
131 : tmpl::flatten<tmpl::list<::amr::Component<EvolutionMetavars>,
132 : observers::Observer<EvolutionMetavars>,
133 : observers::ObserverWriter<EvolutionMetavars>,
134 : mem_monitor::MemoryMonitor<EvolutionMetavars>,
135 : importers::ElementDataReader<EvolutionMetavars>,
136 : gh_dg_element_array>>;
137 :
138 : static constexpr Options::String help{
139 : "Evolve the Einstein field equations using the Generalized Harmonic "
140 : "formulation\n"};
141 : };
|