diff --git a/src/ControlSystem/Actions/LimitTimeStep.hpp b/src/ControlSystem/Actions/LimitTimeStep.hpp index 2e31d4c09e2e..f2917987c7ee 100644 --- a/src/ControlSystem/Actions/LimitTimeStep.hpp +++ b/src/ControlSystem/Actions/LimitTimeStep.hpp @@ -16,7 +16,6 @@ #include "Parallel/GlobalCache.hpp" #include "Time/ChangeSlabSize.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Utilities/ErrorHandling/Assert.hpp" #include "Utilities/ErrorHandling/Error.hpp" #include "Utilities/Gsl.hpp" @@ -26,7 +25,10 @@ namespace Tags { struct TimeStep; struct TimeStepId; +template +struct TimeStepper; } // namespace Tags +class TimeStepper; namespace control_system::Tags { template struct FutureMeasurements; @@ -93,7 +95,7 @@ struct LimitTimeStep { return {Parallel::AlgorithmExecution::Continue, std::nullopt}; } - const auto& time_stepper = db::get<::Tags::TimeStepper<>>(box); + const auto& time_stepper = db::get<::Tags::TimeStepper>(box); if (time_stepper.number_of_substeps() == 1) { // If there are no substeps, there is no reason to limit the // step size so substeps can be evaluated. Single-substep FSAL diff --git a/src/Evolution/Actions/RunEventsAndDenseTriggers.hpp b/src/Evolution/Actions/RunEventsAndDenseTriggers.hpp index a935ac92a852..4ef98611abb3 100644 --- a/src/Evolution/Actions/RunEventsAndDenseTriggers.hpp +++ b/src/Evolution/Actions/RunEventsAndDenseTriggers.hpp @@ -18,7 +18,6 @@ #include "Time/EvolutionOrdering.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" #include "Time/Tags/Time.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Gsl.hpp" #include "Utilities/TMPL.hpp" @@ -41,6 +40,8 @@ class GlobalCache; namespace Tags { struct TimeStep; struct TimeStepId; +template +struct TimeStepper; } // namespace Tags /// \endcond @@ -269,7 +270,8 @@ struct RunEventsAndDenseTriggers { dense_output_succeeded = stepper.dense_update_u(vars, history, next_trigger); }, - make_not_null(&box), db::get<::Tags::TimeStepper<>>(box), + make_not_null(&box), + db::get<::Tags::TimeStepper>(box), db::get(box)); if (not dense_output_succeeded) { // Need to take another time step diff --git a/src/Evolution/DgSubcell/Actions/TciAndSwitchToDg.hpp b/src/Evolution/DgSubcell/Actions/TciAndSwitchToDg.hpp index 41d30c013ac1..fd508004c8e4 100644 --- a/src/Evolution/DgSubcell/Actions/TciAndSwitchToDg.hpp +++ b/src/Evolution/DgSubcell/Actions/TciAndSwitchToDg.hpp @@ -37,7 +37,6 @@ #include "Parallel/AlgorithmExecution.hpp" #include "Time/History.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeStepId.hpp" #include "Utilities/ContainerHelpers.hpp" #include "Utilities/ErrorHandling/Assert.hpp" @@ -51,7 +50,10 @@ class GlobalCache; } // namespace Parallel namespace Tags { struct TimeStepId; +template +struct TimeStepper; } // namespace Tags +class TimeStepper; namespace tuples { template class TaggedTuple; @@ -246,7 +248,7 @@ struct TciAndSwitchToDg { // the entire TCI history is `ActiveGrid::Dg`. // - Substep: the easiest is to restrict switching back to DG to step // boundaries where there is no history. - const auto& time_stepper = db::get<::Tags::TimeStepper<>>(box); + const auto& time_stepper = db::get<::Tags::TimeStepper>(box); const bool is_substep_method = time_stepper.number_of_substeps() != 1; ASSERT(time_stepper.number_of_substeps() != 0, "Don't know how to handle a time stepper with zero substeps. This " diff --git a/src/Evolution/DiscontinuousGalerkin/Actions/ApplyBoundaryCorrections.hpp b/src/Evolution/DiscontinuousGalerkin/Actions/ApplyBoundaryCorrections.hpp index f5a1e161b4ec..09460d5f93a3 100644 --- a/src/Evolution/DiscontinuousGalerkin/Actions/ApplyBoundaryCorrections.hpp +++ b/src/Evolution/DiscontinuousGalerkin/Actions/ApplyBoundaryCorrections.hpp @@ -41,7 +41,6 @@ #include "Parallel/GlobalCache.hpp" #include "Time/BoundaryHistory.hpp" #include "Time/EvolutionOrdering.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/Time.hpp" #include "Time/TimeStepId.hpp" #include "Time/TimeSteppers/LtsTimeStepper.hpp" @@ -59,6 +58,8 @@ namespace Tags { struct Time; struct TimeStep; struct TimeStepId; +template +struct TimeStepper; } // namespace Tags /// \endcond @@ -361,7 +362,8 @@ struct ApplyBoundaryCorrections { domain::Tags::Mesh, Tags::MortarMesh, Tags::MortarSize, ::dg::Tags::Formulation, evolution::dg::Tags::NormalCovectorAndMagnitude, - ::Tags::TimeStepper<>, evolution::Tags::BoundaryCorrection, + ::Tags::TimeStepper, + evolution::Tags::BoundaryCorrection, tmpl::conditional_t, tmpl::conditional_t, domain::Tags::DetInvJacobian, + Initialization::TimeStepping, evolution::dg::Initialization::Domain<1>, Initialization::TimeStepperHistory>, Initialization::Actions::ConservativeSystem, diff --git a/src/Evolution/Executables/CurvedScalarWave/EvolveCurvedScalarWave.hpp b/src/Evolution/Executables/CurvedScalarWave/EvolveCurvedScalarWave.hpp index 8c782ef41a31..6a459cd1e0dc 100644 --- a/src/Evolution/Executables/CurvedScalarWave/EvolveCurvedScalarWave.hpp +++ b/src/Evolution/Executables/CurvedScalarWave/EvolveCurvedScalarWave.hpp @@ -129,7 +129,10 @@ struct EvolutionMetavars { using system = CurvedScalarWave::System; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = true; + using TimeStepperBase = LtsTimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; using analytic_solution_fields = typename system::variables_tag::tags_list; using deriv_compute = ::Tags::DerivCompute< @@ -271,7 +274,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::NonconservativeSystem, diff --git a/src/Evolution/Executables/CurvedScalarWave/EvolveWorldtubeCurvedScalarWave.hpp b/src/Evolution/Executables/CurvedScalarWave/EvolveWorldtubeCurvedScalarWave.hpp index 103332bed308..0f9c4d8ff038 100644 --- a/src/Evolution/Executables/CurvedScalarWave/EvolveWorldtubeCurvedScalarWave.hpp +++ b/src/Evolution/Executables/CurvedScalarWave/EvolveWorldtubeCurvedScalarWave.hpp @@ -141,9 +141,11 @@ struct EvolutionMetavars { using system = CurvedScalarWave::System; using temporal_id = Tags::TimeStepId; + // LTS not implemented yet + using TimeStepperBase = TimeStepper; - // not implemented yet - static constexpr bool local_time_stepping = false; + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; using analytic_solution_fields = typename system::variables_tag::tags_list; using deriv_compute = ::Tags::DerivCompute< @@ -274,7 +276,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::NonconservativeSystem, diff --git a/src/Evolution/Executables/ForceFree/EvolveForceFree.hpp b/src/Evolution/Executables/ForceFree/EvolveForceFree.hpp index 82b8f87db450..359d0816e638 100644 --- a/src/Evolution/Executables/ForceFree/EvolveForceFree.hpp +++ b/src/Evolution/Executables/ForceFree/EvolveForceFree.hpp @@ -100,7 +100,10 @@ struct EvolutionMetavars { static constexpr size_t volume_dim = 3; using system = ForceFree::System; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; using initial_data_list = tmpl::append; @@ -201,7 +204,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::AddSimpleTags< diff --git a/src/Evolution/Executables/GeneralizedHarmonic/EvolveGhAndCharacteristic.hpp b/src/Evolution/Executables/GeneralizedHarmonic/EvolveGhAndCharacteristic.hpp index 5566c703cad4..a72f95d8e857 100644 --- a/src/Evolution/Executables/GeneralizedHarmonic/EvolveGhAndCharacteristic.hpp +++ b/src/Evolution/Executables/GeneralizedHarmonic/EvolveGhAndCharacteristic.hpp @@ -74,6 +74,7 @@ struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<3>, using typename gh_base::initialize_initial_data_dependent_quantities_actions; using cce_boundary_component = Cce::GhWorldtubeBoundary; + using TimeStepperBase = typename gh_base::TimeStepperBase; static constexpr bool local_time_stepping = gh_base::local_time_stepping; template @@ -133,7 +134,7 @@ struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<3>, // addition of initializing the interpolation points (second-to-last action). using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::NonconservativeSystem, diff --git a/src/Evolution/Executables/GeneralizedHarmonic/EvolveGhBinaryBlackHole.hpp b/src/Evolution/Executables/GeneralizedHarmonic/EvolveGhBinaryBlackHole.hpp index ce1460f183b8..097786a3415a 100644 --- a/src/Evolution/Executables/GeneralizedHarmonic/EvolveGhBinaryBlackHole.hpp +++ b/src/Evolution/Executables/GeneralizedHarmonic/EvolveGhBinaryBlackHole.hpp @@ -224,7 +224,10 @@ struct EvolutionMetavars { static constexpr dg::Formulation dg_formulation = dg::Formulation::StrongInertial; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = true; + using TimeStepperBase = LtsTimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; using initialize_initial_data_dependent_quantities_actions = tmpl::list< Actions::MutateApply>, @@ -529,7 +532,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, diff --git a/src/Evolution/Executables/GeneralizedHarmonic/GeneralizedHarmonicBase.hpp b/src/Evolution/Executables/GeneralizedHarmonic/GeneralizedHarmonicBase.hpp index 352d6ce860ea..f8b1a6bc1fdf 100644 --- a/src/Evolution/Executables/GeneralizedHarmonic/GeneralizedHarmonicBase.hpp +++ b/src/Evolution/Executables/GeneralizedHarmonic/GeneralizedHarmonicBase.hpp @@ -295,7 +295,10 @@ template struct GeneralizedHarmonicTemplateBase { static constexpr size_t volume_dim = VolumeDim; using system = gh::System; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; // NOLINTNEXTLINE(google-runtime-references) void pup(PUP::er& /*p*/) {} @@ -364,7 +367,7 @@ struct GeneralizedHarmonicTemplateBase { template using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::NonconservativeSystem, diff --git a/src/Evolution/Executables/GrMhd/GhValenciaDivClean/GhValenciaDivCleanBase.hpp b/src/Evolution/Executables/GrMhd/GhValenciaDivClean/GhValenciaDivCleanBase.hpp index 0dfe029b05f0..fc32d2f74fc3 100644 --- a/src/Evolution/Executables/GrMhd/GhValenciaDivClean/GhValenciaDivCleanBase.hpp +++ b/src/Evolution/Executables/GrMhd/GhValenciaDivClean/GhValenciaDivCleanBase.hpp @@ -260,7 +260,10 @@ struct GhValenciaDivCleanDefaults { using domain_frame = Frame::Inertial; static constexpr bool use_damped_harmonic_rollon = true; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; using system = grmhd::GhValenciaDivClean::System; using analytic_variables_tags = @@ -347,6 +350,7 @@ struct GhValenciaDivCleanTemplateBase< static constexpr bool use_damped_harmonic_rollon = defaults::use_damped_harmonic_rollon; using temporal_id = typename defaults::temporal_id; + using TimeStepperBase = typename defaults::TimeStepperBase; static constexpr bool local_time_stepping = defaults::local_time_stepping; using system = typename defaults::system; using analytic_variables_tags = typename defaults::analytic_variables_tags; @@ -783,7 +787,7 @@ struct GhValenciaDivCleanTemplateBase< using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain<3, use_control_systems>, Initialization::TimeStepperHistory>, Initialization::Actions::ConservativeSystem, diff --git a/src/Evolution/Executables/GrMhd/ValenciaDivClean/EvolveValenciaDivClean.hpp b/src/Evolution/Executables/GrMhd/ValenciaDivClean/EvolveValenciaDivClean.hpp index e7b3388e1982..28404208b074 100644 --- a/src/Evolution/Executables/GrMhd/ValenciaDivClean/EvolveValenciaDivClean.hpp +++ b/src/Evolution/Executables/GrMhd/ValenciaDivClean/EvolveValenciaDivClean.hpp @@ -227,7 +227,11 @@ struct EvolutionMetavars, using initial_data_tag = evolution::initial_data::Tags::InitialData; using system = grmhd::ValenciaDivClean::System; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; + using analytic_variables_tags = typename system::primitive_variables_tag::tags_list; using equation_of_state_tag = hydro::Tags::GrmhdEquationOfState; @@ -506,7 +510,7 @@ struct EvolutionMetavars, using initialization_actions = tmpl::flatten, + Initialization::TimeStepping, evolution::dg::Initialization::Domain<3>, Initialization::TimeStepperHistory>, Initialization::Actions::AddSimpleTags< diff --git a/src/Evolution/Executables/NewtonianEuler/EvolveNewtonianEuler.hpp b/src/Evolution/Executables/NewtonianEuler/EvolveNewtonianEuler.hpp index 16408fe2793e..45a163aae86b 100644 --- a/src/Evolution/Executables/NewtonianEuler/EvolveNewtonianEuler.hpp +++ b/src/Evolution/Executables/NewtonianEuler/EvolveNewtonianEuler.hpp @@ -148,7 +148,10 @@ struct EvolutionMetavars { using system = NewtonianEuler::System; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; using initial_data_tag = tmpl::conditional_t, @@ -254,7 +257,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::flatten, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::ConservativeSystem, diff --git a/src/Evolution/Executables/RadiationTransport/M1Grey/EvolveM1Grey.hpp b/src/Evolution/Executables/RadiationTransport/M1Grey/EvolveM1Grey.hpp index 44662884293f..972d1fc3ca2b 100644 --- a/src/Evolution/Executables/RadiationTransport/M1Grey/EvolveM1Grey.hpp +++ b/src/Evolution/Executables/RadiationTransport/M1Grey/EvolveM1Grey.hpp @@ -117,7 +117,11 @@ struct EvolutionMetavars { using system = RadiationTransport::M1Grey::System; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; + using initial_data_tag = tmpl::conditional_t, Tags::AnalyticSolution, @@ -208,7 +212,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::AddSimpleTags< diff --git a/src/Evolution/Executables/RelativisticEuler/Valencia/EvolveValencia.hpp b/src/Evolution/Executables/RelativisticEuler/Valencia/EvolveValencia.hpp index 85216c9ac4e3..f18807d83251 100644 --- a/src/Evolution/Executables/RelativisticEuler/Valencia/EvolveValencia.hpp +++ b/src/Evolution/Executables/RelativisticEuler/Valencia/EvolveValencia.hpp @@ -122,7 +122,10 @@ struct EvolutionMetavars { using system = RelativisticEuler::Valencia::System; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; using initial_data_tag = tmpl::conditional_t, @@ -227,7 +230,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::AddSimpleTags< diff --git a/src/Evolution/Executables/ScalarAdvection/EvolveScalarAdvection.hpp b/src/Evolution/Executables/ScalarAdvection/EvolveScalarAdvection.hpp index c46b7504fcf8..7a239b4c3096 100644 --- a/src/Evolution/Executables/ScalarAdvection/EvolveScalarAdvection.hpp +++ b/src/Evolution/Executables/ScalarAdvection/EvolveScalarAdvection.hpp @@ -122,7 +122,10 @@ struct EvolutionMetavars { static constexpr size_t volume_dim = Dim; using system = ScalarAdvection::System; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; // The use_dg_subcell flag controls whether to use "standard" limiting (false) // or a DG-FD hybrid scheme (true). @@ -302,7 +305,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::ConservativeSystem, diff --git a/src/Evolution/Executables/ScalarTensor/ScalarTensorBase.hpp b/src/Evolution/Executables/ScalarTensor/ScalarTensorBase.hpp index e31ce9741d85..c83778911446 100644 --- a/src/Evolution/Executables/ScalarTensor/ScalarTensorBase.hpp +++ b/src/Evolution/Executables/ScalarTensor/ScalarTensorBase.hpp @@ -379,7 +379,10 @@ struct ScalarTensorTemplateBase { static constexpr size_t volume_dim = 3_st; using system = ScalarTensor::System; - static constexpr bool local_time_stepping = true; + using TimeStepperBase = LtsTimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; // NOLINTNEXTLINE(google-runtime-references) void pup(PUP::er& /*p*/) {} @@ -459,7 +462,7 @@ struct ScalarTensorTemplateBase { template using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, Initialization::TimeStepperHistory>, Initialization::Actions::NonconservativeSystem, diff --git a/src/Evolution/Executables/ScalarWave/EvolveScalarWave.hpp b/src/Evolution/Executables/ScalarWave/EvolveScalarWave.hpp index ce092d008a2b..1d98d98ba792 100644 --- a/src/Evolution/Executables/ScalarWave/EvolveScalarWave.hpp +++ b/src/Evolution/Executables/ScalarWave/EvolveScalarWave.hpp @@ -129,7 +129,10 @@ struct EvolutionMetavars { static constexpr dg::Formulation dg_formulation = dg::Formulation::StrongInertial; using temporal_id = Tags::TimeStepId; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; using analytic_solution_fields = typename system::variables_tag::tags_list; using deriv_compute = ::Tags::DerivCompute< @@ -274,7 +277,7 @@ struct EvolutionMetavars { using initialization_actions = tmpl::list< Initialization::Actions::InitializeItems< - Initialization::TimeStepping, + Initialization::TimeStepping, evolution::dg::Initialization::Domain, ::amr::Initialization::Initialize, Initialization::TimeStepperHistory>, diff --git a/src/Evolution/Initialization/Evolution.hpp b/src/Evolution/Initialization/Evolution.hpp index 4711106c56f1..de6bfcdea451 100644 --- a/src/Evolution/Initialization/Evolution.hpp +++ b/src/Evolution/Initialization/Evolution.hpp @@ -80,36 +80,36 @@ void set_next_time_step_id(const gsl::not_null next_time_step_id, /// Since the evolution has not started yet, initialize the state /// _before_ the initial time. So `Tags::TimeStepId` is undefined at this point, /// and `Tags::Next` is the initial time. -template +template struct TimeStepping { - using TimeStepperType = - tmpl::conditional_t; - /// Tags for constant items added to the GlobalCache. These items are /// initialized from input file options. using const_global_cache_tags = tmpl::conditional_t< - UsingLts, - tmpl::list<::Tags::TimeStepper, ::Tags::StepChoosers>, - tmpl::list<::Tags::TimeStepper>>; + TimeStepperBase::local_time_stepping, + tmpl::list<::Tags::ConcreteTimeStepper, + ::Tags::StepChoosers>, + tmpl::list<::Tags::ConcreteTimeStepper>>; /// Tags for mutable items added to the GlobalCache. These items are /// initialized from input file options. using mutable_global_cache_tags = tmpl::list<>; /// Tags for items fetched by the DataBox and passed to the apply function - using argument_tags = tmpl::list<::Tags::Time, Tags::InitialTimeDelta, - Tags::InitialSlabSize, - ::Tags::TimeStepper>; + using argument_tags = + tmpl::list<::Tags::Time, Tags::InitialTimeDelta, + Tags::InitialSlabSize, + ::Tags::ConcreteTimeStepper>; /// Tags for simple DataBox items that are initialized from input file options using simple_tags_from_options = tmpl::list<::Tags::Time, Tags::InitialTimeDelta, - Tags::InitialSlabSize>; + Tags::InitialSlabSize>; /// Tags for simple DataBox items that are default initialized. - using default_initialized_simple_tags = tmpl::push_back< - StepChoosers::step_chooser_simple_tags, - ::Tags::TimeStepId, ::Tags::AdaptiveSteppingDiagnostics>; + using default_initialized_simple_tags = + tmpl::push_back, + ::Tags::TimeStepId, ::Tags::AdaptiveSteppingDiagnostics>; /// Tags for items in the DataBox that are mutated by the apply function using return_tags = @@ -123,10 +123,10 @@ struct TimeStepping { /// Tags for immutable DataBox items (compute items or reference items) added /// to the DataBox. - using compute_tags = tmpl::list<>; + using compute_tags = time_stepper_ref_tags; - /// Given the items fetched from a DataBox by the argument_tags when UsingLts - /// is true, mutate the items in the DataBox corresponding to return_tags + /// Given the items fetched from a DataBox by the argument_tags when using + /// LTS, mutate the items in the DataBox corresponding to return_tags static void apply(const gsl::not_null next_time_step_id, const gsl::not_null time_step, const gsl::not_null next_time_step, @@ -143,8 +143,8 @@ struct TimeStepping { *next_time_step = *time_step; } - /// Given the items fetched from a DataBox by the argument_tags, when UsingLts - /// is false, mutate the items in the DataBox corresponding to return_tags + /// Given the items fetched from a DataBox by the argument_tags, when not + /// using LTS, mutate the items in the DataBox corresponding to return_tags static void apply(const gsl::not_null next_time_step_id, const gsl::not_null time_step, const gsl::not_null next_time_step, @@ -288,7 +288,7 @@ struct TimeStepperHistory { using compute_tags = tmpl::list<>; using argument_tags = - tmpl::list<::Tags::TimeStepper<>, domain::Tags::Mesh>; + tmpl::list<::Tags::TimeStepper, domain::Tags::Mesh>; using return_tags = simple_tags; static void apply( diff --git a/src/Evolution/Systems/Cce/Actions/InitializeCharacteristicEvolutionTime.hpp b/src/Evolution/Systems/Cce/Actions/InitializeCharacteristicEvolutionTime.hpp index dcdba3214638..fd3d3a10d15b 100644 --- a/src/Evolution/Systems/Cce/Actions/InitializeCharacteristicEvolutionTime.hpp +++ b/src/Evolution/Systems/Cce/Actions/InitializeCharacteristicEvolutionTime.hpp @@ -26,6 +26,7 @@ #include "Time/Time.hpp" #include "Time/TimeStepId.hpp" #include "Time/TimeSteppers/LtsTimeStepper.hpp" +#include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Rational.hpp" #include "Utilities/Requires.hpp" #include "Utilities/TMPL.hpp" @@ -68,11 +69,11 @@ namespace Actions { template struct InitializeCharacteristicEvolutionTime { - using simple_tags_from_options = tmpl::flatten< - tmpl::list, - Tags::CceEvolutionPrefix<::Tags::TimeStepper>, - Tags::CceEvolutionPrefix<::Tags::StepChoosers>, - ::Initialization::Tags::InitialTimeDelta>>; + using simple_tags_from_options = tmpl::flatten, + Tags::CceEvolutionPrefix<::Tags::ConcreteTimeStepper>, + Tags::CceEvolutionPrefix<::Tags::StepChoosers>, + ::Initialization::Tags::InitialTimeDelta>>; using const_global_cache_tags = tmpl::list<>; @@ -83,7 +84,7 @@ struct InitializeCharacteristicEvolutionTime { ::Tags::AdaptiveSteppingDiagnostics, ::Tags::HistoryEvolvedVariables, ::Tags::HistoryEvolvedVariables>; - using compute_tags = tmpl::list<>; + using compute_tags = time_stepper_ref_tags; template >(box); + const auto& time_stepper = db::get<::Tags::TimeStepper>(box); const size_t starting_order = time_stepper.number_of_past_steps() == 0 ? time_stepper.order() : 1; diff --git a/src/Evolution/Systems/Cce/Actions/InitializeWorldtubeBoundary.hpp b/src/Evolution/Systems/Cce/Actions/InitializeWorldtubeBoundary.hpp index 0ad5198b3912..d1b2d7f47873 100644 --- a/src/Evolution/Systems/Cce/Actions/InitializeWorldtubeBoundary.hpp +++ b/src/Evolution/Systems/Cce/Actions/InitializeWorldtubeBoundary.hpp @@ -67,7 +67,8 @@ struct InitializeWorldtubeBoundaryBase { if (dynamic_cast( &(db::get(box) .get_generator())) != nullptr) { - if(db::get<::Tags::TimeStepper<>>(box).number_of_substeps() != 1) { + if (db::get<::Tags::TimeStepper>(box) + .number_of_substeps() != 1) { ERROR( "Do not use RobinsonTrautman analytic solution with a " "substep-based timestepper. This is to prevent severe slowdowns " @@ -189,19 +190,22 @@ struct InitializeWorldtubeBoundary> : public detail::InitializeWorldtubeBoundaryBase< InitializeWorldtubeBoundary>, tmpl::list>>>, typename Metavariables::cce_boundary_communication_tags> { + using TimeStepperType = + tmpl::conditional_t; using base_type = detail::InitializeWorldtubeBoundaryBase< InitializeWorldtubeBoundary>, tmpl::list>>>, + Tags::CceEvolutionPrefix< + ::Tags::ConcreteTimeStepper>>, typename Metavariables::cce_boundary_communication_tags>; using base_type::apply; using typename base_type::simple_tags; + using compute_tags = time_stepper_ref_tags; using const_global_cache_tags = tmpl::list; using typename base_type::simple_tags_from_options; diff --git a/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/ChangeSlabSize.hpp b/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/ChangeSlabSize.hpp index 0e546c69087d..1bdce76a0412 100644 --- a/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/ChangeSlabSize.hpp +++ b/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/ChangeSlabSize.hpp @@ -14,9 +14,7 @@ #include "Parallel/GlobalCache.hpp" #include "ParallelAlgorithms/EventsAndTriggers/Tags.hpp" #include "Time/Actions/ChangeSlabSize.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeStepId.hpp" -#include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Gsl.hpp" #include "Utilities/TMPL.hpp" @@ -24,7 +22,10 @@ namespace Tags { struct TimeStep; struct TimeStepId; +template +struct TimeStepper; } // namespace Tags +class TimeStepper; /// \endcond namespace CurvedScalarWave::Worldtube::Actions { @@ -73,8 +74,8 @@ struct ChangeSlabSize { "different."); const auto new_step = inbox_slab.duration(); const auto new_next_time_step_id = - db::get<::Tags::TimeStepper<>>(box).next_time_id(inbox_time_step_id, - new_step); + db::get<::Tags::TimeStepper>(box).next_time_id( + inbox_time_step_id, new_step); db::mutate<::Tags::Next<::Tags::TimeStepId>, ::Tags::TimeStep, ::Tags::Next<::Tags::TimeStep>, ::Tags::TimeStepId>( [&new_next_time_step_id, &new_step, &inbox_time_step_id]( diff --git a/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp b/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp index f9b48efb9699..5bf544c147ec 100644 --- a/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp +++ b/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp @@ -10,10 +10,16 @@ #include "DataStructures/VariablesTag.hpp" #include "Evolution/Systems/CurvedScalarWave/Worldtube/Tags.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Gsl.hpp" +/// \cond +namespace Tags { +template +struct TimeStepper; +} // namespace Tags +/// \endcond + namespace CurvedScalarWave::Worldtube::Initialization { /*! * \brief Initializes the time stepper and evolved variables used by the @@ -36,7 +42,7 @@ struct InitializeEvolvedVariables { using simple_tags_from_options = tmpl::list<>; using const_global_cache_tags = tmpl::list<>; using mutable_global_cache_tags = tmpl::list<>; - using argument_tags = tmpl::list<::Tags::TimeStepper<>>; + using argument_tags = tmpl::list<::Tags::TimeStepper>; static void apply( const gsl::not_null>*> evolved_vars, diff --git a/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonChare.hpp b/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonChare.hpp index 901febdd0322..e78aa2d76916 100644 --- a/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonChare.hpp +++ b/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonChare.hpp @@ -59,11 +59,15 @@ struct WorldtubeSingleton { using metavariables = Metavariables; using evolved_vars = ::Tags::Variables< tmpl::list>; - // not currently supported - static constexpr bool local_time_stepping = false; + // LTS not currently supported + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; + using initialization_actions = tmpl::list< ::Initialization::Actions::InitializeItems< - ::Initialization::TimeStepping, + ::Initialization::TimeStepping, Initialization::InitializeEvolvedVariables, Initialization::InitializeSpacetimeTags, Initialization::InitializeElementFacesGridCoordinates>, diff --git a/src/Executables/ExportCoordinates/ExportCoordinates.hpp b/src/Executables/ExportCoordinates/ExportCoordinates.hpp index 868c5384d82f..c1c30b45ae5d 100644 --- a/src/Executables/ExportCoordinates/ExportCoordinates.hpp +++ b/src/Executables/ExportCoordinates/ExportCoordinates.hpp @@ -265,7 +265,11 @@ struct SetMeshType { template struct Metavariables { static constexpr size_t volume_dim = Dim; - static constexpr bool local_time_stepping = false; + using TimeStepperBase = TimeStepper; + + static constexpr bool local_time_stepping = + TimeStepperBase::local_time_stepping; + // A placeholder system for the domain creators struct system {}; @@ -334,7 +338,7 @@ struct Metavariables { Parallel::Phase::Initialization, tmpl::list, + TimeStepperBase>, evolution::dg::Initialization::Domain, ::amr::Initialization::Initialize, Initialization::SetMeshType>, diff --git a/src/Time/Actions/AdvanceTime.hpp b/src/Time/Actions/AdvanceTime.hpp index 35361080a80e..cb87c9e35c8a 100644 --- a/src/Time/Actions/AdvanceTime.hpp +++ b/src/Time/Actions/AdvanceTime.hpp @@ -13,7 +13,6 @@ #include "Parallel/AlgorithmExecution.hpp" #include "Time/AdaptiveSteppingDiagnostics.hpp" #include "Time/Tags/AdaptiveSteppingDiagnostics.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/Time.hpp" #include "Time/TimeStepId.hpp" #include "Time/TimeSteppers/TimeStepper.hpp" @@ -32,6 +31,8 @@ struct Next; struct Time; struct TimeStep; struct TimeStepId; +template +struct TimeStepper; } // namespace Tags // IWYU pragma: no_forward_declare db::DataBox /// \endcond @@ -48,7 +49,7 @@ namespace Actions { /// - DataBox: /// - Tags::Next /// - Tags::Next -/// - Tags::TimeStepper<> +/// - Tags::TimeStepper /// /// DataBox changes: /// - Tags::Next @@ -110,7 +111,7 @@ struct AdvanceTime { time_step->with_slab(next_time_id->step_time().slab()); *time = time_id->substep_time(); }, - make_not_null(&box), db::get>(box), + make_not_null(&box), db::get>(box), is_using_error_control); return {Parallel::AlgorithmExecution::Continue, std::nullopt}; diff --git a/src/Time/Actions/ChangeSlabSize.hpp b/src/Time/Actions/ChangeSlabSize.hpp index bdc54aec3f90..76dded60b741 100644 --- a/src/Time/Actions/ChangeSlabSize.hpp +++ b/src/Time/Actions/ChangeSlabSize.hpp @@ -33,7 +33,6 @@ #include "Time/ChangeSlabSize.hpp" #include "Time/StepChoosers/StepChooser.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeStepId.hpp" #include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Algorithm.hpp" @@ -47,6 +46,8 @@ namespace Tags { struct DataBox; struct TimeStepId; +template +struct TimeStepper; } // namespace Tags /// \endcond @@ -127,7 +128,7 @@ namespace Actions { /// - Tags::HistoryEvolvedVariables /// - Tags::TimeStep /// - Tags::TimeStepId -/// - Tags::TimeStepper<> +/// - Tags::TimeStepper /// /// DataBox changes: /// - Adds: nothing @@ -195,7 +196,8 @@ struct ChangeSlabSize { *alg::min_element(new_slab_size_inbox.begin()->second); new_slab_size_inbox.erase(new_slab_size_inbox.begin()); - const TimeStepper& time_stepper = db::get<::Tags::TimeStepper<>>(box); + const TimeStepper& time_stepper = + db::get<::Tags::TimeStepper>(box); // Sometimes time steppers need to run with a fixed step size. // This is generally at the start of an evolution when the history diff --git a/src/Time/Actions/ChangeStepSize.hpp b/src/Time/Actions/ChangeStepSize.hpp index 19d86c2958f9..285be96cfd28 100644 --- a/src/Time/Actions/ChangeStepSize.hpp +++ b/src/Time/Actions/ChangeStepSize.hpp @@ -15,7 +15,6 @@ #include "Time/ChooseLtsStepSize.hpp" #include "Time/Tags/AdaptiveSteppingDiagnostics.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeSteppers/LtsTimeStepper.hpp" #include "Utilities/Gsl.hpp" #include "Utilities/TMPL.hpp" @@ -38,6 +37,8 @@ struct Next; struct StepChoosers; struct TimeStep; struct TimeStepId; +template +struct TimeStepper; } // namespace Tags // IWYU pragma: no_forward_declare db::DataBox /// \endcond @@ -53,7 +54,8 @@ struct TimeStepId; /// choosers that may not be compatible with all components. template bool change_step_size(const gsl::not_null*> box) { - const LtsTimeStepper& time_stepper = db::get>(*box); + const LtsTimeStepper& time_stepper = + db::get>(*box); const auto& step_choosers = db::get(*box); const auto& next_time_id = db::get>(*box); @@ -144,7 +146,7 @@ namespace Actions { /// - Tags::HistoryEvolvedVariables /// - Tags::TimeStep /// - Tags::TimeStepId -/// - Tags::TimeStepper<> +/// - Tags::TimeStepper /// /// DataBox changes: /// - Adds: nothing diff --git a/src/Time/Actions/SelfStartActions.hpp b/src/Time/Actions/SelfStartActions.hpp index 2b7bd4c18bc6..ddd883d25204 100644 --- a/src/Time/Actions/SelfStartActions.hpp +++ b/src/Time/Actions/SelfStartActions.hpp @@ -21,7 +21,6 @@ #include "Time/Slab.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" #include "Time/Tags/TimeStep.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/Time.hpp" #include "Time/TimeStepId.hpp" #include "Utilities/Gsl.hpp" @@ -38,7 +37,10 @@ class GlobalCache; } // namespace Parallel namespace Tags { struct TimeStepId; +template +struct TimeStepper; } // namespace Tags +class TimeStepper; /// \endcond /// \ingroup TimeGroup @@ -219,7 +221,7 @@ struct Initialize { const auto values_needed = db::get<::Tags::Next<::Tags::TimeStepId>>(box).slab_number() == 0 ? 0 - : db::get<::Tags::TimeStepper<>>(box).order() - 1; + : db::get<::Tags::TimeStepper>(box).order() - 1; TimeDelta self_start_step = initial_step; @@ -453,11 +455,11 @@ struct Cleanup { tmpl::for_each([&box](auto tag_v) { using tag = typename decltype(tag_v)::type; ASSERT(db::get(box).integration_order() == - db::get<::Tags::TimeStepper<>>(box).order(), + db::get<::Tags::TimeStepper>(box).order(), "Volume history order is: " << db::get(box).integration_order() << " but time stepper requires order: " - << db::get<::Tags::TimeStepper<>>(box).order() + << db::get<::Tags::TimeStepper>(box).order() << ". This may indicate that the step size has varied during " "self-start, which should not be permitted."); }); diff --git a/src/Time/Actions/UpdateU.hpp b/src/Time/Actions/UpdateU.hpp index 751621ce40ae..956e4b483c55 100644 --- a/src/Time/Actions/UpdateU.hpp +++ b/src/Time/Actions/UpdateU.hpp @@ -16,7 +16,7 @@ #include "Time/Tags/HistoryEvolvedVariables.hpp" #include "Time/Tags/PreviousStepperError.hpp" #include "Time/Tags/StepperError.hpp" -#include "Time/Tags/TimeStepper.hpp" +#include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Gsl.hpp" #include "Utilities/SetNumberOfGridPoints.hpp" #include "Utilities/TMPL.hpp" @@ -34,6 +34,8 @@ namespace Tags { struct IsUsingTimeSteppingErrorControl; struct StepperErrorUpdated; struct TimeStep; +template +struct TimeStepper; } // namespace Tags /// \endcond @@ -59,7 +61,7 @@ void update_one_variables(const gsl::not_null*> box) { const gsl::not_null previous_error, const gsl::not_null history, - const ::TimeDelta& time_step, const auto& time_stepper) { + const ::TimeDelta& time_step, const TimeStepper& time_stepper) { using std::swap; set_number_of_grid_points(previous_error, *vars); swap(*error, *previous_error); @@ -70,7 +72,7 @@ void update_one_variables(const gsl::not_null*> box) { } }, box, db::get(*box), - db::get>(*box)); + db::get>(*box)); } else { ERROR( "Cannot update the stepper error measure -- " @@ -80,10 +82,11 @@ void update_one_variables(const gsl::not_null*> box) { db::mutate( [](const gsl::not_null vars, const gsl::not_null history, - const ::TimeDelta& time_step, const auto& time_stepper) { + const ::TimeDelta& time_step, const TimeStepper& time_stepper) { time_stepper.update_u(vars, history, time_step); }, - box, db::get(*box), db::get>(*box)); + box, db::get(*box), + db::get>(*box)); } } } // namespace update_u_detail @@ -121,7 +124,7 @@ namespace Actions { /// - system::variables_tag /// - Tags::HistoryEvolvedVariables /// - Tags::TimeStep -/// - Tags::TimeStepper<> +/// - Tags::TimeStepper /// - Tags::IsUsingTimeSteppingErrorControl /// /// DataBox changes: diff --git a/src/Time/ChangeSlabSize.hpp b/src/Time/ChangeSlabSize.hpp index a17b93eac55f..f80f07c6d6c4 100644 --- a/src/Time/ChangeSlabSize.hpp +++ b/src/Time/ChangeSlabSize.hpp @@ -7,7 +7,6 @@ #include "Time/AdaptiveSteppingDiagnostics.hpp" #include "Time/Slab.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/Time.hpp" #include "Time/TimeStepId.hpp" #include "Utilities/ErrorHandling/Assert.hpp" @@ -21,7 +20,10 @@ template struct Next; struct TimeStep; struct TimeStepId; +template +struct TimeStepper; } // namespace Tags +class TimeStepper; /// \endcond /// \ingroup TimeGroup @@ -61,8 +63,8 @@ void change_slab_size(const gsl::not_null*> box, const auto new_time_step = old_time_step.with_slab(new_slab); const auto new_next_time_step_id = - db::get>(*box).next_time_id(new_time_step_id, - new_time_step); + db::get>(*box).next_time_id( + new_time_step_id, new_time_step); db::mutate_apply< tmpl::push_front, diff --git a/src/Time/StepChoosers/Cfl.hpp b/src/Time/StepChoosers/Cfl.hpp index 4ae7ee511b6c..6c77b1e46114 100644 --- a/src/Time/StepChoosers/Cfl.hpp +++ b/src/Time/StepChoosers/Cfl.hpp @@ -12,12 +12,15 @@ #include "Domain/MinimumGridSpacing.hpp" #include "Options/String.hpp" #include "Time/StepChoosers/StepChooser.hpp" // IWYU pragma: keep -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Serialization/CharmPupable.hpp" #include "Utilities/TMPL.hpp" /// \cond +namespace Tags { +template +struct TimeStepper; +} // namespace Tags namespace domain { namespace Tags { template @@ -53,7 +56,7 @@ class Cfl : public StepChooser { using argument_tags = tmpl::list, - ::Tags::TimeStepper<>, + ::Tags::TimeStepper, typename System::compute_largest_characteristic_speed>; using compute_tags = tmpl::list< diff --git a/src/Time/StepChoosers/ElementSizeCfl.hpp b/src/Time/StepChoosers/ElementSizeCfl.hpp index f61947ab46ef..ef78d3263500 100644 --- a/src/Time/StepChoosers/ElementSizeCfl.hpp +++ b/src/Time/StepChoosers/ElementSizeCfl.hpp @@ -12,12 +12,15 @@ #include "Domain/SizeOfElement.hpp" #include "Options/String.hpp" #include "Time/StepChoosers/StepChooser.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Serialization/CharmPupable.hpp" #include "Utilities/TMPL.hpp" /// \cond +namespace Tags { +template +struct TimeStepper; +} // namespace Tags namespace domain { namespace Tags { template @@ -60,7 +63,8 @@ class ElementSizeCfl : public StepChooser { : safety_factor_(safety_factor) {} using argument_tags = - tmpl::list<::Tags::TimeStepper<>, domain::Tags::SizeOfElement, + tmpl::list<::Tags::TimeStepper, + domain::Tags::SizeOfElement, typename System::compute_largest_characteristic_speed>; using compute_tags = tmpl::list, diff --git a/src/Time/StepChoosers/ErrorControl.hpp b/src/Time/StepChoosers/ErrorControl.hpp index 5742d43cbe89..4eee3f6184d0 100644 --- a/src/Time/StepChoosers/ErrorControl.hpp +++ b/src/Time/StepChoosers/ErrorControl.hpp @@ -26,7 +26,6 @@ #include "Time/Tags/PreviousStepperError.hpp" #include "Time/Tags/StepperError.hpp" #include "Time/Tags/StepperErrorUpdated.hpp" -#include "Time/Tags/TimeStepper.hpp" #include "Time/TimeSteppers/TimeStepper.hpp" #include "Utilities/Serialization/CharmPupable.hpp" #include "Utilities/Serialization/PupStlCpp17.hpp" @@ -38,6 +37,8 @@ namespace Tags { template struct IsUsingTimeSteppingErrorControlCompute; struct StepChoosers; +template +struct TimeStepper; } // namespace Tags /// \endcond @@ -193,7 +194,7 @@ class ErrorControl : public StepChooser, tmpl::list<::Tags::HistoryEvolvedVariables, ::Tags::StepperError, ::Tags::PreviousStepperError, - ::Tags::StepperErrorUpdated, ::Tags::TimeStepper<>>; + ::Tags::StepperErrorUpdated, ::Tags::TimeStepper>; std::pair operator()( const TimeSteppers::History& history, diff --git a/src/Time/Tags/TimeStepper.hpp b/src/Time/Tags/TimeStepper.hpp index 19f103a158f1..b68618a0649e 100644 --- a/src/Time/Tags/TimeStepper.hpp +++ b/src/Time/Tags/TimeStepper.hpp @@ -13,18 +13,15 @@ namespace Tags { /// \ingroup DataBoxTagsGroup /// \ingroup TimeGroup -/// \brief Tag for a ::TimeStepper of type `StepperType`. +/// The evolution TimeStepper. The template parameter should be one +/// of the time stepper base classes, such as `TimeStepper` or +/// `LtsTimeStepper`. /// -/// Leaving the template parameter unspecified gives a base tag. -template -struct TimeStepper; - -/// \cond -template <> -struct TimeStepper<> : db::BaseTag {}; - +/// For the contained object to be used, the reference tags listed in +/// `time_stepper_ref_tags` will also need to be added to +/// the DataBox. template -struct TimeStepper : TimeStepper<>, db::SimpleTag { +struct ConcreteTimeStepper : db::SimpleTag { using type = std::unique_ptr; using option_tags = tmpl::list<::OptionTags::TimeStepper>; @@ -34,5 +31,42 @@ struct TimeStepper : TimeStepper<>, db::SimpleTag { return deserialize(serialize(time_stepper).data()); } }; -/// \endcond + +/// \ingroup DataBoxTagsGroup +/// \ingroup TimeGroup +/// Access to a time stepper through the `StepperInterface` interface +/// (such as `TimeStepper` or `LtsTimeStepper`). +/// +/// \details This tag cannot be added directly to the DataBox of +/// GlobalCache because it contains an abstract type, but can only be +/// used for retrieving the time stepper. Instead, the +/// `ConcreteTimeStepper` tag should be added, along with the +/// reference tags given by `time_stepper_ref_tags`. +template +struct TimeStepper : db::SimpleTag { + using type = StepperInterface; +}; + +/// \ingroup DataBoxTagsGroup +/// \ingroup TimeGroup +/// Reference tag to provide access to the time stepper through its +/// provided interfaces, such as `Tags::TimeStepper` and +/// `Tags::TimeStepper`. Usually added through the +/// `time_stepper_ref_tags` alias. +template +struct TimeStepperRef : TimeStepper, db::ReferenceTag { + using base = TimeStepper; + using argument_tags = tmpl::list>; + static const StepperInterface& get(const StepperType& stepper) { + return stepper; + } +}; } // namespace Tags + +/// \ingroup TimeGroup +/// List of Tags::TimeStepperRef specializations needed when adding a +/// Tags::ConcreteTimeStepper. +template +using time_stepper_ref_tags = tmpl::transform< + typename StepperType::provided_time_stepper_interfaces, + tmpl::bind<::Tags::TimeStepperRef, tmpl::_1, tmpl::pin>>; diff --git a/src/Time/TimeSteppers/ImexTimeStepper.hpp b/src/Time/TimeSteppers/ImexTimeStepper.hpp index 615c3b52039a..e548651867a0 100644 --- a/src/Time/TimeSteppers/ImexTimeStepper.hpp +++ b/src/Time/TimeSteppers/ImexTimeStepper.hpp @@ -62,6 +62,10 @@ */ class ImexTimeStepper : public virtual TimeStepper { public: + static constexpr bool imex = true; + using provided_time_stepper_interfaces = + tmpl::list; + WRAPPED_PUPable_abstract(ImexTimeStepper); // NOLINT /// \cond diff --git a/src/Time/TimeSteppers/LtsTimeStepper.hpp b/src/Time/TimeSteppers/LtsTimeStepper.hpp index 3e2e4244ce0c..8f3ad93dcb67 100644 --- a/src/Time/TimeSteppers/LtsTimeStepper.hpp +++ b/src/Time/TimeSteppers/LtsTimeStepper.hpp @@ -39,6 +39,10 @@ class TimeStepId; /// placed in the cpp file. class LtsTimeStepper : public virtual TimeStepper { public: + static constexpr bool local_time_stepping = true; + using provided_time_stepper_interfaces = + tmpl::list; + WRAPPED_PUPable_abstract(LtsTimeStepper); // NOLINT // These two are defined as separate type aliases to keep the diff --git a/src/Time/TimeSteppers/TimeStepper.hpp b/src/Time/TimeSteppers/TimeStepper.hpp index 1330a14e0d24..35a67151034e 100644 --- a/src/Time/TimeSteppers/TimeStepper.hpp +++ b/src/Time/TimeSteppers/TimeStepper.hpp @@ -42,6 +42,10 @@ namespace TimeSteppers {} /// in the cpp file. class TimeStepper : public PUP::able { public: + static constexpr bool local_time_stepping = false; + static constexpr bool imex = false; + using provided_time_stepper_interfaces = tmpl::list; + WRAPPED_PUPable_abstract(TimeStepper); // NOLINT /// \cond diff --git a/tests/Unit/ControlSystem/Actions/Test_LimitTimeStep.cpp b/tests/Unit/ControlSystem/Actions/Test_LimitTimeStep.cpp index 663f52b1ddb6..cf014ae1d27e 100644 --- a/tests/Unit/ControlSystem/Actions/Test_LimitTimeStep.cpp +++ b/tests/Unit/ControlSystem/Actions/Test_LimitTimeStep.cpp @@ -82,10 +82,10 @@ struct Component { using simple_tags = db::AddSimpleTags< control_system::Tags::FutureMeasurements, control_system::Tags::FutureMeasurements, - Tags::TimeStepper, Tags::TimeStepId, + Tags::ConcreteTimeStepper, Tags::TimeStepId, Tags::Next, Tags::TimeStep, Tags::Next, Tags::AdaptiveSteppingDiagnostics, Tags::HistoryEvolvedVariables>; - using compute_tags = db::AddComputeTags<>; + using compute_tags = time_stepper_ref_tags; using phase_dependent_action_list = tmpl::list< Parallel::PhaseActions, evolution::Tags::EventsAndDenseTriggers, domain::Tags::NeighborMesh<1>, domain::Tags::Element<1>>; - - using phase_dependent_action_list = tmpl::list>>>; + using compute_tags = time_stepper_ref_tags; + + using phase_dependent_action_list = tmpl::list< + Parallel::PhaseActions, compute_tags>>>, + Parallel::PhaseActions< + Parallel::Phase::Testing, + tmpl::list>>>; }; template @@ -286,7 +291,8 @@ struct Metavariables { using postprocessors = Postprocessors; using system = System; using component_list = tmpl::list>; - using const_global_cache_tags = tmpl::list>; + using const_global_cache_tags = + tmpl::list>; struct factory_creation : tt::ConformsTo { using factory_classes = @@ -368,9 +374,9 @@ void test(const bool time_runs_forward) { } tmpl::as_pack([&](auto... tags_v) { - ActionTesting::emplace_array_component( + ActionTesting::emplace_array_component_and_initialize( runner, ActionTesting::NodeId{0}, ActionTesting::LocalCoreId{0}, - 0, time_step_id, exact_step_size, start_time, + 0, {}, time_step_id, exact_step_size, start_time, std::optional{}, stored_vars, std::move(history), evolution::EventsAndDenseTriggers( std::move(events_and_dense_triggers)), @@ -510,7 +516,7 @@ void test(const bool time_runs_forward) { time_step_id.step_time().slab().duration() / 4), initial_vars, deriv_vars); }, - make_not_null(&box), db::get>(box)); + make_not_null(&box), db::get>(box)); } if (data_needed) { TestCase::check_dense(&runner, true, {}); diff --git a/tests/Unit/Evolution/DgSubcell/Actions/Test_TciAndSwitchToDg.cpp b/tests/Unit/Evolution/DgSubcell/Actions/Test_TciAndSwitchToDg.cpp index 71b3101f1865..6f37d2f27848 100644 --- a/tests/Unit/Evolution/DgSubcell/Actions/Test_TciAndSwitchToDg.cpp +++ b/tests/Unit/Evolution/DgSubcell/Actions/Test_TciAndSwitchToDg.cpp @@ -90,15 +90,16 @@ struct component { evolution::dg::subcell::Tags::TciGridHistory, Tags::Variables>, Tags::HistoryEvolvedVariables>>, - Tags::TimeStepper, + Tags::ConcreteTimeStepper, evolution::dg::subcell::Tags::NeighborTciDecisions, domain::Tags::Element, evolution::dg::subcell::Tags::CellCenteredFlux< typename metavariables::system::flux_variables, Dim>>; + using compute_tags = time_stepper_ref_tags; using phase_dependent_action_list = tmpl::list, + tmpl::list, evolution::dg::subcell::Actions::TciAndSwitchToDg< typename Metavariables::TciOnSubcellGrid>>>>; }; diff --git a/tests/Unit/Evolution/DiscontinuousGalerkin/Actions/Test_ApplyBoundaryCorrections.cpp b/tests/Unit/Evolution/DiscontinuousGalerkin/Actions/Test_ApplyBoundaryCorrections.cpp index 0cbf7395efd1..3c97221494ba 100644 --- a/tests/Unit/Evolution/DiscontinuousGalerkin/Actions/Test_ApplyBoundaryCorrections.cpp +++ b/tests/Unit/Evolution/DiscontinuousGalerkin/Actions/Test_ApplyBoundaryCorrections.cpp @@ -398,7 +398,7 @@ struct component { using simple_tags = tmpl::list< ::Tags::TimeStepId, ::Tags::Next<::Tags::TimeStepId>, ::Tags::TimeStep, - Tags::TimeStepper, + Tags::ConcreteTimeStepper, db::add_tag_prefix<::Tags::dt, typename Metavariables::system::variables_tag>, typename Metavariables::system::variables_tag, @@ -409,7 +409,8 @@ struct component { Frame::ElementLogical, Frame::Inertial>, evolution::dg::Tags::Quadrature, domain::Tags::NeighborMesh>; - using compute_tags = tmpl::list< + using compute_tags = tmpl::push_back< + time_stepper_ref_tags, domain::Tags::JacobianCompute, domain::Tags::DetInvJacobianCompute< diff --git a/tests/Unit/Evolution/Initialization/Test_Evolution.cpp b/tests/Unit/Evolution/Initialization/Test_Evolution.cpp index ca9a489397b7..d5945b20d49b 100644 --- a/tests/Unit/Evolution/Initialization/Test_Evolution.cpp +++ b/tests/Unit/Evolution/Initialization/Test_Evolution.cpp @@ -54,7 +54,7 @@ struct TestMetavariables { }; using component_list = tmpl::list<>; using const_global_cache_tags = - tmpl::list<::Tags::TimeStepper>; + tmpl::list<::Tags::ConcreteTimeStepper>; }; void test_gts() { @@ -72,7 +72,7 @@ void test_gts() { const TimeDelta expected_time_step = time.slab().duration(); const TimeDelta expected_next_time_step = expected_time_step; - tuples::TaggedTuple<::Tags::TimeStepper> + tuples::TaggedTuple<::Tags::ConcreteTimeStepper> const_global_cache_items(std::move(time_stepper)); Parallel::GlobalCache> global_cache( @@ -84,13 +84,13 @@ void test_gts() { Initialization::Tags::InitialSlabSize, ::Tags::Next<::Tags::TimeStepId>, ::Tags::TimeStep, ::Tags::Next<::Tags::TimeStep>>, - tmpl::list< - Parallel::Tags::FromGlobalCache<::Tags::TimeStepper>>>( + tmpl::list>>>( &global_cache, initial_time, initial_dt, initial_slab_size, TimeStepId{}, TimeDelta{}, TimeDelta{}); - db::mutate_apply< - Initialization::TimeStepping, false>>( + db::mutate_apply, + TimeStepper>>( make_not_null(&box)); CHECK(db::get<::Tags::Next<::Tags::TimeStepId>>(box) == @@ -116,7 +116,7 @@ void test_lts() { const TimeDelta expected_time_step = choose_lts_step_size(time, initial_dt); const TimeDelta expected_next_time_step = expected_time_step; - tuples::TaggedTuple<::Tags::TimeStepper> + tuples::TaggedTuple<::Tags::ConcreteTimeStepper> const_global_cache_items(std::move(lts_time_stepper)); Parallel::GlobalCache> global_cache( @@ -130,13 +130,12 @@ void test_lts() { ::Tags::Next<::Tags::TimeStepId>, ::Tags::TimeStep, ::Tags::Next<::Tags::TimeStep>>, tmpl::list>>>( + ::Tags::ConcreteTimeStepper>>>( &global_cache, initial_time, initial_dt, initial_slab_size, TimeStepId{}, TimeDelta{}, TimeDelta{}); - db::mutate_apply< - Initialization::TimeStepping, true>>( - make_not_null(&box)); + db::mutate_apply, LtsTimeStepper>>(make_not_null(&box)); CHECK(db::get<::Tags::Next<::Tags::TimeStepId>>(box) == expected_next_time_step_id); diff --git a/tests/Unit/Evolution/Systems/Cce/Test_OptionTags.cpp b/tests/Unit/Evolution/Systems/Cce/Test_OptionTags.cpp index a8701e042f6d..878c7e300127 100644 --- a/tests/Unit/Evolution/Systems/Cce/Test_OptionTags.cpp +++ b/tests/Unit/Evolution/Systems/Cce/Test_OptionTags.cpp @@ -81,8 +81,8 @@ SPECTRE_TEST_CASE("Unit.Evolution.Systems.Cce.OptionTags", "[Unit][Cce]") { TestHelpers::db::test_simple_tag( "OutputNoninertialNews"); TestHelpers::db::test_simple_tag< - Cce::Tags::CceEvolutionPrefix<::Tags::TimeStepper>>( - "TimeStepper"); + Cce::Tags::CceEvolutionPrefix<::Tags::ConcreteTimeStepper>>( + "ConcreteTimeStepper"); CHECK( TestHelpers::test_option_tag( diff --git a/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_ChangeSlabSize.cpp b/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_ChangeSlabSize.cpp index 8b3758eb0887..d2f249934cf7 100644 --- a/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_ChangeSlabSize.cpp +++ b/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_ChangeSlabSize.cpp @@ -54,8 +54,8 @@ struct MockWorldtubeSingleton { db::AddSimpleTags< ::Tags::TimeStepId, ::Tags::Next<::Tags::TimeStepId>, ::Tags::TimeStep, ::Tags::Next<::Tags::TimeStep>, - ::Tags::TimeStepper>, - db::AddComputeTags<>>>>, + ::Tags::ConcreteTimeStepper>, + time_stepper_ref_tags>>>, Parallel::PhaseActions>>; using component_being_mocked = WorldtubeSingleton; diff --git a/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_InitializeEvolvedVariables.cpp b/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_InitializeEvolvedVariables.cpp index a2d5c3affe8f..d1884faccfaa 100644 --- a/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_InitializeEvolvedVariables.cpp +++ b/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_InitializeEvolvedVariables.cpp @@ -24,10 +24,12 @@ SPECTRE_TEST_CASE( auto box = db::create< db::AddSimpleTags, - ::Tags::TimeStepper>>( + ::Tags::ConcreteTimeStepper>, + time_stepper_ref_tags>( variables_tag::type{}, dt_variables_tag::type{}, TimeSteppers::History{}, - std::make_unique(4)); + static_cast>( + std::make_unique(4))); db::mutate_apply( make_not_null(&box)); diff --git a/tests/Unit/Helpers/Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivativeImpl.tpp b/tests/Unit/Helpers/Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivativeImpl.tpp index b6089a648553..4885a5aaf9b6 100644 --- a/tests/Unit/Helpers/Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivativeImpl.tpp +++ b/tests/Unit/Helpers/Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivativeImpl.tpp @@ -915,8 +915,9 @@ struct component { ::Tags::IsUsingTimeSteppingErrorControl, tmpl::conditional_t< Metavariables::local_time_stepping, - tmpl::list<::Tags::StepChoosers, ::Tags::TimeStepper>, - tmpl::list<::Tags::TimeStepper>>>>; + tmpl::list<::Tags::StepChoosers, + ::Tags::ConcreteTimeStepper>, + tmpl::list<::Tags::ConcreteTimeStepper>>>>; using common_compute_tags = tmpl::list< domain::Tags::JacobianCompute, @@ -946,8 +947,9 @@ struct component { boundary_directions_interior, domain::Tags::InterfaceMesh>, domain::Tags::Slice, - domain::Tags::Slice>>; + domain::Tags::Slice>, + time_stepper_ref_tags>>; using compute_tags = tmpl::conditional_t< Metavariables::system::has_primitive_and_conservative_vars, tmpl::push_front>; + using const_global_cache_tags = + tmpl::list>; using simple_tags = db::AddSimpleTags, Tags::TimeStep, Tags::Next, Tags::Time, Tags::IsUsingTimeSteppingErrorControl, Tags::AdaptiveSteppingDiagnostics>; + using compute_tags = time_stepper_ref_tags; - using phase_dependent_action_list = - tmpl::list>>, - Parallel::PhaseActions>>; + using phase_dependent_action_list = tmpl::list< + Parallel::PhaseActions>>, + Parallel::PhaseActions>>; }; struct Metavariables { diff --git a/tests/Unit/Time/Actions/Test_ChangeSlabSize.cpp b/tests/Unit/Time/Actions/Test_ChangeSlabSize.cpp index 486c9d7d5063..78852b6c01a1 100644 --- a/tests/Unit/Time/Actions/Test_ChangeSlabSize.cpp +++ b/tests/Unit/Time/Actions/Test_ChangeSlabSize.cpp @@ -60,18 +60,20 @@ struct Component { using chare_type = ActionTesting::MockArrayChare; using array_index = int; - using const_global_cache_tags = tmpl::list>; + using const_global_cache_tags = + tmpl::list>; using simple_tags = tmpl::list, Tags::TimeStep, Tags::Next, Tags::HistoryEvolvedVariables, Tags::AdaptiveSteppingDiagnostics>; - using phase_dependent_action_list = - tmpl::list>>, - Parallel::PhaseActions>>; + using compute_tags = time_stepper_ref_tags; + using phase_dependent_action_list = tmpl::list< + Parallel::PhaseActions>>, + Parallel::PhaseActions>>; }; } // namespace @@ -123,7 +125,7 @@ SPECTRE_TEST_CASE("Unit.Time.Actions.ChangeSlabSize", "[Unit][Time][Actions]") { *next_id = stepper.next_time_id(*id, *step); *diags = AdaptiveSteppingDiagnostics{1, 2, 3, 4, 5}; }, - make_not_null(&box), db::get>(box)); + make_not_null(&box), db::get>(box)); using ExpectedMessages = ChangeSlabSize_detail::NumberOfExpectedMessagesInbox; @@ -135,7 +137,7 @@ SPECTRE_TEST_CASE("Unit.Time.Actions.ChangeSlabSize", "[Unit][Time][Actions]") { CHECK(db::get(box) == id); CHECK(db::get(box) == get_step(id)); CHECK(db::get>(box) == - db::get>(box).next_time_id( + db::get>(box).next_time_id( db::get(box), db::get(box))); CHECK(db::get(box) == AdaptiveSteppingDiagnostics{1, 2 + changes, 3, 4, 5}); @@ -212,7 +214,7 @@ SPECTRE_TEST_CASE("Unit.Time.Actions.ChangeSlabSize", "[Unit][Time][Actions]") { *next_id = stepper.next_time_id(*id, step); }, make_not_null(&box), db::get(box), - db::get>(box)); + db::get>(box)); const TimeStepId initial_id = db::get(box); get(inboxes)[3].insert(ExpectedMessages::NoData{}); get(inboxes)[4].insert(ExpectedMessages::NoData{}); @@ -245,7 +247,7 @@ SPECTRE_TEST_CASE("Unit.Time.Actions.ChangeSlabSize", "[Unit][Time][Actions]") { } }, make_not_null(&box), db::get(box), - db::get>(box)); + db::get>(box)); const TimeStepId initial_id = db::get(box); get(inboxes)[3].insert(ExpectedMessages::NoData{}); get(inboxes)[4].insert(ExpectedMessages::NoData{}); diff --git a/tests/Unit/Time/Actions/Test_ChangeStepSize.cpp b/tests/Unit/Time/Actions/Test_ChangeStepSize.cpp index 85b20dfe4312..415c5dc94b7e 100644 --- a/tests/Unit/Time/Actions/Test_ChangeStepSize.cpp +++ b/tests/Unit/Time/Actions/Test_ChangeStepSize.cpp @@ -84,17 +84,19 @@ struct Component { using metavariables = Metavariables; using chare_type = ActionTesting::MockArrayChare; using array_index = int; - using const_global_cache_tags = tmpl::list>; + using const_global_cache_tags = + tmpl::list>; using simple_tags = tmpl::list, Tags::TimeStep, Tags::Next, ::Tags::StepChoosers, Tags::IsUsingTimeSteppingErrorControl, Tags::AdaptiveSteppingDiagnostics, history_tag, typename System::variables_tag>; + using compute_tags = time_stepper_ref_tags; using phase_dependent_action_list = tmpl::list< - Parallel::PhaseActions< - Parallel::Phase::Initialization, - tmpl::list>>, + Parallel::PhaseActions>>, Parallel::PhaseActions< Parallel::Phase::Testing, tmpl::list>; + using const_global_cache_tags = + tmpl::list>; using simple_tags = tmpl::flatten, Tags::Time, Tags::IsUsingTimeSteppingErrorControl, Tags::AdaptiveSteppingDiagnostics>>; - using compute_tags = db::AddComputeTags<>; + using compute_tags = time_stepper_ref_tags; static constexpr bool has_primitives = Metavariables::has_primitives; diff --git a/tests/Unit/Time/Actions/Test_UpdateU.cpp b/tests/Unit/Time/Actions/Test_UpdateU.cpp index b7376da0f267..a6483b6670f2 100644 --- a/tests/Unit/Time/Actions/Test_UpdateU.cpp +++ b/tests/Unit/Time/Actions/Test_UpdateU.cpp @@ -67,15 +67,16 @@ struct Component { using array_index = int; using const_global_cache_tags = tmpl::list<>; using simple_tags = - tmpl::list, Tags::TimeStep, + tmpl::list, Tags::TimeStep, ::Tags::IsUsingTimeSteppingErrorControl, Var, Tags::HistoryEvolvedVariables, AlternativeVar, Tags::HistoryEvolvedVariables>; + using compute_tags = time_stepper_ref_tags; using phase_dependent_action_list = tmpl::list< - Parallel::PhaseActions< - Parallel::Phase::Initialization, - tmpl::list>>, + Parallel::PhaseActions>>, Parallel::PhaseActions>>>; @@ -101,12 +102,14 @@ void test_integration() { return 2. * t - 2. * (y - t * t); }; - auto box = db::create, Tags::TimeStep, - ::Tags::IsUsingTimeSteppingErrorControl, Var, history_tag, AlternativeVar, - alternative_history_tag>>( - std::make_unique(), time_step, false, 1., - typename history_tag::type{3}, 1., + auto box = db::create< + db::AddSimpleTags, Tags::TimeStep, + ::Tags::IsUsingTimeSteppingErrorControl, Var, + history_tag, AlternativeVar, alternative_history_tag>, + time_stepper_ref_tags>( + static_cast>( + std::make_unique()), + time_step, false, 1., typename history_tag::type{3}, 1., typename alternative_history_tag::type{3}); const std::array substep_times{ @@ -180,13 +183,16 @@ void test_stepper_error() { const Slab slab(1., 3.); const TimeDelta time_step = slab.duration() / 2; - auto box = db::create, Tags::TimeStep, - ::Tags::IsUsingTimeSteppingErrorControl, variables_tag, history_tag, - Tags::StepperError, - Tags::PreviousStepperError, Tags::StepperErrorUpdated>>( - std::make_unique(), time_step, true, 1., - history_tag::type{3}, 1234.5, 1234.5, false); + auto box = db::create< + db::AddSimpleTags, Tags::TimeStep, + ::Tags::IsUsingTimeSteppingErrorControl, variables_tag, + history_tag, Tags::StepperError, + Tags::PreviousStepperError, + Tags::StepperErrorUpdated>, + time_stepper_ref_tags>( + static_cast>( + std::make_unique()), + time_step, true, 1., history_tag::type{3}, 1234.5, 1234.5, false); const std::array substep_offsets{ {0 * slab.duration(), time_step, time_step / 2}}; diff --git a/tests/Unit/Time/StepChoosers/Test_Cfl.cpp b/tests/Unit/Time/StepChoosers/Test_Cfl.cpp index 1ee581cb86f5..47b0bee7eb4e 100644 --- a/tests/Unit/Time/StepChoosers/Test_Cfl.cpp +++ b/tests/Unit/Time/StepChoosers/Test_Cfl.cpp @@ -86,10 +86,11 @@ std::pair get_suggestion(const size_t stepper_order, db::AddSimpleTags< Parallel::Tags::MetavariablesImpl, CharacteristicSpeed, domain::Tags::Coordinates, domain::Tags::Mesh, - Tags::TimeStepper>, - db::AddComputeTags, - typename Metavariables::system:: - compute_largest_characteristic_speed>>( + Tags::ConcreteTimeStepper>, + tmpl::push_back, + domain::Tags::MinimumGridSpacingCompute, + typename Metavariables::system:: + compute_largest_characteristic_speed>>( Metavariables{}, characteristic_speed, tnsr::I{{{coordinates}}}, Mesh(coordinates.size(), Spectral::Basis::Legendre, diff --git a/tests/Unit/Time/StepChoosers/Test_ElementSizeCfl.cpp b/tests/Unit/Time/StepChoosers/Test_ElementSizeCfl.cpp index 9e2a68566267..01ae03cecfd2 100644 --- a/tests/Unit/Time/StepChoosers/Test_ElementSizeCfl.cpp +++ b/tests/Unit/Time/StepChoosers/Test_ElementSizeCfl.cpp @@ -77,14 +77,16 @@ std::pair get_suggestion( ElementMap&& element_map) { auto box = db::create< db::AddSimpleTags>, - CharacteristicSpeed, Tags::TimeStepper, + CharacteristicSpeed, + Tags::ConcreteTimeStepper, domain::Tags::ElementMap, domain::CoordinateMaps::Tags::CoordinateMap< Dim, Frame::Grid, Frame::Inertial>, ::Tags::Time, domain::Tags::FunctionsOfTimeInitialize>, - db::AddComputeTags, - typename Metavariables::system:: - compute_largest_characteristic_speed>>( + tmpl::push_back, + domain::Tags::SizeOfElementCompute, + typename Metavariables::system:: + compute_largest_characteristic_speed>>( Metavariables{}, characteristic_speed, std::unique_ptr{ std::make_unique(2)}, @@ -104,7 +106,7 @@ std::pair get_suggestion( Dim>::system::compute_largest_characteristic_speed>(box); const std::array element_size = db::get>(box); - const auto& time_stepper = get>(box); + const auto& time_stepper = get>(box); const double current_step = std::numeric_limits::infinity(); const std::pair result = diff --git a/tests/Unit/Time/StepChoosers/Test_ErrorControl.cpp b/tests/Unit/Time/StepChoosers/Test_ErrorControl.cpp index aecb3e7452f3..3bf5b6dca664 100644 --- a/tests/Unit/Time/StepChoosers/Test_ErrorControl.cpp +++ b/tests/Unit/Time/StepChoosers/Test_ErrorControl.cpp @@ -108,20 +108,19 @@ std::pair get_suggestion( history.insert(TimeStepId{true, 0, {{0.0, 1.0}, {0, 1}}}, step_values, 0.1 * step_values); history.discard_value(TimeStepId{true, 0, {{0.0, 1.0}, {0, 1}}}); - auto box = - db::create>, - Tags::HistoryEvolvedVariables, - Tags::StepperError, - Tags::PreviousStepperError, - Tags::StepperErrorUpdated, Tags::TimeStepper>, - db::AddComputeTags<>>( - Metavariables{}, history, error, previous_error, - false, - std::unique_ptr{ - std::make_unique(stepper_order)}); + auto box = db::create< + db::AddSimpleTags>, + Tags::HistoryEvolvedVariables, + Tags::StepperError, + Tags::PreviousStepperError, + Tags::StepperErrorUpdated, + Tags::ConcreteTimeStepper>, + time_stepper_ref_tags>( + Metavariables{}, history, error, previous_error, false, + std::unique_ptr{ + std::make_unique(stepper_order)}); - const auto& time_stepper = get>(box); + const auto& time_stepper = get>(box); const std::unique_ptr> error_control_base = std::make_unique(error_control); diff --git a/tests/Unit/Time/Tags/Test_TimeStepper.cpp b/tests/Unit/Time/Tags/Test_TimeStepper.cpp index 2e97c22bee93..c366c2a2f82b 100644 --- a/tests/Unit/Time/Tags/Test_TimeStepper.cpp +++ b/tests/Unit/Time/Tags/Test_TimeStepper.cpp @@ -10,9 +10,34 @@ namespace { struct DummyType {}; + +class FakeTimeStepper { + public: + using provided_time_stepper_interfaces = tmpl::list; +}; + +class MoreSpecificFakeTimeStepper : public FakeTimeStepper { + public: + using provided_time_stepper_interfaces = + tmpl::list; +}; + +static_assert( + std::is_same_v< + time_stepper_ref_tags, + tmpl::list>>); +static_assert(std::is_same_v< + time_stepper_ref_tags, + tmpl::list, + Tags::TimeStepperRef>>); } // namespace SPECTRE_TEST_CASE("Unit.Time.Tags.TimeStepper", "[Unit][Time]") { - TestHelpers::db::test_base_tag>("TimeStepper"); + TestHelpers::db::test_simple_tag>( + "ConcreteTimeStepper"); TestHelpers::db::test_simple_tag>("TimeStepper"); + TestHelpers::db::test_reference_tag< + Tags::TimeStepperRef>("TimeStepper"); } diff --git a/tests/Unit/Time/Test_ChangeSlabSize.cpp b/tests/Unit/Time/Test_ChangeSlabSize.cpp index 4ed45239dda2..2d22614bc7e9 100644 --- a/tests/Unit/Time/Test_ChangeSlabSize.cpp +++ b/tests/Unit/Time/Test_ChangeSlabSize.cpp @@ -48,13 +48,16 @@ SPECTRE_TEST_CASE("Unit.Time.ChangeSlabSize", "[Unit][Time]") { TimeSteppers::History history2{}; history2.insert(initial_id, 1.23, 4.56); - auto box = db::create, Tags::TimeStepId, - Tags::TimeStep, Tags::Next, - Tags::Next, Tags::AdaptiveSteppingDiagnostics, - Tags::HistoryEvolvedVariables, - Tags::HistoryEvolvedVariables>>( - std::make_unique(time_stepper), + auto box = db::create< + db::AddSimpleTags< + Tags::ConcreteTimeStepper, Tags::TimeStepId, + Tags::TimeStep, Tags::Next, + Tags::Next, Tags::AdaptiveSteppingDiagnostics, + Tags::HistoryEvolvedVariables, + Tags::HistoryEvolvedVariables>, + time_stepper_ref_tags>( + static_cast>( + std::make_unique(time_stepper)), initial_id, initial_step, next_id, next_step, diagnostics, std::move(history1), std::move(history2)); @@ -98,13 +101,16 @@ SPECTRE_TEST_CASE("Unit.Time.ChangeSlabSize", "[Unit][Time]") { TimeSteppers::History history2{}; history2.insert(initial_id, 1.23, 4.56); - auto box = db::create, Tags::TimeStepId, - Tags::TimeStep, Tags::Next, - Tags::Next, Tags::AdaptiveSteppingDiagnostics, - Tags::HistoryEvolvedVariables, - Tags::HistoryEvolvedVariables>>( - std::make_unique(time_stepper), + auto box = db::create< + db::AddSimpleTags< + Tags::ConcreteTimeStepper, Tags::TimeStepId, + Tags::TimeStep, Tags::Next, + Tags::Next, Tags::AdaptiveSteppingDiagnostics, + Tags::HistoryEvolvedVariables, + Tags::HistoryEvolvedVariables>, + time_stepper_ref_tags>( + static_cast>( + std::make_unique(time_stepper)), initial_id, initial_step, next_id, next_step, diagnostics, std::move(history1), std::move(history2)); @@ -148,13 +154,16 @@ SPECTRE_TEST_CASE("Unit.Time.ChangeSlabSize", "[Unit][Time]") { TimeSteppers::History history2{}; history2.insert(initial_id, 1.23, 4.56); - auto box = db::create, Tags::TimeStepId, - Tags::TimeStep, Tags::Next, - Tags::Next, Tags::AdaptiveSteppingDiagnostics, - Tags::HistoryEvolvedVariables, - Tags::HistoryEvolvedVariables>>( - std::make_unique(time_stepper), + auto box = db::create< + db::AddSimpleTags< + Tags::ConcreteTimeStepper, Tags::TimeStepId, + Tags::TimeStep, Tags::Next, + Tags::Next, Tags::AdaptiveSteppingDiagnostics, + Tags::HistoryEvolvedVariables, + Tags::HistoryEvolvedVariables>, + time_stepper_ref_tags>( + static_cast>( + std::make_unique(time_stepper)), initial_id, initial_step, next_id, next_step, diagnostics, history1, history2); diff --git a/tests/Unit/Time/Test_TakeStep.cpp b/tests/Unit/Time/Test_TakeStep.cpp index 51d29ca7442a..aa42f1960b14 100644 --- a/tests/Unit/Time/Test_TakeStep.cpp +++ b/tests/Unit/Time/Test_TakeStep.cpp @@ -102,13 +102,15 @@ void test_gts() { }, [](const auto y, const auto /*t*/) { return 1.0e-2 * y; }, time_step, 4); - auto box = db::create, Tags::TimeStepId, - Tags::Next, Tags::TimeStep, Tags::Next, - EvolvedVariable, Tags::dt, - Tags::HistoryEvolvedVariables, - Tags::TimeStepper, - ::Tags::IsUsingTimeSteppingErrorControl>>( + auto box = db::create< + db::AddSimpleTags, + Tags::TimeStepId, Tags::Next, + Tags::TimeStep, Tags::Next, + EvolvedVariable, Tags::dt, + Tags::HistoryEvolvedVariables, + Tags::ConcreteTimeStepper, + ::Tags::IsUsingTimeSteppingErrorControl>, + time_stepper_ref_tags>( Metavariables{}, TimeStepId{true, 0_st, slab.start()}, TimeStepId{true, 0_st, Time{slab, {1, 4}}}, time_step, time_step, initial_values, DataVector{5, 0.0}, std::move(history), @@ -170,12 +172,13 @@ void test_lts() { Tags::dt, Tags::StepperError, Tags::PreviousStepperError, Tags::HistoryEvolvedVariables, - Tags::TimeStepper, Tags::StepChoosers, + Tags::ConcreteTimeStepper, Tags::StepChoosers, domain::Tags::MinimumGridSpacing<1, Frame::Inertial>, ::Tags::IsUsingTimeSteppingErrorControl, Tags::StepperErrorUpdated, Tags::AdaptiveSteppingDiagnostics>, - db::AddComputeTags>( + tmpl::push_back, + typename Metavariables::system:: + compute_largest_characteristic_speed>>( Metavariables{}, TimeStepId{true, 0_st, slab.start()}, TimeStepId{true, 0_st, Time{slab, {1, 4}}}, time_step, time_step, initial_values, DataVector{5, 0.0}, DataVector{}, DataVector{}, @@ -219,7 +222,7 @@ void test_lts() { *next_time_step = local_time_step->with_slab(next_time_id->step_time().slab()); }, - make_not_null(&box), db::get>(box)); + make_not_null(&box), db::get>(box)); db::mutate>(update_rhs, make_not_null(&box), db::get(box));