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