9 #include "Domain/Creators/RegisterDerivedWithCharm.hpp"
10 #include "Domain/Creators/TimeDependence/RegisterDerivedWithCharm.hpp"
11 #include "Domain/FunctionsOfTime/RegisterDerivedWithCharm.hpp"
13 #include "Evolution/Actions/ComputeTimeDerivative.hpp"
14 #include "Evolution/ComputeTags.hpp"
15 #include "Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivative.hpp"
16 #include "Evolution/DiscontinuousGalerkin/Actions/VolumeTermsImpl.tpp"
17 #include "Evolution/DiscontinuousGalerkin/DgElementArray.hpp"
19 #include "Evolution/DiscontinuousGalerkin/Limiters/Minmod.hpp"
20 #include "Evolution/DiscontinuousGalerkin/Limiters/Tags.hpp"
21 #include "Evolution/Initialization/ConservativeSystem.hpp"
22 #include "Evolution/Initialization/DgDomain.hpp"
23 #include "Evolution/Initialization/DiscontinuousGalerkin.hpp"
24 #include "Evolution/Initialization/Evolution.hpp"
25 #include "Evolution/Initialization/GrTagsForHydro.hpp"
26 #include "Evolution/Initialization/Limiter.hpp"
27 #include "Evolution/Initialization/SetVariables.hpp"
28 #include "Evolution/Systems/RadiationTransport/M1Grey/Initialize.hpp"
31 #include "Evolution/Systems/RadiationTransport/M1Grey/System.hpp"
32 #include "Evolution/Systems/RadiationTransport/M1Grey/Tags.hpp"
33 #include "Evolution/Systems/RadiationTransport/Tags.hpp"
34 #include "Evolution/TypeTraits.hpp"
35 #include "IO/Observer/Actions/RegisterEvents.hpp"
36 #include "IO/Observer/Helpers.hpp"
37 #include "IO/Observer/ObserverComponent.hpp"
38 #include "NumericalAlgorithms/DiscontinuousGalerkin/Actions/ImposeBoundaryConditions.hpp"
39 #include "NumericalAlgorithms/DiscontinuousGalerkin/BoundarySchemes/FirstOrder/FirstOrderScheme.hpp"
40 #include "NumericalAlgorithms/DiscontinuousGalerkin/BoundarySchemes/FirstOrder/FirstOrderSchemeLts.hpp"
41 #include "NumericalAlgorithms/DiscontinuousGalerkin/Formulation.hpp"
42 #include "NumericalAlgorithms/DiscontinuousGalerkin/NumericalFluxes/LocalLaxFriedrichs.hpp"
43 #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
45 #include "Parallel/Actions/SetupDataBox.hpp"
46 #include "Parallel/Actions/TerminatePhase.hpp"
47 #include "Parallel/InitializationFunctions.hpp"
48 #include "Parallel/PhaseControl/ExecutePhaseChange.hpp"
49 #include "Parallel/PhaseControl/PhaseControlTags.hpp"
50 #include "Parallel/PhaseControl/VisitAndReturn.hpp"
51 #include "Parallel/PhaseDependentActionList.hpp"
53 #include "ParallelAlgorithms/Actions/MutateApply.hpp"
54 #include "ParallelAlgorithms/DiscontinuousGalerkin/CollectDataForFluxes.hpp"
55 #include "ParallelAlgorithms/DiscontinuousGalerkin/FluxCommunication.hpp"
56 #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeDomain.hpp"
57 #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeInterfaces.hpp"
58 #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeMortars.hpp"
59 #include "ParallelAlgorithms/Events/ObserveErrorNorms.hpp"
60 #include "ParallelAlgorithms/Events/ObserveFields.hpp"
61 #include "ParallelAlgorithms/Events/ObserveTimeStep.hpp"
62 #include "ParallelAlgorithms/EventsAndTriggers/Actions/RunEventsAndTriggers.hpp"
63 #include "ParallelAlgorithms/EventsAndTriggers/Event.hpp"
64 #include "ParallelAlgorithms/EventsAndTriggers/EventsAndTriggers.hpp"
66 #include "ParallelAlgorithms/Initialization/Actions/AddComputeTags.hpp"
67 #include "ParallelAlgorithms/Initialization/Actions/RemoveOptionsAndTerminatePhase.hpp"
68 #include "PointwiseFunctions/AnalyticData/Tags.hpp"
69 #include "PointwiseFunctions/AnalyticSolutions/RadiationTransport/M1Grey/ConstantM1.hpp"
70 #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
71 #include "PointwiseFunctions/Hydro/Tags.hpp"
73 #include "Time/Actions/ChangeSlabSize.hpp"
74 #include "Time/Actions/ChangeStepSize.hpp"
75 #include "Time/Actions/RecordTimeStepperData.hpp"
76 #include "Time/Actions/SelfStartActions.hpp"
78 #include "Time/StepChoosers/Cfl.hpp"
79 #include "Time/StepChoosers/Constant.hpp"
80 #include "Time/StepChoosers/Increase.hpp"
81 #include "Time/StepChoosers/PreventRapidIncrease.hpp"
82 #include "Time/StepChoosers/StepChooser.hpp"
83 #include "Time/StepChoosers/StepToTimes.hpp"
85 #include "Time/Tags.hpp"
86 #include "Time/TimeSequence.hpp"
87 #include "Time/TimeSteppers/TimeStepper.hpp"
88 #include "Time/Triggers/TimeTriggers.hpp"
91 #include "Utilities/Functional.hpp"
99 template <
typename Metavariables>
100 class CProxy_GlobalCache;
105 static constexpr
size_t volume_dim = 3;
107 dg::Formulation::StrongInertial;
114 evolution::is_analytic_data_v<initial_data> xor
115 evolution::is_analytic_solution_v<initial_data>,
116 "initial_data must be either an analytic_data or an analytic_solution");
119 using neutrino_species = tmpl::list<neutrinos::ElectronNeutrinos<1>>;
123 static constexpr
bool local_time_stepping =
false;
124 using initial_data_tag =
125 tmpl::conditional_t<evolution::is_analytic_solution_v<initial_data>,
128 using boundary_condition_tag = initial_data_tag;
129 using analytic_variables_tags =
typename system::variables_tag::tags_list;
130 using normal_dot_numerical_flux =
133 Limiters::Minmod<3, typename system::variables_tag::tags_list>>;
135 using step_choosers_common = tmpl::list<
138 using step_choosers_for_step_only =
139 tmpl::list<StepChoosers::Registrars::PreventRapidIncrease>;
140 using step_choosers_for_slab_only =
141 tmpl::list<StepChoosers::Registrars::StepToTimes>;
142 using step_choosers = tmpl::conditional_t<
144 tmpl::append<step_choosers_common, step_choosers_for_step_only>,
146 using slab_choosers = tmpl::conditional_t<
148 tmpl::append<step_choosers_common, step_choosers_for_slab_only>,
149 tmpl::append<step_choosers_common, step_choosers_for_step_only,
150 step_choosers_for_slab_only>>;
153 tmpl::conditional_t<local_time_stepping, LtsTimeStepper, TimeStepper>>;
154 using boundary_scheme = tmpl::conditional_t<
157 volume_dim,
typename system::variables_tag,
161 volume_dim,
typename system::variables_tag,
166 using events = tmpl::flatten<tmpl::list<
167 tmpl::conditional_t<evolution::is_analytic_solution_v<initial_data>,
173 tmpl::append<
typename system::variables_tag::tags_list,
174 typename system::primitive_variables_tag::tags_list>,
175 tmpl::conditional_t<evolution::is_analytic_solution_v<initial_data>,
176 analytic_variables_tags, tmpl::list<>>>,
181 using observed_reduction_data_tags = observers::collect_reduction_data_tags<
182 typename Event<events>::creatable_classes>;
184 using step_actions = tmpl::flatten<tmpl::list<
187 evolution::is_analytic_solution_v<initial_data>,
196 local_time_stepping, tmpl::list<>,
201 ComputeM1Closure<neutrino_species>>,
203 ComputeM1HydroCoupling<neutrino_species>>>>;
207 InitializeTimeStepperHistory,
208 RegisterWithObserver,
214 static std::string phase_name(Phase phase) noexcept {
215 if (phase == Phase::LoadBalancing) {
216 return "LoadBalancing";
219 "Passed phase that should not be used in input file. Integer "
220 "corresponding to phase is: "
221 <<
static_cast<int>(phase));
224 using phase_changes = tmpl::list<PhaseControl::Registrars::VisitAndReturn<
227 using initialize_phase_change_decision_data =
230 using phase_change_tags_and_combines_list =
233 using dg_registration_list =
234 tmpl::list<observers::Actions::RegisterEventsWithObservers>;
236 using initialization_actions = tmpl::list<
247 ComputeM1Closure<neutrino_species>>,
249 ComputeM1HydroCoupling<neutrino_species>>,
253 typename system::variables_tag,
254 typename system::spacetime_variables_tag,
255 typename system::primitive_variables_tag>,
257 typename system::spacetime_variables_tag,
258 typename system::primitive_variables_tag>,
262 evolution::is_analytic_solution_v<initial_data>,
265 3, initial_data_tag, analytic_variables_tags>>>,
268 StepChoosers::step_chooser_compute_tags<EvolutionMetavars>>,
278 initialization_actions>,
281 Phase, Phase::InitializeTimeStepperHistory,
285 tmpl::list<dg_registration_list,
289 Phase, Phase::Evolve,
293 phase_changes, triggers>>>>>;
295 template <
typename ParallelComponent>
296 struct registration_list {
299 dg_registration_list, tmpl::list<>>;
302 using component_list =
303 tmpl::list<observers::Observer<EvolutionMetavars>,
307 using const_global_cache_tags = tmpl::list<
308 initial_data_tag, normal_dot_numerical_flux, time_stepper_tag,
313 "Evolve the M1Grey system (without coupling to hydro).\n\n"};
315 template <
typename... Tags>
316 static Phase determine_next_phase(
319 const Phase& current_phase,
320 const Parallel::CProxy_GlobalCache<
322 const auto next_phase =
323 PhaseControl::arbitrate_phase_change<phase_changes, triggers>(
324 phase_change_decision_data, current_phase,
325 *(cache_proxy.ckLocalBranch()));
326 if (next_phase.has_value()) {
327 return next_phase.value();
329 switch (current_phase) {
330 case Phase::Initialization:
331 return Phase::InitializeTimeStepperHistory;
332 case Phase::InitializeTimeStepperHistory:
333 return Phase::RegisterWithObserver;
334 case Phase::RegisterWithObserver:
335 return Phase::Evolve;
340 "Should never call determine_next_phase with the current phase "
344 "Unknown type of phase. Did you static_cast<Phase> an integral "
350 static const std::vector<void (*)()> charm_init_node_funcs{
351 &setup_error_handling,
353 &domain::creators::register_derived_with_charm,
354 &domain::creators::time_dependence::register_derived_with_charm,
355 &domain::FunctionsOfTime::register_derived_with_charm,
362 &Parallel::register_derived_classes_with_charm<StepController>,
363 &Parallel::register_derived_classes_with_charm<TimeSequence<double>>,
364 &Parallel::register_derived_classes_with_charm<TimeSequence<std::uint64_t>>,
365 &Parallel::register_derived_classes_with_charm<TimeStepper>,
371 static const std::vector<void (*)()> charm_init_proc_funcs{
Add into the DataBox default constructed items for the collection of tags requested by any of the act...
Definition: SetupDataBox.hpp:102
Initialize the Main chare's phase_change_decision_data for the option-selected PhaseChanges.
Definition: ExecutePhaseChange.hpp:181
Send local data needed for limiting.
Definition: LimiterActions.hpp:156
Definition: RemoveOptionsAndTerminatePhase.hpp:27
tmpl::flatten< tmpl::list< SelfStart::Actions::Initialize< System >, ::Actions::Label< detail::PhaseStart >, SelfStart::Actions::CheckForCompletion< detail::PhaseEnd >, ::Actions::AdvanceTime, SelfStart::Actions::CheckForOrderIncrease, StepActions, ::Actions::Goto< detail::PhaseStart >, ::Actions::Label< detail::PhaseEnd >, SelfStart::Actions::Cleanup, ::Actions::AdvanceTime, Parallel::Actions::TerminatePhase > > self_start_procedure
Definition: SelfStartActions.hpp:455
Allocate items for minmod limiter.
Definition: Limiter.hpp:38
Advance time one substep.
Definition: AdvanceTime.hpp:50
tmpl::list< Tags... > face_compute_tags
Definition: InitializeInterfaces.hpp:41
Terminate the algorithm to proceed to the next phase.
Definition: TerminatePhase.hpp:26
tmpl::list< Tags... > slice_tags_to_face
Definition: InitializeInterfaces.hpp:31
void disable_openblas_multithreading() noexcept
Disable OpenBLAS multithreading since it conflicts with Charm++ parallelism.
The parallel component responsible for managing the DG elements that compose the computational domain...
Definition: DgElementArray.hpp:30
A template for defining a registrar.
Definition: Registration.hpp:42
Allocate variables needed for evolution of conservative systems.
Definition: ConservativeSystem.hpp:72
void enable_floating_point_exceptions()
Check if any triggers are activated, and perform phase changes as needed.
Definition: ExecutePhaseChange.hpp:52
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:37
Definition: ChangeSlabSize.hpp:107
Boundary contributions for a first-order DG scheme with local time-stepping.
Definition: FirstOrderSchemeLts.hpp:80
List of all the actions to be executed in the specified phase.
Definition: PhaseDependentActionList.hpp:16
The nodegroup parallel component that is responsible for writing data to disk.
Definition: ObserverComponent.hpp:51
Initialize items related to the interfaces between Elements and on external boundaries.
Definition: InitializeInterfaces.hpp:120
Computes the time derivative for a DG time step.
Definition: ComputeTimeDerivative.hpp:280
Run the events and triggers.
Definition: RunEventsAndTriggers.hpp:27
Apply the function Mutator::apply to the DataBox.
Definition: MutateApply.hpp:40
Initialize items related to the basic structure of the element.
Definition: DgDomain.hpp:85
Initialize time-stepper items.
Definition: Evolution.hpp:194
tmpl::push_back< tmpl::flatten< tmpl::transform< Registration::registrants< PhaseChangeRegistrars >, detail::get_phase_change_tags_and_combines< tmpl::_1 > >>, TagsAndCombines::UsePhaseChangeArbitration > get_phase_change_tags
Metafunction for determining the merged collection of tags in phase_change_tags_and_combines_lists fr...
Definition: PhaseControlTags.hpp:189
Receive limiter data from neighbors, then apply limiter.
Definition: LimiterActions.hpp:70
Definition: Trigger.hpp:34
Initialize mortars between elements for exchanging fluxes.
Definition: InitializeMortars.hpp:78
Collect data that is needed to compute numerical fluxes and store it on mortars, projecting it if nec...
Definition: CollectDataForFluxes.hpp:68
Definition: ObserveFields.hpp:68
Packages data on external boundaries for calculating numerical flux. Computes contributions on the in...
Definition: ImposeBoundaryConditions.hpp:60
Constant solution to M1 equations in Minkowski spacetime.
Definition: ConstantM1.hpp:39
tmpl::list< Tags... > exterior_compute_tags
Definition: InitializeInterfaces.hpp:46
PhaseChange objects determine the storage types and logic for moving between phases based on runtime ...
Definition: PhaseChange.hpp:140
Sets variables needed for evolution of hyperbolic systems.
Definition: SetVariables.hpp:54
const char *const String
The string used in option structs.
Definition: Options.hpp:32
Boundary contributions for a first-order DG scheme.
Definition: FirstOrderScheme.hpp:66
Definition: IndexType.hpp:36
Perform variable updates for one substep.
Definition: UpdateU.hpp:72
Initialize items related to time, such as the time step.
Definition: Evolution.hpp:80
void register_derived_classes_with_charm() noexcept
Register derived classes of the Base class.
Definition: RegisterDerivedClassesWithCharm.hpp:31
tmpl::list< Registrars::NearTimes, Registrars::SlabCompares, Registrars::Slabs, Registrars::TimeCompares, Registrars::Times > time_triggers
Definition: TimeTriggers.hpp:19
Receive boundary data needed for fluxes from neighbors.
Definition: FluxCommunication.hpp:175
Formulation
The DG formulation to use.
Definition: Formulation.hpp:34
Definition: System.hpp:30
Definition: StepChooser.hpp:98
Functionality for parallelization.
Definition: ElementReceiveInterpPoints.hpp:13
Initialize items related to the discontinuous Galerkin method.
Definition: DiscontinuousGalerkin.hpp:70
Require a pointer to not be a nullptr
Definition: ReadSpecThirdOrderPiecewisePolynomial.hpp:13
tmpl::list< Tags... > slice_tags_to_exterior
Definition: InitializeInterfaces.hpp:36