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