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