EvolveBurgers.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 // IWYU pragma: no_include <pup.h>
7 #include <vector>
8 
9 #include "Domain/Creators/RegisterDerivedWithCharm.hpp"
10 #include "Domain/Tags.hpp"
12 #include "Evolution/Actions/ComputeTimeDerivative.hpp" // IWYU pragma: keep
13 #include "Evolution/Actions/ComputeVolumeFluxes.hpp" // IWYU pragma: keep
14 #include "Evolution/DiscontinuousGalerkin/DgElementArray.hpp" // IWYU pragma: keep
15 #include "Evolution/DiscontinuousGalerkin/InitializeElement.hpp"
17 #include "Evolution/DiscontinuousGalerkin/SlopeLimiters/Minmod.hpp"
18 #include "Evolution/DiscontinuousGalerkin/SlopeLimiters/Tags.hpp"
19 #include "Evolution/Systems/Burgers/Equations.hpp" // IWYU pragma: keep // for LocalLaxFriedrichsFlux
20 #include "Evolution/Systems/Burgers/Observe.hpp"
21 #include "Evolution/Systems/Burgers/System.hpp"
22 #include "IO/Observer/Actions.hpp"
23 #include "IO/Observer/Helpers.hpp"
24 #include "IO/Observer/ObserverComponent.hpp"
25 #include "NumericalAlgorithms/DiscontinuousGalerkin/Actions/ApplyBoundaryFluxesLocalTimeStepping.hpp" // IWYU pragma: keep
26 #include "NumericalAlgorithms/DiscontinuousGalerkin/Actions/ApplyFluxes.hpp" // IWYU pragma: keep
28 #include "NumericalAlgorithms/DiscontinuousGalerkin/Actions/ImposeBoundaryConditions.hpp" // IWYU pragma: keep
29 #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
30 #include "Options/Options.hpp"
31 #include "Parallel/GotoAction.hpp" // IWYU pragma: keep
32 #include "Parallel/InitializationFunctions.hpp"
34 #include "PointwiseFunctions/AnalyticSolutions/Burgers/Step.hpp" // IWYU pragma: keep
35 #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
36 #include "Time/Actions/AdvanceTime.hpp" // IWYU pragma: keep
37 #include "Time/Actions/ChangeStepSize.hpp" // IWYU pragma: keep
38 #include "Time/Actions/FinalTime.hpp" // IWYU pragma: keep
39 #include "Time/Actions/RecordTimeStepperData.hpp" // IWYU pragma: keep
40 #include "Time/Actions/SelfStartActions.hpp" // IWYU pragma: keep
41 #include "Time/Actions/UpdateU.hpp" // IWYU pragma: keep
42 #include "Time/StepChoosers/Cfl.hpp" // IWYU pragma: keep
43 #include "Time/StepChoosers/Constant.hpp" // IWYU pragma: keep
44 #include "Time/StepChoosers/Increase.hpp" // IWYU pragma: keep
45 #include "Time/StepChoosers/StepChooser.hpp"
47 #include "Time/Tags.hpp"
48 #include "Time/TimeSteppers/TimeStepper.hpp"
49 #include "Utilities/TMPL.hpp"
50 
51 /// \cond
52 namespace Frame {
53 struct Inertial;
54 } // namespace Frame
55 namespace Parallel {
56 template <typename Metavariables>
57 class CProxy_ConstGlobalCache;
58 } // namespace Parallel
59 /// \endcond
60 
62  using system = Burgers::System;
63  using temporal_id = Tags::TimeId;
64  static constexpr bool local_time_stepping = false;
65  using analytic_solution_tag =
71  SlopeLimiters::Minmod<1, system::variables_tag::tags_list>>;
72  using const_global_cache_tag_list =
73  tmpl::list<analytic_solution_tag,
74  OptionTags::TypedTimeStepper<tmpl::conditional_t<
75  local_time_stepping, LtsTimeStepper, TimeStepper>>>;
77 
78  using observed_reduction_data_tags = observers::collect_reduction_data_tags<
79  tmpl::list<Burgers::Actions::Observe>>;
80 
81  using step_choosers =
82  tmpl::list<StepChoosers::Registrars::Cfl<1, Frame::Inertial>,
85 
86  using compute_rhs = tmpl::flatten<tmpl::list<
92  tmpl::conditional_t<local_time_stepping, tmpl::list<>,
95  using update_variables = tmpl::flatten<tmpl::list<
96  tmpl::conditional_t<local_time_stepping,
98  tmpl::list<>>,
101 
102  struct EvolvePhaseStart;
103  using component_list = tmpl::list<
108  tmpl::flatten<tmpl::list<
112  tmpl::conditional_t<local_time_stepping,
114  tmpl::list<>>,
115  compute_rhs, update_variables,
117 
118  static constexpr OptionString help{
119  "Evolve the Burgers equation.\n\n"
120  "The analytic solution is: Linear\n"
121  "The numerical flux is: LocalLaxFriedrichs\n"};
122 
123  enum class Phase {
125  RegisterWithObserver,
126  Evolve,
127  Exit
128  };
129 
130  static Phase determine_next_phase(
131  const Phase& current_phase,
132  const Parallel::CProxy_ConstGlobalCache<
133  EvolutionMetavars>& /*cache_proxy*/) noexcept {
134  switch (current_phase) {
135  case Phase::Initialization:
136  return Phase::RegisterWithObserver;
137  case Phase::RegisterWithObserver:
138  return Phase::Evolve;
139  case Phase::Evolve:
140  return Phase::Exit;
141  case Phase::Exit:
142  ERROR(
143  "Should never call determine_next_phase with the current phase "
144  "being 'Exit'");
145  default:
146  ERROR(
147  "Unknown type of phase. Did you static_cast<Phase> an integral "
148  "value?");
149  }
150  }
151 };
152 
153 static const std::vector<void (*)()> charm_init_node_funcs{
154  &setup_error_handling, &domain::creators::register_derived_with_charm,
155  &Parallel::register_derived_classes_with_charm<TimeStepper>};
156 static const std::vector<void (*)()> charm_init_proc_funcs{
The global cache tag that retrieves the parameters for the slope limiter from the input file...
Definition: Tags.hpp:15
Terminate after reaching a specified time.
Definition: FinalTime.hpp:42
Functions for serializing factory-created classes.
Definition: DgElementArray.hpp:39
Adjust the step size for local time stepping.
Definition: ChangeStepSize.hpp:45
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:35
Items for initializing the DataBoxes of parallel components.
Definition: ConservativeSystem.hpp:21
Perform variable updates for one substep.
Definition: UpdateU.hpp:47
Definition: System.hpp:23
Defines action AdvanceTime.
Receive limiter data from neighbors, then apply limiter.
Definition: LimiterActions.hpp:68
Labels a location in the action list that can be jumped to using Goto.
Definition: GotoAction.hpp:37
The analytic solution, with the type of the analytic solution set as the template parameter...
Definition: Tags.hpp:22
Defines base class StepController.
Abstract base class for TimeSteppers.
Definition: TimeStepper.hpp:44
Receive boundary data needed for fluxes from neighbors.
Definition: FluxCommunication.hpp:59
Defines classes and functions for making classes creatable from input files.
Defines actions SendDataForFluxes and ReceiveDataForFluxes.
Contains functions that forward to Charm++ parallel functions.
Definition: Abort.hpp:13
The nodegroup parallel component that is responsible for writing data to disk.
Definition: ObserverComponent.hpp:55
Base class for TimeSteppers with local time-stepping support, derived from TimeStepper.
Definition: TimeStepper.hpp:105
Defines action FinalTime.
Initialize a dG element with analytic initial data.
Definition: InitializeElement.hpp:96
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:27
The group parallel component that is responsible for reducing data to be observed.
Definition: ObserverComponent.hpp:25
Compute the volume fluxes of the evolved variables.
Definition: ComputeVolumeFluxes.hpp:40
Temporary action for observing volume and reduction data.
Definition: Observe.hpp:40
Definition: EvolveBurgers.hpp:61
Compute the time derivative of the system variables.
Definition: ComputeTimeDerivative.hpp:54
void enable_floating_point_exceptions()
After a call to this function, the code will terminate with a floating point exception on overflow...
Definition: FloatingPointExceptions.cpp:27
Jumps to a Label.
Definition: GotoAction.hpp:68
A template for defining a registrar.
Definition: Registration.hpp:42
Indicates the Frame that a TensorIndexType is in.
Definition: IndexType.hpp:36
Send local boundary data needed for fluxes to neighbors.
Definition: FluxCommunication.hpp:204
Perform the boundary part of the update of the variables for local time stepping. ...
Definition: ApplyBoundaryFluxesLocalTimeStepping.hpp:55
Functions to enable/disable termination on floating point exceptions.
Records the variables and their time derivatives in the time stepper history.
Definition: RecordTimeStepperData.hpp:48
The global cache tag that retrieves the parameters for the numerical flux from the input file...
Definition: Tags.hpp:59
tmpl::flatten< tmpl::list< SelfStart::Actions::Initialize, ::Actions::Label< detail::PhaseStart >, SelfStart::Actions::CheckForCompletion< detail::PhaseEnd >, ::Actions::AdvanceTime, SelfStart::Actions::CheckForOrderIncrease, ComputeRhs, SelfStart::Actions::StartNextOrderIfReady< detail::PhaseStart >, UpdateVariables, ::Actions::Goto< detail::PhaseStart >, ::Actions::Label< detail::PhaseEnd >, SelfStart::Actions::Cleanup > > self_start_procedure
The list of actions required to self-start an integrator.
Definition: SelfStartActions.hpp:454
Defines action UpdateU.
Wraps the template metaprogramming library used (brigand)
Advance time one substep.
Definition: AdvanceTime.hpp:45
Packages data on external boundaries for calculating numerical flux. Computes contributions on the in...
Definition: ImposeBoundaryConditions.hpp:78
Defines actions ApplyLimiter and SendDataForLimiter.
The TimeStepper, specifying a (base) type. Can be retrieved through OptionTags::TimeStepper.
Definition: Tags.hpp:113
Defines tags related to domain quantities.
Compute element boundary contributions to the temporal step of the variables.
Definition: ApplyFluxes.hpp:67
Send local data needed for limiting.
Definition: LimiterActions.hpp:155
The input file tag for the DomainCreator to use.
Definition: Tags.hpp:44
Tag for TimeId for the algorithm state.
Definition: Tags.hpp:35
Defines tags related to Time quantities.