Newmark Forward Time Scheme

template<typename AssemblyFields>
class newmark<AssemblyFields, specfem::simulation::type::forward> : public specfem::time_scheme::time_scheme

Newmark scheme for forward simulation.

Forward-only time integration where the adjoint wavefield methods are no-ops (return 0).

// Typical usage in a time loop
for (const auto [istep, dt] : scheme.iterate_forward()) {
  scheme.apply_predictor_phase_forward(medium_tag);
  // ... compute forces/accelerations ...
  scheme.apply_corrector_phase_forward(medium_tag);
}

Constructors

inline newmark(AssemblyFields &fields, int nstep, const int nstep_between_samples, const type_real dt, const type_real t0)

Construct a newmark time scheme object.

Parameters:
  • nstep – Maximum number of timesteps

  • nstep_between_samples – Number of timesteps between output seismogram samples

  • dt – Time increment

  • t0 – Initial time

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

virtual std::string to_string() const override

Convert time scheme to string representation.

Returns:

String describing Newmark scheme configuration

virtual void print(std::ostream &out) const override

Print time scheme details to output stream.

Parameters:

out – Output stream

virtual int apply_predictor_phase_forward(const specfem::element::medium_tag tag) override

Apply the predictor phase for forward simulation on fields within the elements within a medium.

Calls newmark_impl::predictor_phase_impl() on the forward wavefield with positive timestep.

Parameters:

tag – Medium tag for elements to apply the predictor phase

Returns:

int Returns the number of degrees of freedom updated within the medium

virtual int apply_corrector_phase_forward(const specfem::element::medium_tag tag) override

Apply the corrector phase for forward simulation on fields within the elements within a medium.

Calls newmark_impl::corrector_phase_impl() on the forward wavefield with positive \(\Delta t/2\).

Parameters:

tag – Medium tag for elements to apply the corrector phase

Returns:

int Returns the number of degrees of freedom updated within the medium

inline virtual int apply_predictor_phase_backward(const specfem::element::medium_tag tag) override

Apply the predictor phase for backward simulation on fields within the elements within a medium. (Empty implementation)

Parameters:

tag – Medium tag for elements to apply the predictor phase

Returns:

int Returns the number of degrees of freedom updated within the medium

inline virtual int apply_corrector_phase_backward(const specfem::element::medium_tag tag) override

Apply the corrector phase for backward simulation on fields within the elements within a medium. (Empty implementation)

Parameters:

tag – Medium tag for elements to apply the corrector phase

Returns:

int Returns the number of degrees of freedom updated within the medium

inline virtual specfem::time_scheme::type timescheme() const override

Get the timescheme type.

Returns:

specfem::time_scheme::type Timescheme type

inline virtual type_real get_timestep() const override

Get the time increment.

Returns:

type_real Time increment

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

Public Static Attributes

static constexpr auto dimension_tag = AssemblyFields::dimension_tag

Dimension tag.

static constexpr auto simulation_type = specfem::simulation::type::forward

Wavefield tag.