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/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 unlimited DG (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 :
228 0 : static constexpr bool use_dg_element_collection = false;
229 :
230 0 : using analytic_variables_tags =
231 : typename system::primitive_variables_tag::tags_list;
232 0 : using equation_of_state_tag = hydro::Tags::GrmhdEquationOfState;
233 :
234 0 : using interpolator_source_vars =
235 : tmpl::remove_duplicates<tmpl::flatten<tmpl::list<
236 : typename InterpolationTargetTags::vars_to_interpolate_to_target...>>>;
237 :
238 0 : using ordered_list_of_primitive_recovery_schemes = tmpl::list<
239 : grmhd::ValenciaDivClean::PrimitiveRecoverySchemes::KastaunEtAl,
240 : grmhd::ValenciaDivClean::PrimitiveRecoverySchemes::NewmanHamlin,
241 : grmhd::ValenciaDivClean::PrimitiveRecoverySchemes::PalenzuelaEtAl>;
242 :
243 0 : using interpolation_target_tags = tmpl::list<InterpolationTargetTags...>;
244 :
245 0 : using analytic_compute = evolution::Tags::AnalyticSolutionsCompute<
246 : volume_dim, analytic_variables_tags, use_dg_subcell, initial_data_list>;
247 0 : using error_compute = Tags::ErrorsCompute<analytic_variables_tags>;
248 0 : using error_tags = db::wrap_tags_in<Tags::Error, analytic_variables_tags>;
249 0 : using observe_fields = tmpl::push_back<
250 : tmpl::append<
251 : typename system::variables_tag::tags_list,
252 : typename system::primitive_variables_tag::tags_list,
253 : typename system::flux_spacetime_variables_tag::tags_list,
254 : tmpl::list<
255 : grmhd::ValenciaDivClean::Tags::
256 : ComovingMagneticFieldMagnitudeCompute,
257 : ::Tags::DivVectorCompute<
258 : hydro::Tags::MagneticField<DataVector, volume_dim>,
259 : ::Events::Tags::ObserverMesh<volume_dim>,
260 : ::Events::Tags::ObserverInverseJacobian<
261 : volume_dim, Frame::ElementLogical, Frame::Inertial>>>,
262 : error_tags,
263 : tmpl::conditional_t<
264 : use_dg_subcell,
265 : tmpl::list<
266 : evolution::dg::subcell::Tags::TciStatusCompute<volume_dim>,
267 : evolution::dg::subcell::Tags::MethodOrderCompute<volume_dim>>,
268 : tmpl::list<>>>,
269 : tmpl::conditional_t<
270 : use_dg_subcell,
271 : evolution::dg::subcell::Tags::ObserverCoordinatesCompute<
272 : volume_dim, Frame::ElementLogical>,
273 : ::Events::Tags::ObserverCoordinatesCompute<volume_dim,
274 : Frame::ElementLogical>>,
275 : tmpl::conditional_t<
276 : use_dg_subcell,
277 : evolution::dg::subcell::Tags::ObserverCoordinatesCompute<volume_dim,
278 : Frame::Grid>,
279 : ::Events::Tags::ObserverCoordinatesCompute<volume_dim, Frame::Grid>>,
280 : tmpl::conditional_t<
281 : use_dg_subcell,
282 : evolution::dg::subcell::Tags::ObserverCoordinatesCompute<
283 : volume_dim, Frame::Inertial>,
284 : ::Events::Tags::ObserverCoordinatesCompute<volume_dim,
285 : Frame::Inertial>>,
286 : grmhd::ValenciaDivClean::Tags::QuadrupoleMomentCompute<
287 : DataVector, volume_dim,
288 : ::Events::Tags::ObserverCoordinates<volume_dim, Frame::Inertial>>,
289 : grmhd::ValenciaDivClean::Tags::QuadrupoleMomentDerivativeCompute<
290 : DataVector, volume_dim,
291 : ::Events::Tags::ObserverCoordinates<volume_dim, Frame::Inertial>,
292 : hydro::Tags::SpatialVelocity<DataVector, volume_dim,
293 : Frame::Inertial>>,
294 : hydro::Tags::TransportVelocityCompute<DataVector, volume_dim,
295 : Frame::Inertial>,
296 : grmhd::ValenciaDivClean::Tags::QuadrupoleMomentDerivativeCompute<
297 : DataVector, volume_dim,
298 : ::Events::Tags::ObserverCoordinates<volume_dim, Frame::Inertial>,
299 : hydro::Tags::TransportVelocity<DataVector, volume_dim,
300 : Frame::Inertial>>,
301 : hydro::Tags::InversePlasmaBetaCompute<DataVector>,
302 : hydro::Tags::SpecificEntropyCompute<DataVector>>;
303 0 : using non_tensor_compute_tags = tmpl::list<
304 : tmpl::conditional_t<
305 : use_dg_subcell,
306 : tmpl::list<
307 : evolution::dg::subcell::Tags::ObserverMeshCompute<volume_dim>,
308 : evolution::dg::subcell::Tags::ObserverInverseJacobianCompute<
309 : volume_dim, Frame::ElementLogical, Frame::Inertial>,
310 : evolution::dg::subcell::Tags::
311 : ObserverJacobianAndDetInvJacobianCompute<
312 : volume_dim, Frame::ElementLogical, Frame::Inertial>>,
313 : tmpl::list<::Events::Tags::ObserverMeshCompute<volume_dim>,
314 : ::Events::Tags::ObserverInverseJacobianCompute<
315 : volume_dim, Frame::ElementLogical, Frame::Inertial>,
316 : ::Events::Tags::ObserverJacobianCompute<
317 : volume_dim, Frame::ElementLogical, Frame::Inertial>,
318 : ::Events::Tags::ObserverDetInvJacobianCompute<
319 : Frame::ElementLogical, Frame::Inertial>>>,
320 : analytic_compute, error_compute>;
321 :
322 0 : struct factory_creation
323 : : tt::ConformsTo<Options::protocols::FactoryCreation> {
324 0 : using factory_classes = tmpl::map<
325 : tmpl::pair<DenseTrigger, DenseTriggers::standard_dense_triggers>,
326 : tmpl::pair<DomainCreator<volume_dim>, domain_creators<volume_dim>>,
327 : tmpl::pair<
328 : Event,
329 : tmpl::flatten<tmpl::list<
330 : Events::Completion,
331 : dg::Events::field_observations<volume_dim, observe_fields,
332 : non_tensor_compute_tags>,
333 : Events::time_events<system>,
334 : intrp::Events::InterpolateWithoutInterpComponent<
335 : 3, InterpolationTargetTags, interpolator_source_vars>...,
336 : dg::Events::ChangeFixedLtsRatio<volume_dim>>>>,
337 : tmpl::pair<evolution::BoundaryCorrection,
338 : grmhd::ValenciaDivClean::BoundaryCorrections::
339 : standard_boundary_corrections>,
340 : tmpl::pair<evolution::initial_data::InitialData, initial_data_list>,
341 : tmpl::pair<
342 : grmhd::ValenciaDivClean::BoundaryConditions::BoundaryCondition,
343 : grmhd::ValenciaDivClean::BoundaryConditions::
344 : standard_boundary_conditions>,
345 : tmpl::pair<
346 : grmhd::AnalyticData::InitialMagneticFields::InitialMagneticField,
347 : grmhd::AnalyticData::InitialMagneticFields::
348 : initial_magnetic_fields>,
349 : tmpl::pair<PhaseChange, PhaseControl::factory_creatable_classes>,
350 : tmpl::pair<StepChooser<StepChooserUse::LtsStep>,
351 : StepChoosers::standard_step_choosers<system>>,
352 : tmpl::pair<StepChooser<StepChooserUse::Slab>,
353 : tmpl::push_back<
354 : StepChoosers::standard_slab_choosers<system>,
355 : evolution::dg::StepChoosers::FixedLtsRatio<volume_dim>>>,
356 : tmpl::pair<TimeSequence<double>,
357 : TimeSequences::all_time_sequences<double>>,
358 : tmpl::pair<TimeSequence<std::uint64_t>,
359 : TimeSequences::all_time_sequences<std::uint64_t>>,
360 : tmpl::pair<TimeStepper, TimeSteppers::time_steppers>,
361 : tmpl::pair<Trigger, tmpl::append<Triggers::logical_triggers,
362 : Triggers::time_triggers>>,
363 : tmpl::pair<Filters::Filter<volume_dim,
364 : typename system::variables_tag::tags_list>,
365 : Filters::all_filters<
366 : volume_dim, typename system::variables_tag::tags_list>>>;
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_dg_postprocessors = tmpl::list<
404 : evolution::dg::ApplyLtsDenseBoundaryCorrections<EvolutionMetavars>,
405 : AlwaysReadyPostprocessor<system::primitive_from_conservative<
406 : ordered_list_of_primitive_recovery_schemes>>>;
407 :
408 0 : using events_and_dense_triggers_subcell_postprocessors =
409 : tmpl::list<AlwaysReadyPostprocessor<
410 : grmhd::ValenciaDivClean::subcell::FixConservativesAndComputePrims<
411 : ordered_list_of_primitive_recovery_schemes>>>;
412 :
413 0 : using dg_step_actions = tmpl::flatten<tmpl::list<
414 : Actions::MutateApply<
415 : evolution::dg::BackgroundGrVars<system, EvolutionMetavars>>,
416 : evolution::dg::Actions::ComputeTimeDerivative<
417 : volume_dim, system, AllStepChoosers, use_dg_element_collection>,
418 : evolution::dg::Actions::ApplyBoundaryCorrectionsToTimeDerivative<
419 : volume_dim, use_dg_element_collection>,
420 : Actions::MutateApply<RecordTimeStepperData<system>>,
421 : evolution::Actions::RunEventsAndDenseTriggers<
422 : events_and_dense_triggers_dg_postprocessors>,
423 : Actions::MutateApply<UpdateU<system>>,
424 : evolution::dg::Actions::ApplyLtsBoundaryCorrections<
425 : volume_dim, use_dg_element_collection>,
426 : Actions::MutateApply<ChangeTimeStepperOrder<system>>,
427 : tmpl::conditional_t<
428 : use_dg_subcell,
429 : // Note: The primitive variables are computed as part of the TCI.
430 : evolution::dg::subcell::Actions::TciAndRollback<
431 : grmhd::ValenciaDivClean::subcell::TciOnDgGrid<
432 : tmpl::front<ordered_list_of_primitive_recovery_schemes>>>,
433 : tmpl::list<>>,
434 : Actions::MutateApply<CleanHistory<system>>,
435 : Actions::MutateApply<evolution::dg::CleanMortarHistory<volume_dim>>,
436 : dg::Actions::SpectralFilter<volume_dim,
437 : typename system::variables_tag::tags_list>,
438 : tmpl::conditional_t<
439 : use_dg_subcell,
440 : tmpl::list<>,
441 : tmpl::list<VariableFixing::Actions::FixVariables<
442 : grmhd::ValenciaDivClean::Flattener<
443 : ordered_list_of_primitive_recovery_schemes>>>>,
444 : parameterized_deleptonization,
445 : VariableFixing::Actions::FixVariables<
446 : VariableFixing::FixToAtmosphere<volume_dim>>,
447 : Actions::UpdateConservatives>>;
448 :
449 0 : using dg_subcell_step_actions = tmpl::flatten<tmpl::list<
450 : evolution::dg::subcell::Actions::SelectNumericalMethod,
451 :
452 : Actions::Label<evolution::dg::subcell::Actions::Labels::BeginDg>,
453 : dg_step_actions,
454 : Actions::Goto<evolution::dg::subcell::Actions::Labels::EndOfSolvers>,
455 :
456 : Actions::Label<evolution::dg::subcell::Actions::Labels::BeginSubcell>,
457 : // This is just to adjust for FixedLtsRatio, so we
458 : // can pass an empty list of StepChoosers.
459 : Actions::MutateApply<ChangeStepSize<tmpl::list<>>>,
460 : Actions::MutateApply<evolution::dg::subcell::BackgroundGrVars<
461 : system, EvolutionMetavars, false>>,
462 : Actions::MutateApply<evolution::dg::subcell::fd::CellCenteredFlux<
463 : system, grmhd::ValenciaDivClean::ComputeFluxes, volume_dim, false>>,
464 : evolution::dg::subcell::Actions::SendDataForReconstruction<
465 : volume_dim, grmhd::ValenciaDivClean::subcell::PrimitiveGhostVariables,
466 : use_dg_element_collection>,
467 : evolution::dg::subcell::Actions::ReceiveAndSendDataForReconstruction<
468 : volume_dim, grmhd::ValenciaDivClean::subcell::PrimitiveGhostVariables,
469 : use_dg_element_collection>,
470 : evolution::dg::subcell::Actions::ReceiveDataForReconstruction<volume_dim>,
471 : Actions::Label<
472 : evolution::dg::subcell::Actions::Labels::BeginSubcellAfterDgRollback>,
473 : Actions::MutateApply<evolution::dg::subcell::BackgroundGrVars<
474 : system, EvolutionMetavars, true>>,
475 : Actions::MutateApply<grmhd::ValenciaDivClean::subcell::SwapGrTags>,
476 : Actions::MutateApply<grmhd::ValenciaDivClean::subcell::PrimsAfterRollback<
477 : ordered_list_of_primitive_recovery_schemes>>,
478 : Actions::MutateApply<evolution::dg::subcell::fd::CellCenteredFlux<
479 : system, grmhd::ValenciaDivClean::ComputeFluxes, volume_dim, true>>,
480 : evolution::dg::subcell::fd::Actions::TakeTimeStep<
481 : grmhd::ValenciaDivClean::subcell::TimeDerivative>,
482 : Actions::MutateApply<RecordTimeStepperData<system>>,
483 : evolution::Actions::RunEventsAndDenseTriggers<
484 : events_and_dense_triggers_subcell_postprocessors>,
485 : Actions::MutateApply<UpdateU<system>>,
486 : Actions::MutateApply<CleanHistory<system>>,
487 : Actions::MutateApply<evolution::dg::CleanMortarHistory<volume_dim>>,
488 : Actions::MutateApply<
489 : grmhd::ValenciaDivClean::subcell::FixConservativesAndComputePrims<
490 : ordered_list_of_primitive_recovery_schemes>>,
491 : evolution::dg::subcell::Actions::TciAndSwitchToDg<
492 : grmhd::ValenciaDivClean::subcell::TciOnFdGrid>,
493 : Actions::MutateApply<grmhd::ValenciaDivClean::subcell::SwapGrTags>,
494 : Actions::MutateApply<
495 : grmhd::ValenciaDivClean::subcell::ResizeAndComputePrims<
496 : ordered_list_of_primitive_recovery_schemes>>,
497 : parameterized_deleptonization,
498 : VariableFixing::Actions::FixVariables<
499 : VariableFixing::FixToAtmosphere<volume_dim>>,
500 : Actions::UpdateConservatives,
501 :
502 : Actions::Label<evolution::dg::subcell::Actions::Labels::EndOfSolvers>>>;
503 :
504 0 : using step_actions =
505 : tmpl::conditional_t<use_dg_subcell, dg_subcell_step_actions,
506 : dg_step_actions>;
507 :
508 0 : using dg_registration_list =
509 : tmpl::list<observers::Actions::RegisterEventsWithObservers>;
510 :
511 0 : using equal_rate_regions = tmpl::flatten<
512 : tmpl::list<evolution::dg::NonconformingEqualRateRegions<volume_dim>,
513 : tmpl::conditional_t<
514 : use_dg_subcell,
515 : evolution::dg::subcell::SubcellEqualRateRegion<volume_dim>,
516 : tmpl::list<>>>>;
517 :
518 0 : using initialization_actions = tmpl::flatten<tmpl::list<
519 : Initialization::Actions::InitializeItems<
520 : Initialization::TimeStepping<EvolutionMetavars, TimeStepper, false,
521 : true>,
522 : evolution::dg::Initialization::Domain<EvolutionMetavars>,
523 : evolution::dg::subcell::GhostZoneInverseJacobian<
524 : volume_dim, grmhd::ValenciaDivClean::fd::Tags::Reconstructor>>,
525 : Initialization::Actions::AddSimpleTags<
526 : evolution::dg::BackgroundGrVars<system, EvolutionMetavars>>,
527 : Initialization::Actions::ConservativeSystem<system>,
528 : Initialization::Actions::InitializeItems<
529 : Initialization::TimeStepperHistory<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 : ::evolution::dg::Initialization::Mortars<volume_dim>,
576 : evolution::dg::Initialization::Actions::SetupEqualRateRegions<
577 : EvolutionMetavars, volume_dim, equal_rate_regions>,
578 : evolution::Actions::InitializeRunEventsAndDenseTriggers,
579 : Initialization::Actions::InitializeItems<
580 : evolution::dg::Initialization::SpectralFilters<
581 : volume_dim, typename system::variables_tag::tags_list>>,
582 : intrp::Actions::ElementInitInterpPoints<volume_dim,
583 : interpolation_target_tags>,
584 : Parallel::Actions::TerminatePhase>>;
585 :
586 0 : using dg_element_array_component = DgElementArray<
587 : EvolutionMetavars,
588 : tmpl::list<Parallel::PhaseActions<Parallel::Phase::Initialization,
589 : initialization_actions>,
590 :
591 : Parallel::PhaseActions<
592 : Parallel::Phase::InitializeTimeStepperHistory,
593 : SelfStart::self_start_procedure<step_actions, system>>,
594 :
595 : Parallel::PhaseActions<
596 : Parallel::Phase::Register,
597 : tmpl::push_back<dg_registration_list,
598 : Parallel::Actions::TerminatePhase>>,
599 :
600 : Parallel::PhaseActions<
601 : Parallel::Phase::Restart,
602 : tmpl::push_back<dg_registration_list,
603 : Parallel::Actions::TerminatePhase>>,
604 :
605 : Parallel::PhaseActions<
606 : Parallel::Phase::WriteCheckpoint,
607 : tmpl::list<evolution::Actions::RunEventsAndTriggers<
608 : Triggers::WhenToCheck::AtCheckpoints>,
609 : Parallel::Actions::TerminatePhase>>,
610 :
611 : Parallel::PhaseActions<
612 : Parallel::Phase::Evolve,
613 : tmpl::flatten<tmpl::list<
614 : evolution::Actions::RunEventsAndTriggers<
615 : Triggers::WhenToCheck::AtSteps>,
616 : evolution::Actions::RunEventsAndTriggers<
617 : Triggers::WhenToCheck::AtSlabs>,
618 : Actions::ChangeSlabSize,
619 : evolution::dg::Actions::ChangeFixedLtsRatio,
620 : step_actions, Actions::MutateApply<AdvanceTime<>>,
621 : PhaseControl::Actions::ExecutePhaseChange>>>,
622 : Parallel::PhaseActions<
623 : Parallel::Phase::PostFailureCleanup,
624 : tmpl::list<Actions::RunEventsOnFailure<Tags::Time>,
625 : Parallel::Actions::TerminatePhase>>>>;
626 :
627 0 : struct registration
628 : : tt::ConformsTo<Parallel::protocols::RegistrationMetavariables> {
629 0 : using element_registrars =
630 : tmpl::map<tmpl::pair<dg_element_array_component, dg_registration_list>>;
631 : };
632 :
633 0 : using component_list = tmpl::list<
634 : observers::Observer<EvolutionMetavars>,
635 : observers::ObserverWriter<EvolutionMetavars>,
636 : intrp::InterpolationTarget<EvolutionMetavars, InterpolationTargetTags>...,
637 : dg_element_array_component>;
638 :
639 0 : using const_global_cache_tags = tmpl::push_back<
640 : tmpl::conditional_t<
641 : use_dg_subcell,
642 : tmpl::list<
643 : grmhd::ValenciaDivClean::fd::Tags::Reconstructor,
644 : ::Tags::VariableFixer<grmhd::ValenciaDivClean::FixConservatives>,
645 : grmhd::ValenciaDivClean::subcell::Tags::TciOptions>,
646 : tmpl::list<>>,
647 : grmhd::ValenciaDivClean::Tags::PrimitiveFromConservativeOptions,
648 : equation_of_state_tag, initial_data_tag,
649 : grmhd::ValenciaDivClean::Tags::ConstraintDampingParameter>;
650 :
651 0 : static constexpr Options::String help{
652 : "Evolve the Valencia formulation of the GRMHD system with divergence "
653 : "cleaning.\n\n"};
654 :
655 0 : static constexpr std::array<Parallel::Phase, 5> default_phase_order{
656 : {Parallel::Phase::Initialization,
657 : Parallel::Phase::InitializeTimeStepperHistory, Parallel::Phase::Register,
658 : Parallel::Phase::Evolve, Parallel::Phase::Exit}};
659 :
660 : // NOLINTNEXTLINE(google-runtime-references)
661 0 : void pup(PUP::er& /*p*/) {}
662 : };
663 :
664 0 : struct CenterOfStar : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
665 0 : struct MaxOfScalar : db::SimpleTag {
666 0 : using type = double;
667 : };
668 :
669 : template <typename TagOfScalar>
670 0 : struct MaxOfScalarCompute : db::ComputeTag, MaxOfScalar {
671 0 : using base = MaxOfScalar;
672 0 : using return_type = double;
673 0 : static void function(const gsl::not_null<double*> max_of_scalar,
674 : const Scalar<DataVector>& scalar) {
675 : *max_of_scalar = max(get(scalar));
676 : };
677 0 : using argument_tags = tmpl::list<TagOfScalar>;
678 : };
679 :
680 0 : using temporal_id = ::Tags::Time;
681 0 : using tags_to_observe =
682 : tmpl::list<MaxOfScalarCompute<hydro::Tags::RestMassDensity<DataVector>>>;
683 0 : using vars_to_interpolate_to_target =
684 : tmpl::list<hydro::Tags::RestMassDensity<DataVector>>;
685 0 : using post_interpolation_callbacks =
686 : tmpl::list<intrp::callbacks::ObserveTimeSeriesOnSurface<tags_to_observe,
687 : CenterOfStar>>;
688 0 : using compute_target_points =
689 : intrp::TargetPoints::SpecifiedPoints<CenterOfStar, 3>;
690 0 : using compute_items_on_target = tags_to_observe;
691 :
692 : template <typename Metavariables>
693 0 : using interpolating_component =
694 : typename Metavariables::dg_element_array_component;
695 : };
696 :
697 0 : struct KerrHorizon : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
698 0 : using temporal_id = ::Tags::Time;
699 0 : using tags_to_observe = tmpl::list<ylm::Tags::EuclideanSurfaceIntegralVector<
700 : hydro::Tags::MassFlux<DataVector, 3>, ::Frame::Inertial>>;
701 0 : using vars_to_interpolate_to_target =
702 : tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
703 : hydro::Tags::SpatialVelocity<DataVector, 3>,
704 : hydro::Tags::LorentzFactor<DataVector>,
705 : gr::Tags::Lapse<DataVector>, gr::Tags::Shift<DataVector, 3>,
706 : gr::Tags::SqrtDetSpatialMetric<DataVector>>;
707 0 : using compute_items_on_target = tmpl::push_front<
708 : tags_to_observe,
709 : ylm::Tags::EuclideanAreaElementCompute<::Frame::Inertial>,
710 : hydro::Tags::MassFluxCompute<DataVector, 3, ::Frame::Inertial>>;
711 0 : using compute_target_points =
712 : intrp::TargetPoints::KerrHorizon<KerrHorizon, ::Frame::Inertial>;
713 0 : using post_interpolation_callbacks =
714 : tmpl::list<intrp::callbacks::ObserveTimeSeriesOnSurface<tags_to_observe,
715 : KerrHorizon>>;
716 :
717 : template <typename Metavariables>
718 0 : using interpolating_component =
719 : typename Metavariables::dg_element_array_component;
720 : };
|