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