specfem::time_scheme::time_scheme¶
-
class time_scheme¶
Base class for time integration schemes.
Provides the interface for time-stepping algorithms in wave propagation simulations. Handles forward and backward time integration, seismogram output control, and predictor-corrector phases.
Derived classes implement specific integration schemes (e.g.,
newmark).Subclassed by specfem::time_scheme::newmark< AssemblyFields, specfem::simulation::type::combined >, specfem::time_scheme::newmark< AssemblyFields, specfem::simulation::type::forward >
Constructors
-
inline time_scheme(const int nstep, const int nstep_between_samples, const type_real dt)¶
Construct time scheme.
- Parameters:
nstep – Number of timesteps
nstep_between_samples – Number of timesteps between seismogram samples
dt – Time step
Iterators
-
inline impl::ForwardRange iterate_forward()¶
Forward iterator.
/// increments time step for (const auto [istep, dt] : ts.iterate_forward()) { const auto time = istep * dt; /// Computing the current time }
- Returns:
std::tuple<int, type_real> Tuple of current timestep (istep) and time increment (dt)
-
inline impl::BackwardRange iterate_backward()¶
Backward iterator.
/// decrements time step for (const auto [istep, dt] : ts.iterate_backward()) { const auto time = istep * dt; /// Computing the current time }
- Returns:
std::tuple<int, type_real> Tuple of current timestep (istep) and time increment (dt)
Public Functions
-
inline int get_max_timestep()¶
Get the max timestep.
- Returns:
int Maximum number of timesteps
-
inline void increment_seismogram_step()¶
Increment seismogram output step.
-
inline bool compute_seismogram(const int istep) const¶
Checks if seismogram should be computed at current timestep.
- Parameters:
istep – Current timestep
- Returns:
bool True if seismogram should be computed
-
inline int get_seismogram_step() const¶
Get the current seismogram step.
- Returns:
int Seismogram timestep
-
inline int get_max_seismogram_step() const¶
Get the maximum seismogram step.
- Returns:
int Maximum seismogram step
-
inline int get_nstep_between_samples() const¶
Get the number of timesteps between seismogram samples.
- Returns:
int Number of timesteps between seismogram samples
-
virtual int apply_predictor_phase_forward(const specfem::element::medium_tag tag) = 0¶
Apply predictor phase for forward time integration.
Updates displacement and velocity using current acceleration for the forward wavefield. Pure virtual method implemented by derived classes.
- Parameters:
tag – Medium type to process (elastic, acoustic, etc.)
- Returns:
Number of degrees of freedom updated
-
virtual int apply_corrector_phase_forward(const specfem::element::medium_tag tag) = 0¶
Apply corrector phase for forward time integration.
Updates velocity using newly computed acceleration for the forward wavefield. Pure virtual method implemented by derived classes.
- Parameters:
tag – Medium type to process (elastic, acoustic, etc.)
- Returns:
Number of degrees of freedom updated
-
virtual int apply_predictor_phase_backward(const specfem::element::medium_tag tag) = 0¶
Apply predictor phase for backward time integration.
Updates displacement and velocity using current acceleration for the backward wavefield. Pure virtual method implemented by derived classes.
- Parameters:
tag – Medium type to process (elastic, acoustic, etc.)
- Returns:
Number of degrees of freedom updated
-
virtual int apply_corrector_phase_backward(const specfem::element::medium_tag tag) = 0¶
Apply corrector phase for backward time integration.
Updates velocity using newly computed acceleration for the backward wavefield. Pure virtual method implemented by derived classes.
- Parameters:
tag – Medium type to process (elastic, acoustic, etc.)
- Returns:
Number of degrees of freedom updated
-
virtual specfem::enums::time_scheme::type timescheme() const = 0¶
Get the time scheme type.
- Returns:
Type of time integration scheme (e.g., Newmark)
-
virtual std::string to_string() const = 0¶
Convert time scheme to string representation.
- Returns:
String describing the time scheme configuration
-
virtual void print(std::ostream &out) const = 0¶
Print time scheme details to output stream.
- Parameters:
out – Output stream
-
virtual type_real get_timestep() const = 0¶
Get the time increment per step.
- Returns:
Time step size
-
inline time_scheme(const int nstep, const int nstep_between_samples, const type_real dt)¶