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