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 "Domain/Creators/Factory3D.hpp"
10 : #include "Domain/Tags.hpp"
11 : #include "Evolution/Actions/RunEventsAndDenseTriggers.hpp"
12 : #include "Evolution/Actions/RunEventsAndTriggers.hpp"
13 : #include "Evolution/ComputeTags.hpp"
14 : #include "Evolution/Conservative/UpdateConservatives.hpp"
15 : #include "Evolution/Conservative/UpdatePrimitives.hpp"
16 : #include "Evolution/DgSubcell/Actions/Initialize.hpp"
17 : #include "Evolution/DgSubcell/Actions/Labels.hpp"
18 : #include "Evolution/DgSubcell/Actions/ReconstructionCommunication.hpp"
19 : #include "Evolution/DgSubcell/Actions/SelectNumericalMethod.hpp"
20 : #include "Evolution/DgSubcell/Actions/TakeTimeStep.hpp"
21 : #include "Evolution/DgSubcell/Actions/TciAndRollback.hpp"
22 : #include "Evolution/DgSubcell/Actions/TciAndSwitchToDg.hpp"
23 : #include "Evolution/DgSubcell/BackgroundGrVars.hpp"
24 : #include "Evolution/DgSubcell/CartesianFluxDivergence.hpp"
25 : #include "Evolution/DgSubcell/CellCenteredFlux.hpp"
26 : #include "Evolution/DgSubcell/ComputeBoundaryTerms.hpp"
27 : #include "Evolution/DgSubcell/CorrectPackagedData.hpp"
28 : #include "Evolution/DgSubcell/GetTciDecision.hpp"
29 : #include "Evolution/DgSubcell/NeighborReconstructedFaceSolution.hpp"
30 : #include "Evolution/DgSubcell/NeighborTciDecision.hpp"
31 : #include "Evolution/DgSubcell/PerssonTci.hpp"
32 : #include "Evolution/DgSubcell/PrepareNeighborData.hpp"
33 : #include "Evolution/DgSubcell/SetInterpolators.hpp"
34 : #include "Evolution/DgSubcell/Tags/MethodOrder.hpp"
35 : #include "Evolution/DgSubcell/Tags/ObserverCoordinates.hpp"
36 : #include "Evolution/DgSubcell/Tags/ObserverMesh.hpp"
37 : #include "Evolution/DgSubcell/Tags/TciStatus.hpp"
38 : #include "Evolution/DgSubcell/TwoMeshRdmpTci.hpp"
39 : #include "Evolution/DiscontinuousGalerkin/Actions/ApplyBoundaryCorrections.hpp"
40 : #include "Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivative.hpp"
41 : #include "Evolution/DiscontinuousGalerkin/BackgroundGrVars.hpp"
42 : #include "Evolution/DiscontinuousGalerkin/DgElementArray.hpp"
43 : #include "Evolution/DiscontinuousGalerkin/Initialization/Mortars.hpp"
44 : #include "Evolution/DiscontinuousGalerkin/Initialization/QuadratureTag.hpp"
45 : #include "Evolution/DiscontinuousGalerkin/Limiters/Krivodonova.hpp"
46 : #include "Evolution/DiscontinuousGalerkin/Limiters/Minmod.hpp"
47 : #include "Evolution/DiscontinuousGalerkin/Limiters/Tags.hpp"
48 : #include "Evolution/DiscontinuousGalerkin/Limiters/Weno.hpp"
49 : #include "Evolution/Initialization/ConservativeSystem.hpp"
50 : #include "Evolution/Initialization/DgDomain.hpp"
51 : #include "Evolution/Initialization/Evolution.hpp"
52 : #include "Evolution/Initialization/Limiter.hpp"
53 : #include "Evolution/Initialization/SetVariables.hpp"
54 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/AllSolutions.hpp"
55 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/Factory.hpp"
56 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Factory.hpp"
57 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/RegisterDerived.hpp"
58 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/ComovingMagneticFieldMagnitude.hpp"
59 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Factory.hpp"
60 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/RegisterDerivedWithCharm.hpp"
61 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Tag.hpp"
62 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FixConservatives.hpp"
63 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Flattener.hpp"
64 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Fluxes.hpp"
65 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/KastaunEtAl.hpp"
66 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/NewmanHamlin.hpp"
67 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/PalenzuelaEtAl.hpp"
68 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/QuadrupoleFormula.hpp"
69 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/SetVariablesNeededFixingToFalse.hpp"
70 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/FixConservativesAndComputePrims.hpp"
71 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/NeighborPackagedData.hpp"
72 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/PrimitiveGhostData.hpp"
73 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/PrimsAfterRollback.hpp"
74 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/ResizeAndComputePrimitives.hpp"
75 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/SetInitialRdmpData.hpp"
76 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/SwapGrTags.hpp"
77 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/TciOnDgGrid.hpp"
78 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/TciOnFdGrid.hpp"
79 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/TimeDerivative.hpp"
80 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/System.hpp"
81 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
82 : #include "Evolution/VariableFixing/Actions.hpp"
83 : #include "Evolution/VariableFixing/FixToAtmosphere.hpp"
84 : #include "Evolution/VariableFixing/ParameterizedDeleptonization.hpp"
85 : #include "Evolution/VariableFixing/Tags.hpp"
86 : #include "IO/Observer/Actions/RegisterEvents.hpp"
87 : #include "IO/Observer/Helpers.hpp"
88 : #include "IO/Observer/ObserverComponent.hpp"
89 : #include "NumericalAlgorithms/DiscontinuousGalerkin/Formulation.hpp"
90 : #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
91 : #include "NumericalAlgorithms/FiniteDifference/Minmod.hpp"
92 : #include "NumericalAlgorithms/LinearOperators/Divergence.hpp"
93 : #include "Options/Protocols/FactoryCreation.hpp"
94 : #include "Options/String.hpp"
95 : #include "Parallel/Algorithms/AlgorithmSingleton.hpp"
96 : #include "Parallel/Local.hpp"
97 : #include "Parallel/Phase.hpp"
98 : #include "Parallel/PhaseControl/CheckpointAndExitAfterWallclock.hpp"
99 : #include "Parallel/PhaseControl/ExecutePhaseChange.hpp"
100 : #include "Parallel/PhaseControl/Factory.hpp"
101 : #include "Parallel/PhaseControl/VisitAndReturn.hpp"
102 : #include "Parallel/PhaseDependentActionList.hpp"
103 : #include "Parallel/Protocols/RegistrationMetavariables.hpp"
104 : #include "ParallelAlgorithms/Actions/AddComputeTags.hpp"
105 : #include "ParallelAlgorithms/Actions/AddSimpleTags.hpp"
106 : #include "ParallelAlgorithms/Actions/InitializeItems.hpp"
107 : #include "ParallelAlgorithms/Actions/LimiterActions.hpp"
108 : #include "ParallelAlgorithms/Actions/MutateApply.hpp"
109 : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp"
110 : #include "ParallelAlgorithms/Events/Factory.hpp"
111 : #include "ParallelAlgorithms/Events/ObserveNorms.hpp"
112 : #include "ParallelAlgorithms/Events/Tags.hpp"
113 : #include "ParallelAlgorithms/EventsAndDenseTriggers/DenseTrigger.hpp"
114 : #include "ParallelAlgorithms/EventsAndDenseTriggers/DenseTriggers/Factory.hpp"
115 : #include "ParallelAlgorithms/EventsAndTriggers/Actions/RunEventsOnFailure.hpp"
116 : #include "ParallelAlgorithms/EventsAndTriggers/Completion.hpp"
117 : #include "ParallelAlgorithms/EventsAndTriggers/Event.hpp"
118 : #include "ParallelAlgorithms/EventsAndTriggers/EventsAndTriggers.hpp" // IWYU pragma: keep
119 : #include "ParallelAlgorithms/EventsAndTriggers/LogicalTriggers.hpp"
120 : #include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp"
121 : #include "ParallelAlgorithms/Interpolation/Actions/CleanUpInterpolator.hpp"
122 : #include "ParallelAlgorithms/Interpolation/Actions/ElementInitInterpPoints.hpp"
123 : #include "ParallelAlgorithms/Interpolation/Actions/InitializeInterpolationTarget.hpp"
124 : #include "ParallelAlgorithms/Interpolation/Actions/InterpolationTargetReceiveVars.hpp"
125 : #include "ParallelAlgorithms/Interpolation/Actions/InterpolatorReceivePoints.hpp"
126 : #include "ParallelAlgorithms/Interpolation/Actions/InterpolatorReceiveVolumeData.hpp"
127 : #include "ParallelAlgorithms/Interpolation/Actions/InterpolatorRegisterElement.hpp"
128 : #include "ParallelAlgorithms/Interpolation/Actions/TryToInterpolate.hpp"
129 : #include "ParallelAlgorithms/Interpolation/Callbacks/ObserveTimeSeriesOnSurface.hpp"
130 : #include "ParallelAlgorithms/Interpolation/Events/Interpolate.hpp"
131 : #include "ParallelAlgorithms/Interpolation/Events/InterpolateWithoutInterpComponent.hpp"
132 : #include "ParallelAlgorithms/Interpolation/InterpolationTarget.hpp"
133 : #include "ParallelAlgorithms/Interpolation/Interpolator.hpp"
134 : #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp"
135 : #include "ParallelAlgorithms/Interpolation/Tags.hpp"
136 : #include "ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp"
137 : #include "ParallelAlgorithms/Interpolation/Targets/SpecifiedPoints.hpp"
138 : #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp"
139 : #include "PointwiseFunctions/AnalyticData/GrMhd/BlastWave.hpp"
140 : #include "PointwiseFunctions/AnalyticData/GrMhd/BondiHoyleAccretion.hpp"
141 : #include "PointwiseFunctions/AnalyticData/GrMhd/CcsnCollapse.hpp"
142 : #include "PointwiseFunctions/AnalyticData/GrMhd/KhInstability.hpp"
143 : #include "PointwiseFunctions/AnalyticData/GrMhd/MagneticFieldLoop.hpp"
144 : #include "PointwiseFunctions/AnalyticData/GrMhd/MagneticRotor.hpp"
145 : #include "PointwiseFunctions/AnalyticData/GrMhd/MagnetizedFmDisk.hpp"
146 : #include "PointwiseFunctions/AnalyticData/GrMhd/MagnetizedTovStar.hpp"
147 : #include "PointwiseFunctions/AnalyticData/GrMhd/OrszagTangVortex.hpp"
148 : #include "PointwiseFunctions/AnalyticData/GrMhd/PolarMagnetizedFmDisk.hpp"
149 : #include "PointwiseFunctions/AnalyticData/GrMhd/RiemannProblem.hpp"
150 : #include "PointwiseFunctions/AnalyticData/GrMhd/SlabJet.hpp"
151 : #include "PointwiseFunctions/AnalyticData/Tags.hpp"
152 : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
153 : #include "PointwiseFunctions/AnalyticSolutions/GrMhd/AlfvenWave.hpp"
154 : #include "PointwiseFunctions/AnalyticSolutions/GrMhd/BondiMichel.hpp"
155 : #include "PointwiseFunctions/AnalyticSolutions/GrMhd/KomissarovShock.hpp"
156 : #include "PointwiseFunctions/AnalyticSolutions/GrMhd/SmoothFlow.hpp"
157 : #include "PointwiseFunctions/AnalyticSolutions/RelativisticEuler/FishboneMoncriefDisk.hpp"
158 : #include "PointwiseFunctions/AnalyticSolutions/RelativisticEuler/RotatingStar.hpp"
159 : #include "PointwiseFunctions/AnalyticSolutions/RelativisticEuler/TovStar.hpp"
160 : #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
161 : #include "PointwiseFunctions/GeneralRelativity/Surfaces/Tags.hpp"
162 : #include "PointwiseFunctions/Hydro/EquationsOfState/Factory.hpp"
163 : #include "PointwiseFunctions/Hydro/EquationsOfState/RegisterDerivedWithCharm.hpp"
164 : #include "PointwiseFunctions/Hydro/InversePlasmaBeta.hpp"
165 : #include "PointwiseFunctions/Hydro/MassFlux.hpp"
166 : #include "PointwiseFunctions/Hydro/QuadrupoleFormula.hpp"
167 : #include "PointwiseFunctions/Hydro/Tags.hpp"
168 : #include "PointwiseFunctions/Hydro/TransportVelocity.hpp"
169 : #include "Time/Actions/AdvanceTime.hpp"
170 : #include "Time/Actions/RecordTimeStepperData.hpp"
171 : #include "Time/Actions/SelfStartActions.hpp" // IWYU pragma: keep
172 : #include "Time/Actions/UpdateU.hpp"
173 : #include "Time/ChangeSlabSize/Action.hpp"
174 : #include "Time/StepChoosers/Factory.hpp"
175 : #include "Time/StepChoosers/StepChooser.hpp"
176 : #include "Time/Tags/Time.hpp"
177 : #include "Time/Tags/TimeStepId.hpp"
178 : #include "Time/TimeSequence.hpp"
179 : #include "Time/TimeSteppers/Factory.hpp"
180 : #include "Time/TimeSteppers/LtsTimeStepper.hpp"
181 : #include "Time/TimeSteppers/TimeStepper.hpp"
182 : #include "Time/Triggers/TimeTriggers.hpp"
183 : #include "Utilities/Functional.hpp"
184 : #include "Utilities/ProtocolHelpers.hpp"
185 : #include "Utilities/TMPL.hpp"
186 :
187 : /// \cond
188 : namespace Frame {
189 : struct Inertial;
190 : } // namespace Frame
191 : namespace PUP {
192 : class er;
193 : } // namespace PUP
194 : namespace Parallel {
195 : template <typename Metavariables>
196 : class CProxy_GlobalCache;
197 : } // namespace Parallel
198 : /// \endcond
199 :
200 : template <typename InterpolationTargetTags, bool UseParametrizedDeleptonization>
201 : struct EvolutionMetavars;
202 :
203 : template <typename... InterpolationTargetTags,
204 : bool UseParametrizedDeleptonization>
205 0 : struct EvolutionMetavars<tmpl::list<InterpolationTargetTags...>,
206 : UseParametrizedDeleptonization> {
207 : // The use_dg_subcell flag controls whether to use "standard" limiting (false)
208 : // or a DG-FD hybrid scheme (true).
209 0 : static constexpr bool use_parametrized_deleptonization =
210 : UseParametrizedDeleptonization;
211 0 : static constexpr bool use_dg_subcell = true;
212 0 : static constexpr size_t volume_dim = 3;
213 0 : static constexpr dg::Formulation dg_formulation =
214 : dg::Formulation::StrongInertial;
215 0 : using initial_data_list =
216 : grmhd::ValenciaDivClean::InitialData::initial_data_list;
217 :
218 : // Boolean verifying if parameterized deleptonization will be active. This
219 : // will only be active for CCSN evolution.
220 0 : using parameterized_deleptonization =
221 : tmpl::conditional_t<UseParametrizedDeleptonization,
222 : VariableFixing::Actions::FixVariables<
223 : VariableFixing::ParameterizedDeleptonization>,
224 : tmpl::list<>>;
225 0 : using eos_base = EquationsOfState::EquationOfState<true, 3>;
226 0 : using equation_of_state_type = typename std::unique_ptr<eos_base>;
227 0 : using initial_data_tag = evolution::initial_data::Tags::InitialData;
228 0 : using system = grmhd::ValenciaDivClean::System;
229 0 : using temporal_id = Tags::TimeStepId;
230 0 : using TimeStepperBase = TimeStepper;
231 :
232 0 : static constexpr bool local_time_stepping =
233 : TimeStepperBase::local_time_stepping;
234 :
235 0 : using analytic_variables_tags =
236 : typename system::primitive_variables_tag::tags_list;
237 0 : using equation_of_state_tag = hydro::Tags::GrmhdEquationOfState;
238 : // Do not limit the divergence-cleaning field Phi
239 0 : using limiter = Tags::Limiter<
240 : Limiters::Minmod<3, tmpl::list<grmhd::ValenciaDivClean::Tags::TildeD,
241 : grmhd::ValenciaDivClean::Tags::TildeYe,
242 : grmhd::ValenciaDivClean::Tags::TildeTau,
243 : grmhd::ValenciaDivClean::Tags::TildeS<>,
244 : grmhd::ValenciaDivClean::Tags::TildeB<>>>>;
245 :
246 0 : using interpolator_source_vars =
247 : tmpl::remove_duplicates<tmpl::flatten<tmpl::list<
248 : typename InterpolationTargetTags::vars_to_interpolate_to_target...>>>;
249 :
250 0 : using ordered_list_of_primitive_recovery_schemes = tmpl::list<
251 : grmhd::ValenciaDivClean::PrimitiveRecoverySchemes::KastaunEtAl,
252 : grmhd::ValenciaDivClean::PrimitiveRecoverySchemes::NewmanHamlin,
253 : grmhd::ValenciaDivClean::PrimitiveRecoverySchemes::PalenzuelaEtAl>;
254 :
255 0 : using interpolation_target_tags = tmpl::list<InterpolationTargetTags...>;
256 :
257 0 : using analytic_compute = evolution::Tags::AnalyticSolutionsCompute<
258 : volume_dim, analytic_variables_tags, use_dg_subcell, initial_data_list>;
259 0 : using error_compute = Tags::ErrorsCompute<analytic_variables_tags>;
260 0 : using error_tags = db::wrap_tags_in<Tags::Error, analytic_variables_tags>;
261 0 : using observe_fields = tmpl::push_back<
262 : tmpl::append<
263 : typename system::variables_tag::tags_list,
264 : typename system::primitive_variables_tag::tags_list,
265 : tmpl::list<
266 : grmhd::ValenciaDivClean::Tags::
267 : ComovingMagneticFieldMagnitudeCompute,
268 : ::Tags::DivVectorCompute<
269 : hydro::Tags::MagneticField<DataVector, volume_dim>,
270 : ::Events::Tags::ObserverMesh<volume_dim>,
271 : ::Events::Tags::ObserverInverseJacobian<
272 : volume_dim, Frame::ElementLogical, Frame::Inertial>>>,
273 : error_tags,
274 : tmpl::conditional_t<
275 : use_dg_subcell,
276 : tmpl::list<
277 : evolution::dg::subcell::Tags::TciStatusCompute<volume_dim>,
278 : evolution::dg::subcell::Tags::MethodOrderCompute<volume_dim>>,
279 : tmpl::list<>>>,
280 : tmpl::conditional_t<
281 : use_dg_subcell,
282 : evolution::dg::subcell::Tags::ObserverCoordinatesCompute<
283 : volume_dim, Frame::ElementLogical>,
284 : ::Events::Tags::ObserverCoordinatesCompute<volume_dim,
285 : Frame::ElementLogical>>,
286 : tmpl::conditional_t<
287 : use_dg_subcell,
288 : evolution::dg::subcell::Tags::ObserverCoordinatesCompute<volume_dim,
289 : Frame::Grid>,
290 : ::Events::Tags::ObserverCoordinatesCompute<volume_dim, Frame::Grid>>,
291 : tmpl::conditional_t<
292 : use_dg_subcell,
293 : evolution::dg::subcell::Tags::ObserverCoordinatesCompute<
294 : volume_dim, Frame::Inertial>,
295 : ::Events::Tags::ObserverCoordinatesCompute<volume_dim,
296 : Frame::Inertial>>,
297 : grmhd::ValenciaDivClean::Tags::QuadrupoleMomentCompute<
298 : DataVector, volume_dim,
299 : ::Events::Tags::ObserverCoordinates<volume_dim, Frame::Inertial>>,
300 : grmhd::ValenciaDivClean::Tags::QuadrupoleMomentDerivativeCompute<
301 : DataVector, volume_dim,
302 : ::Events::Tags::ObserverCoordinates<volume_dim, Frame::Inertial>,
303 : hydro::Tags::SpatialVelocity<DataVector, volume_dim,
304 : Frame::Inertial>>,
305 : hydro::Tags::TransportVelocityCompute<DataVector, volume_dim,
306 : Frame::Inertial>,
307 : grmhd::ValenciaDivClean::Tags::QuadrupoleMomentDerivativeCompute<
308 : DataVector, volume_dim,
309 : ::Events::Tags::ObserverCoordinates<volume_dim, Frame::Inertial>,
310 : hydro::Tags::TransportVelocity<DataVector, volume_dim,
311 : Frame::Inertial>>,
312 : hydro::Tags::InversePlasmaBetaCompute<DataVector>>;
313 0 : using non_tensor_compute_tags = tmpl::list<
314 : tmpl::conditional_t<
315 : use_dg_subcell,
316 : tmpl::list<
317 : evolution::dg::subcell::Tags::ObserverMeshCompute<volume_dim>,
318 : evolution::dg::subcell::Tags::ObserverInverseJacobianCompute<
319 : volume_dim, Frame::ElementLogical, Frame::Inertial>,
320 : evolution::dg::subcell::Tags::
321 : ObserverJacobianAndDetInvJacobianCompute<
322 : volume_dim, Frame::ElementLogical, Frame::Inertial>>,
323 : tmpl::list<::Events::Tags::ObserverMeshCompute<volume_dim>,
324 : ::Events::Tags::ObserverInverseJacobianCompute<
325 : volume_dim, Frame::ElementLogical, Frame::Inertial>,
326 : ::Events::Tags::ObserverJacobianCompute<
327 : volume_dim, Frame::ElementLogical, Frame::Inertial>,
328 : ::Events::Tags::ObserverDetInvJacobianCompute<
329 : Frame::ElementLogical, Frame::Inertial>>>,
330 : analytic_compute, error_compute>;
331 :
332 0 : struct factory_creation
333 : : tt::ConformsTo<Options::protocols::FactoryCreation> {
334 0 : using factory_classes = tmpl::map<
335 : tmpl::pair<DenseTrigger, DenseTriggers::standard_dense_triggers>,
336 : tmpl::pair<DomainCreator<volume_dim>, domain_creators<volume_dim>>,
337 : tmpl::pair<
338 : Event,
339 : tmpl::flatten<tmpl::list<
340 : Events::Completion,
341 : dg::Events::field_observations<volume_dim, observe_fields,
342 : non_tensor_compute_tags>,
343 : Events::time_events<system>,
344 : intrp::Events::InterpolateWithoutInterpComponent<
345 : 3, InterpolationTargetTags, interpolator_source_vars>...>>>,
346 : tmpl::pair<evolution::initial_data::InitialData, initial_data_list>,
347 : tmpl::pair<
348 : grmhd::ValenciaDivClean::BoundaryConditions::BoundaryCondition,
349 : grmhd::ValenciaDivClean::BoundaryConditions::
350 : standard_boundary_conditions>,
351 : tmpl::pair<LtsTimeStepper, TimeSteppers::lts_time_steppers>,
352 : tmpl::pair<PhaseChange, PhaseControl::factory_creatable_classes>,
353 : tmpl::pair<StepChooser<StepChooserUse::LtsStep>,
354 : StepChoosers::standard_step_choosers<system>>,
355 : tmpl::pair<
356 : StepChooser<StepChooserUse::Slab>,
357 : StepChoosers::standard_slab_choosers<system, local_time_stepping>>,
358 : tmpl::pair<TimeSequence<double>,
359 : TimeSequences::all_time_sequences<double>>,
360 : tmpl::pair<TimeSequence<std::uint64_t>,
361 : TimeSequences::all_time_sequences<std::uint64_t>>,
362 : tmpl::pair<TimeStepper, TimeSteppers::time_steppers>,
363 : tmpl::pair<Trigger, tmpl::append<Triggers::logical_triggers,
364 : Triggers::time_triggers>>>;
365 : };
366 :
367 0 : using observed_reduction_data_tags = observers::collect_reduction_data_tags<
368 : tmpl::at<typename factory_creation::factory_classes, Event>>;
369 :
370 0 : struct SubcellOptions {
371 0 : using evolved_vars_tags = typename system::variables_tag::tags_list;
372 0 : using prim_tags = typename system::primitive_variables_tag::tags_list;
373 0 : using recons_prim_tags = tmpl::push_back<
374 : prim_tags,
375 : hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>>;
376 0 : using fluxes_tags =
377 : db::wrap_tags_in<Tags::Flux, evolved_vars_tags,
378 : tmpl::size_t<volume_dim>, Frame::Inertial>;
379 :
380 0 : static constexpr bool subcell_enabled = use_dg_subcell;
381 0 : static constexpr bool subcell_enabled_at_external_boundary = true;
382 :
383 : // We send `ghost_zone_size` cell-centered grid points for variable
384 : // reconstruction, of which we need `ghost_zone_size-1` for reconstruction
385 : // to the internal side of the element face, and `ghost_zone_size` for
386 : // reconstruction to the external side of the element face.
387 : template <typename DbTagsList>
388 0 : static constexpr size_t ghost_zone_size(
389 : const db::DataBox<DbTagsList>& box) {
390 : return db::get<grmhd::ValenciaDivClean::fd::Tags::Reconstructor>(box)
391 : .ghost_zone_size();
392 : }
393 :
394 0 : using DgComputeSubcellNeighborPackagedData =
395 : grmhd::ValenciaDivClean::subcell::NeighborPackagedData;
396 :
397 0 : using GhostVariables =
398 : grmhd::ValenciaDivClean::subcell::PrimitiveGhostVariables;
399 : };
400 :
401 0 : using events_and_dense_triggers_subcell_postprocessors =
402 : tmpl::list<AlwaysReadyPostprocessor<
403 : grmhd::ValenciaDivClean::subcell::FixConservativesAndComputePrims<
404 : ordered_list_of_primitive_recovery_schemes>>>;
405 :
406 0 : using dg_step_actions = tmpl::flatten<tmpl::list<
407 : Actions::MutateApply<
408 : evolution::dg::BackgroundGrVars<system, EvolutionMetavars, true>>,
409 : evolution::dg::Actions::ComputeTimeDerivative<
410 : volume_dim, system, AllStepChoosers, local_time_stepping>,
411 : tmpl::conditional_t<
412 : local_time_stepping,
413 : tmpl::list<evolution::Actions::RunEventsAndDenseTriggers<tmpl::list<
414 : evolution::dg::ApplyBoundaryCorrections<
415 : local_time_stepping, system, volume_dim, true>,
416 : system::primitive_from_conservative<
417 : ordered_list_of_primitive_recovery_schemes>>>,
418 : evolution::dg::Actions::ApplyLtsBoundaryCorrections<
419 : system, volume_dim, false>>,
420 : tmpl::list<
421 : evolution::dg::Actions::ApplyBoundaryCorrectionsToTimeDerivative<
422 : system, volume_dim, false>,
423 : Actions::RecordTimeStepperData<system>,
424 : evolution::Actions::RunEventsAndDenseTriggers<
425 : tmpl::list<system::primitive_from_conservative<
426 : ordered_list_of_primitive_recovery_schemes>>>,
427 : Actions::UpdateU<system>>>,
428 : Limiters::Actions::SendData<EvolutionMetavars>,
429 : Limiters::Actions::Limit<EvolutionMetavars>,
430 : VariableFixing::Actions::FixVariables<grmhd::ValenciaDivClean::Flattener<
431 : ordered_list_of_primitive_recovery_schemes>>,
432 : parameterized_deleptonization,
433 : VariableFixing::Actions::FixVariables<
434 : VariableFixing::FixToAtmosphere<volume_dim>>,
435 : Actions::UpdateConservatives>>;
436 :
437 0 : using dg_subcell_step_actions = tmpl::flatten<tmpl::list<
438 : evolution::dg::subcell::Actions::SelectNumericalMethod,
439 :
440 : Actions::Label<evolution::dg::subcell::Actions::Labels::BeginDg>,
441 : Actions::MutateApply<
442 : evolution::dg::BackgroundGrVars<system, EvolutionMetavars, true>>,
443 : evolution::dg::Actions::ComputeTimeDerivative<
444 : volume_dim, system, AllStepChoosers, local_time_stepping>,
445 : evolution::dg::Actions::ApplyBoundaryCorrectionsToTimeDerivative<
446 : system, volume_dim, false>,
447 : tmpl::conditional_t<
448 : local_time_stepping, tmpl::list<>,
449 : tmpl::list<Actions::RecordTimeStepperData<system>,
450 : evolution::Actions::RunEventsAndDenseTriggers<
451 : events_and_dense_triggers_subcell_postprocessors>,
452 : Actions::UpdateU<system>>>,
453 : // Note: The primitive variables are computed as part of the TCI.
454 : evolution::dg::subcell::Actions::TciAndRollback<
455 : grmhd::ValenciaDivClean::subcell::TciOnDgGrid<
456 : tmpl::front<ordered_list_of_primitive_recovery_schemes>>>,
457 : parameterized_deleptonization,
458 : VariableFixing::Actions::FixVariables<
459 : VariableFixing::FixToAtmosphere<volume_dim>>,
460 : Actions::UpdateConservatives,
461 : Actions::Goto<evolution::dg::subcell::Actions::Labels::EndOfSolvers>,
462 :
463 : Actions::Label<evolution::dg::subcell::Actions::Labels::BeginSubcell>,
464 : Actions::MutateApply<evolution::dg::subcell::BackgroundGrVars<
465 : system, EvolutionMetavars, true, false>>,
466 : Actions::MutateApply<evolution::dg::subcell::fd::CellCenteredFlux<
467 : system, grmhd::ValenciaDivClean::ComputeFluxes, volume_dim, false>>,
468 : evolution::dg::subcell::Actions::SendDataForReconstruction<
469 : volume_dim, grmhd::ValenciaDivClean::subcell::PrimitiveGhostVariables,
470 : local_time_stepping>,
471 : evolution::dg::subcell::Actions::ReceiveDataForReconstruction<volume_dim>,
472 : Actions::Label<
473 : evolution::dg::subcell::Actions::Labels::BeginSubcellAfterDgRollback>,
474 : Actions::MutateApply<evolution::dg::subcell::BackgroundGrVars<
475 : system, EvolutionMetavars, true, true>>,
476 : Actions::MutateApply<grmhd::ValenciaDivClean::subcell::SwapGrTags>,
477 : Actions::MutateApply<grmhd::ValenciaDivClean::subcell::PrimsAfterRollback<
478 : ordered_list_of_primitive_recovery_schemes>>,
479 : Actions::MutateApply<evolution::dg::subcell::fd::CellCenteredFlux<
480 : system, grmhd::ValenciaDivClean::ComputeFluxes, volume_dim, true>>,
481 : evolution::dg::subcell::fd::Actions::TakeTimeStep<
482 : grmhd::ValenciaDivClean::subcell::TimeDerivative>,
483 : Actions::RecordTimeStepperData<system>,
484 : evolution::Actions::RunEventsAndDenseTriggers<
485 : events_and_dense_triggers_subcell_postprocessors>,
486 : Actions::UpdateU<system>,
487 : Actions::MutateApply<
488 : grmhd::ValenciaDivClean::subcell::FixConservativesAndComputePrims<
489 : ordered_list_of_primitive_recovery_schemes>>,
490 : evolution::dg::subcell::Actions::TciAndSwitchToDg<
491 : grmhd::ValenciaDivClean::subcell::TciOnFdGrid>,
492 : Actions::MutateApply<grmhd::ValenciaDivClean::subcell::SwapGrTags>,
493 : Actions::MutateApply<
494 : grmhd::ValenciaDivClean::subcell::ResizeAndComputePrims<
495 : ordered_list_of_primitive_recovery_schemes>>,
496 : parameterized_deleptonization,
497 : VariableFixing::Actions::FixVariables<
498 : VariableFixing::FixToAtmosphere<volume_dim>>,
499 : Actions::UpdateConservatives,
500 :
501 : Actions::Label<evolution::dg::subcell::Actions::Labels::EndOfSolvers>>>;
502 :
503 0 : using step_actions =
504 : tmpl::conditional_t<use_dg_subcell, dg_subcell_step_actions,
505 : dg_step_actions>;
506 :
507 0 : using dg_registration_list =
508 : tmpl::list<intrp::Actions::RegisterElementWithInterpolator,
509 : observers::Actions::RegisterEventsWithObservers>;
510 :
511 0 : using initialization_actions = tmpl::flatten<tmpl::list<
512 : Initialization::Actions::InitializeItems<
513 : Initialization::TimeStepping<EvolutionMetavars, TimeStepperBase>,
514 : evolution::dg::Initialization::Domain<3>,
515 : Initialization::TimeStepperHistory<EvolutionMetavars>>,
516 : Initialization::Actions::AddSimpleTags<
517 : evolution::dg::BackgroundGrVars<system, EvolutionMetavars, true>>,
518 : Initialization::Actions::ConservativeSystem<system>,
519 :
520 : tmpl::conditional_t<
521 : use_dg_subcell,
522 : tmpl::list<
523 : evolution::dg::subcell::Actions::SetSubcellGrid<volume_dim,
524 : system, false>,
525 : Actions::MutateApply<
526 : evolution::dg::subcell::SetInterpolators<volume_dim>>,
527 : Initialization::Actions::AddSimpleTags<
528 : evolution::dg::subcell::BackgroundGrVars<
529 : system, EvolutionMetavars, true, false>,
530 : grmhd::ValenciaDivClean::SetVariablesNeededFixingToFalse>,
531 : Actions::MutateApply<
532 : grmhd::ValenciaDivClean::subcell::SwapGrTags>,
533 : parameterized_deleptonization,
534 : VariableFixing::Actions::FixVariables<
535 : VariableFixing::FixToAtmosphere<volume_dim>>,
536 : Actions::UpdateConservatives,
537 : evolution::dg::subcell::Actions::SetAndCommunicateInitialRdmpData<
538 : volume_dim,
539 : grmhd::ValenciaDivClean::subcell::SetInitialRdmpData>,
540 : evolution::dg::subcell::Actions::ComputeAndSendTciOnInitialGrid<
541 : volume_dim, system,
542 : grmhd::ValenciaDivClean::subcell::TciOnFdGrid>,
543 : evolution::dg::subcell::Actions::SetInitialGridFromTciData<
544 : volume_dim, system>,
545 : Actions::MutateApply<
546 : grmhd::ValenciaDivClean::subcell::SwapGrTags>,
547 : Actions::MutateApply<
548 : grmhd::ValenciaDivClean::subcell::ResizeAndComputePrims<
549 : ordered_list_of_primitive_recovery_schemes>>,
550 : parameterized_deleptonization,
551 : VariableFixing::Actions::FixVariables<
552 : VariableFixing::FixToAtmosphere<volume_dim>>,
553 : Actions::UpdateConservatives>,
554 : tmpl::list<evolution::Initialization::Actions::SetVariables<
555 : domain::Tags::Coordinates<3, Frame::ElementLogical>>,
556 : parameterized_deleptonization,
557 : VariableFixing::Actions::FixVariables<
558 : VariableFixing::FixToAtmosphere<volume_dim>>,
559 : Actions::UpdateConservatives>>,
560 :
561 : Initialization::Actions::AddComputeTags<
562 : StepChoosers::step_chooser_compute_tags<EvolutionMetavars,
563 : local_time_stepping>>,
564 : ::evolution::dg::Initialization::Mortars<volume_dim, system>,
565 : Initialization::Actions::Minmod<3>,
566 : evolution::Actions::InitializeRunEventsAndDenseTriggers,
567 : intrp::Actions::ElementInitInterpPoints<
568 : intrp::Tags::InterpPointInfo<EvolutionMetavars>>,
569 : Parallel::Actions::TerminatePhase>>;
570 :
571 0 : using dg_element_array_component = DgElementArray<
572 : EvolutionMetavars,
573 : tmpl::list<Parallel::PhaseActions<Parallel::Phase::Initialization,
574 : initialization_actions>,
575 :
576 : Parallel::PhaseActions<
577 : Parallel::Phase::InitializeTimeStepperHistory,
578 : SelfStart::self_start_procedure<step_actions, system>>,
579 :
580 : Parallel::PhaseActions<
581 : Parallel::Phase::Register,
582 : tmpl::push_back<dg_registration_list,
583 : Parallel::Actions::TerminatePhase>>,
584 :
585 : Parallel::PhaseActions<
586 : Parallel::Phase::Evolve,
587 : tmpl::list<evolution::Actions::RunEventsAndTriggers,
588 : Actions::ChangeSlabSize, step_actions,
589 : Actions::AdvanceTime,
590 : PhaseControl::Actions::ExecutePhaseChange>>,
591 : Parallel::PhaseActions<
592 : Parallel::Phase::PostFailureCleanup,
593 : tmpl::list<Actions::RunEventsOnFailure<Tags::Time>,
594 : Parallel::Actions::TerminatePhase>>>>;
595 :
596 0 : struct registration
597 : : tt::ConformsTo<Parallel::protocols::RegistrationMetavariables> {
598 0 : using element_registrars =
599 : tmpl::map<tmpl::pair<dg_element_array_component, dg_registration_list>>;
600 : };
601 :
602 0 : using component_list = tmpl::list<
603 : observers::Observer<EvolutionMetavars>,
604 : observers::ObserverWriter<EvolutionMetavars>,
605 : intrp::Interpolator<EvolutionMetavars>,
606 : intrp::InterpolationTarget<EvolutionMetavars, InterpolationTargetTags>...,
607 : dg_element_array_component>;
608 :
609 0 : using const_global_cache_tags = tmpl::push_back<
610 : tmpl::conditional_t<
611 : use_dg_subcell,
612 : tmpl::list<
613 : grmhd::ValenciaDivClean::fd::Tags::Reconstructor,
614 : ::Tags::VariableFixer<grmhd::ValenciaDivClean::FixConservatives>,
615 : grmhd::ValenciaDivClean::Tags::PrimitiveFromConservativeOptions,
616 : grmhd::ValenciaDivClean::subcell::Tags::TciOptions>,
617 : tmpl::list<>>,
618 : equation_of_state_tag, initial_data_tag,
619 : grmhd::ValenciaDivClean::Tags::ConstraintDampingParameter>;
620 :
621 0 : static constexpr Options::String help{
622 : "Evolve the Valencia formulation of the GRMHD system with divergence "
623 : "cleaning.\n\n"};
624 :
625 0 : static constexpr std::array<Parallel::Phase, 5> default_phase_order{
626 : {Parallel::Phase::Initialization,
627 : Parallel::Phase::InitializeTimeStepperHistory, Parallel::Phase::Register,
628 : Parallel::Phase::Evolve, Parallel::Phase::Exit}};
629 :
630 : // NOLINTNEXTLINE(google-runtime-references)
631 0 : void pup(PUP::er& /*p*/) {}
632 : };
633 :
634 0 : struct CenterOfStar : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
635 0 : struct MaxOfScalar : db::SimpleTag {
636 0 : using type = double;
637 : };
638 :
639 : template <typename TagOfScalar>
640 0 : struct MaxOfScalarCompute : db::ComputeTag, MaxOfScalar {
641 0 : using base = MaxOfScalar;
642 0 : using return_type = double;
643 0 : static void function(const gsl::not_null<double*> max_of_scalar,
644 : const Scalar<DataVector>& scalar) {
645 : *max_of_scalar = max(get(scalar));
646 : };
647 0 : using argument_tags = tmpl::list<TagOfScalar>;
648 : };
649 :
650 0 : using temporal_id = ::Tags::Time;
651 0 : using tags_to_observe =
652 : tmpl::list<MaxOfScalarCompute<hydro::Tags::RestMassDensity<DataVector>>>;
653 0 : using vars_to_interpolate_to_target =
654 : tmpl::list<hydro::Tags::RestMassDensity<DataVector>>;
655 0 : using post_interpolation_callbacks =
656 : tmpl::list<intrp::callbacks::ObserveTimeSeriesOnSurface<tags_to_observe,
657 : CenterOfStar>>;
658 0 : using compute_target_points =
659 : intrp::TargetPoints::SpecifiedPoints<CenterOfStar, 3>;
660 0 : using compute_items_on_target = tags_to_observe;
661 :
662 : template <typename Metavariables>
663 0 : using interpolating_component =
664 : typename Metavariables::dg_element_array_component;
665 : };
666 :
667 0 : struct KerrHorizon : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
668 0 : using temporal_id = ::Tags::Time;
669 0 : using tags_to_observe =
670 : tmpl::list<ylm::Tags::EuclideanSurfaceIntegralVectorCompute<
671 : hydro::Tags::MassFlux<DataVector, 3>, ::Frame::Inertial>>;
672 0 : using vars_to_interpolate_to_target =
673 : tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
674 : hydro::Tags::SpatialVelocity<DataVector, 3>,
675 : hydro::Tags::LorentzFactor<DataVector>,
676 : gr::Tags::Lapse<DataVector>, gr::Tags::Shift<DataVector, 3>,
677 : gr::Tags::SqrtDetSpatialMetric<DataVector>>;
678 0 : using compute_items_on_target = tmpl::push_front<
679 : tags_to_observe,
680 : ylm::Tags::EuclideanAreaElementCompute<::Frame::Inertial>,
681 : hydro::Tags::MassFluxCompute<DataVector, 3, ::Frame::Inertial>>;
682 0 : using compute_target_points =
683 : intrp::TargetPoints::KerrHorizon<KerrHorizon, ::Frame::Inertial>;
684 0 : using post_interpolation_callbacks =
685 : tmpl::list<intrp::callbacks::ObserveTimeSeriesOnSurface<tags_to_observe,
686 : KerrHorizon>>;
687 :
688 : template <typename Metavariables>
689 0 : using interpolating_component =
690 : typename Metavariables::dg_element_array_component;
691 : };
|