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