include/pops/numerics/time/integrators/time_integrator.hpp Source FileΒΆ

adc_cpp: include/pops/numerics/time/integrators/time_integrator.hpp Source File
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
time_integrator.hpp
Go to the documentation of this file.
1#pragma once
2
21
22namespace pops {
23
24struct SSPRK2 {}; // Shu-Osher SSP-RK2 (2 stages, order 2)
25struct SSPRK3 {}; // Shu-Osher SSP-RK3 (3 stages, order 3)
26
27struct UserTimeIntegrator {}; // extension point: take_step provided by the case
28
30
31// SubstepsT: MORE FREQUENT substeps (n steps of dt/n per macro-step, fast electrons).
32// StrideT: SLOWER cadence (the block advances only 1 macro-step every StrideT, thus by a
33// step of StrideT*dt, a slow "gas" we do not solve at every step, guardian return).
34// Both are orthogonal; StrideT=1 = historical behavior.
35template <class MethodT, TimeTreatment TreatmentT, int SubstepsT = 1, int StrideT = 1>
36struct TimePolicy {
37 static_assert(SubstepsT >= 1, "a TimePolicy must have at least one substep");
38 static_assert(StrideT >= 1, "a TimePolicy must have a cadence (stride) >= 1");
39 using Method = MethodT;
40 static constexpr TimeTreatment treatment = TreatmentT;
41 static constexpr int substeps = SubstepsT;
42 static constexpr int stride = StrideT;
43};
44
45template <class T>
47 using Method = T;
49 static constexpr int substeps = 1;
50 static constexpr int stride = 1;
51};
52
53template <class MethodT, TimeTreatment TreatmentT, int SubstepsT, int StrideT>
54struct TimePolicyTraits<TimePolicy<MethodT, TreatmentT, SubstepsT, StrideT>> {
55 using Method = MethodT;
56 static constexpr TimeTreatment treatment = TreatmentT;
57 static constexpr int substeps = SubstepsT;
58 static constexpr int stride = StrideT;
59};
60
61template <class MethodT = SSPRK2, int SubstepsT = 1, int StrideT = 1>
63
64template <class MethodT = UserTimeIntegrator, int SubstepsT = 1, int StrideT = 1>
66
67template <class MethodT = UserTimeIntegrator, int SubstepsT = 1, int StrideT = 1>
69
71
72} // namespace pops
Definition amr_hierarchy.hpp:29
TimeTreatment
Definition time_integrator.hpp:29
Definition time_integrator.hpp:24
Definition time_integrator.hpp:25
Definition time_integrator.hpp:46
static constexpr int stride
Definition time_integrator.hpp:50
static constexpr int substeps
Definition time_integrator.hpp:49
T Method
Definition time_integrator.hpp:47
static constexpr TimeTreatment treatment
Definition time_integrator.hpp:48
Definition time_integrator.hpp:36
static constexpr TimeTreatment treatment
Definition time_integrator.hpp:40
static constexpr int substeps
Definition time_integrator.hpp:41
MethodT Method
Definition time_integrator.hpp:39
static constexpr int stride
Definition time_integrator.hpp:42
Definition time_integrator.hpp:27