1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
4 #pragma once
6 #include <vector>
8 #include "Domain/Creators/RegisterDerivedWithCharm.hpp"
9 #include "Domain/Tags.hpp"
11 #include "Evolution/Actions/ComputeTimeDerivative.hpp"
12 #include "Evolution/Actions/ComputeVolumeFluxes.hpp"
13 #include "Evolution/Actions/ComputeVolumeSources.hpp"
14 #include "Evolution/Conservative/UpdateConservatives.hpp"
15 #include "Evolution/Conservative/UpdatePrimitives.hpp"
16 #include "Evolution/DiscontinuousGalerkin/DgElementArray.hpp"
18 #include "Evolution/DiscontinuousGalerkin/SlopeLimiters/Minmod.hpp"
19 #include "Evolution/DiscontinuousGalerkin/SlopeLimiters/Tags.hpp"
20 #include "Evolution/Systems/GrMhd/ValenciaDivClean/FixConservatives.hpp"
21 #include "Evolution/Systems/GrMhd/ValenciaDivClean/Initialize.hpp"
22 #include "Evolution/Systems/GrMhd/ValenciaDivClean/NewmanHamlin.hpp"
23 #include "Evolution/Systems/GrMhd/ValenciaDivClean/PalenzuelaEtAl.hpp"
24 #include "Evolution/Systems/GrMhd/ValenciaDivClean/System.hpp"
25 #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
26 #include "Evolution/VariableFixing/Actions.hpp"
27 #include "Evolution/VariableFixing/FixToAtmosphere.hpp"
28 #include "Evolution/VariableFixing/Tags.hpp"
29 #include "NumericalAlgorithms/DiscontinuousGalerkin/Actions/ApplyBoundaryFluxesLocalTimeStepping.hpp"
30 #include "NumericalAlgorithms/DiscontinuousGalerkin/Actions/ApplyFluxes.hpp"
32 #include "NumericalAlgorithms/DiscontinuousGalerkin/NumericalFluxes/LocalLaxFriedrichs.hpp"
33 #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
34 #include "Options/Options.hpp"
35 #include "Parallel/GotoAction.hpp"
36 #include "Parallel/InitializationFunctions.hpp"
38 #include "PointwiseFunctions/AnalyticData/GrMhd/CylindricalBlastWave.hpp"
39 #include "PointwiseFunctions/AnalyticData/Tags.hpp"
40 #include "PointwiseFunctions/Hydro/Tags.hpp"
42 #include "Time/Actions/ChangeStepSize.hpp"
44 #include "Time/Actions/RecordTimeStepperData.hpp"
45 #include "Time/Actions/SelfStartActions.hpp" // IWYU pragma: keep
46 #include "Time/Actions/UpdateU.hpp"
47 #include "Time/StepChoosers/Cfl.hpp"
48 #include "Time/StepChoosers/Constant.hpp"
49 #include "Time/StepChoosers/Increase.hpp"
50 #include "Time/StepChoosers/StepChooser.hpp"
52 #include "Time/Tags.hpp"
53 #include "Time/TimeSteppers/TimeStepper.hpp"
54 #include "Utilities/Functional.hpp"
55 #include "Utilities/TMPL.hpp"
57 /// \cond
58 namespace Frame {
59 struct Inertial;
60 } // namespace Frame
61 namespace Parallel {
62 template <typename Metavariables>
63 class CProxy_ConstGlobalCache;
64 } // namespace Parallel
65 /// \endcond
67 struct EvolutionMetavars {
68  using analytic_data = grmhd::AnalyticData::CylindricalBlastWave;
71  typename analytic_data::equation_of_state_type>;
72  static constexpr size_t thermodynamic_dim = system::thermodynamic_dim;
73  using temporal_id = Tags::TimeId;
74  static constexpr bool local_time_stepping = false;
75  using analytic_data_tag = OptionTags::AnalyticData<analytic_data>;
76  using analytic_variables_tags =
77  typename system::primitive_variables_tag::tags_list;
78  using equation_of_state_tag = hydro::Tags::EquationOfState<
79  typename analytic_data_tag::type::equation_of_state_type>;
80  using normal_dot_numerical_flux = OptionTags::NumericalFluxParams<
82  // GRMHD is only implemented in 3D.
83  // Do not limit the divergence-cleaning field Phi
84  using limiter = OptionTags::SlopeLimiterParams<SlopeLimiters::Minmod<
89  using step_choosers =
90  tmpl::list<StepChoosers::Registrars::Cfl<3, Frame::Inertial>,
93  using ordered_list_of_primitive_recovery_schemes = tmpl::list<
97  using compute_rhs = tmpl::flatten<
102  tmpl::conditional_t<local_time_stepping, tmpl::list<>,
106  using update_variables = tmpl::flatten<tmpl::list<
107  tmpl::conditional_t<local_time_stepping,
109  tmpl::list<>>,
115  struct EvolvePhaseStart;
116  using component_list = tmpl::list<DgElementArray<
118  tmpl::flatten<tmpl::list<
125  VariableFixing::FixToAtmosphere<thermodynamic_dim>>,
126  Actions::UpdateConservatives, Actions::FinalTime,
127  tmpl::conditional_t<local_time_stepping,
129  tmpl::list<>>,
130  compute_rhs, update_variables, Actions::Goto<EvolvePhaseStart>>>>>;
132  using const_global_cache_tag_list =
133  tmpl::list<analytic_data_tag,
134  OptionTags::TypedTimeStepper<tmpl::conditional_t<
135  local_time_stepping, LtsTimeStepper, TimeStepper>>,
138  using domain_creator_tag = OptionTags::DomainCreator<3, Frame::Inertial>;
140  static constexpr OptionString help{
141  "Evolve analytic data using the Valencia formulation of the GRMHD system "
142  "with divergence cleaning.\n\n"
143  "Analytic data: cylindrical blast wave\n"
144  "Slope limiter: Minmod family\n"
145  "Numerical flux: Local Lax-Friedrichs\n"
146  "Variable fixing: FixConservatives and FixToAtmosphere\n"
147  "Local time-stepping: none\n"
148  "Boundary conditions: only periodic are currently supported\n"};
150  enum class Phase { Initialization, Evolve, Exit };
152  static Phase determine_next_phase(
153  const Phase& current_phase,
154  const Parallel::CProxy_ConstGlobalCache<
155  EvolutionMetavars>& /*cache_proxy*/) noexcept {
156  switch (current_phase) {
157  case Phase::Initialization:
158  return Phase::Evolve;
159  case Phase::Evolve:
160  return Phase::Exit;
161  case Phase::Exit:
162  ERROR(
163  "Should never call determine_next_phase with the current phase "
164  "being 'Exit'");
165  default:
166  ERROR(
167  "Unknown type of phase. Did you static_cast<Phase> an integral "
168  "value?");
169  }
170  }
171 };
173 static const std::vector<void (*)()> charm_init_node_funcs{
174  &setup_error_handling, &domain::creators::register_derived_with_charm,
175  &Parallel::register_derived_classes_with_charm<
177  &Parallel::register_derived_classes_with_charm<StepController>,
178  &Parallel::register_derived_classes_with_charm<TimeStepper>};
180 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
Fix the primitive variables to an atmosphere in low density regions.
Definition: FixToAtmosphere.hpp:47
Items for initializing the DataBoxes of parallel components.
Definition: ConservativeSystem.hpp:21
Perform variable updates for one substep.
Definition: UpdateU.hpp:47
T system(T... args)
Compute the primitive variables from the conservative variables.
Definition: UpdatePrimitives.hpp:36
Defines action AdvanceTime.
Receive limiter data from neighbors, then apply limiter.
Definition: LimiterActions.hpp:68
Compute the primitive variables from the conservative variables using the scheme of Newman and Hamlin...
Definition: NewmanHamlin.hpp:50
Labels a location in the action list that can be jumped to using Goto.
Definition: GotoAction.hpp:37
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.
Adjust variables with a variable fixer.
Definition: Actions.hpp:43
Contains functions that forward to Charm++ parallel functions.
Definition: Abort.hpp:13
Base class for TimeSteppers with local time-stepping support, derived from TimeStepper.
Definition: TimeStepper.hpp:105
Compute the conservative variables from the primitive variables.
Definition: UpdateConservatives.hpp:33
Compute the primitive variables from the conservative variables using the scheme of Palenzuela et al...
Definition: PalenzuelaEtAl.hpp:51
Defines action FinalTime.
Compute the local Lax-Friedrichs numerical flux.
Definition: LocalLaxFriedrichs.hpp:43
StepChoosers suggest upper bounds on step sizes. Concrete StepChoosers should define operator() retur...
Definition: StepChooser.hpp:45
The densitized energy density .
Definition: Tags.hpp:50
The constraint damping parameter.
Definition: Tags.hpp:18
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:26
The densitized momentum density .
Definition: Tags.hpp:57
Compute the volume fluxes of the evolved variables.
Definition: ComputeVolumeFluxes.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
The densitized magnetic field .
Definition: Tags.hpp:64
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
Analytic initial data for a cylindrical blast wave.
Definition: CylindricalBlastWave.hpp:57
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 densitized rest-mass density .
Definition: Tags.hpp:44
The global cache tag that retrieves the parameters for the numerical flux from the input file...
Definition: Tags.hpp:59
The analytic data, with the type of the analytic data set as the template parameter.
Definition: Tags.hpp:18
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
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 the volume sources of the evolved variables.
Definition: ComputeVolumeSources.hpp:35
Definition: System.hpp:41
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.
The equation of state.
Definition: Tags.hpp:57