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