Standard Use#

Header: <pressio/ode_steppers_implicit.hpp>

Public namespace: pressio::ode

Scope#

This page describes the “standard use” of an “implicit stepper” for systems expressed either as

(1)#\[ \frac{d \boldsymbol{y}}{dt} = \boldsymbol{f}(\boldsymbol{y},t; ...), \qquad y(t_0) = y_0\]

or with a mass matrix:

(2)#\[ M(\boldsymbol{y}, t, ...) \frac{d \boldsymbol{y}}{dt} = \boldsymbol{f}(\boldsymbol{y},t; ...), \qquad y(t_0) = y_0\]

What do we mean by standard use?#

We refer to a use case as “standard” when you define your problem via objects that are responsible of computing f, its jacobian df/dy and, if applicable, the mass matrix M, and you want to do implicit stepping for it.

API#

namespace pressio{ namespace ode{

template<
  class SystemType,
  std::enable_if_t<
    RealValuedOdeSystemFusingRhsAndJacobian<mpl::remove_cvref_t<SystemType>>::value,
    int > = 0
  >
auto create_implicit_stepper(StepScheme schemeName,                     // (1)
			     SystemType && system)
{

  assert(schemeName == StepScheme::BDF1 ||
	 schemeName == StepScheme::BDF2 ||
	 schemeName == StepScheme::CrankNicolson);

  using system_type   = mpl::remove_cvref_t<SystemType>;
  using ind_var_type  = typename system_type::independent_variable_type;
  using state_type    = typename system_type::state_type;
  using residual_type = typename system_type::rhs_type;
  using jacobian_type = typename system_type::jacobian_type;

  // it is very important to use "SystemType" as template arg
  // because that it the right type carrying how we store the system
  using policy_type = impl::ResidualJacobianStandardPolicy<
    SystemType, ind_var_type, state_type, residual_type, jacobian_type>;

  using impl_type = impl::ImplicitStepperStandardImpl<
    ind_var_type, state_type, residual_type,
  std::enable_if_t<
    RealValuedCompleteOdeSystem<mpl::remove_cvref_t<SystemType>>::value,
    int > = 0
  class ResidualJacobianPolicyType,
  std::enable_if_t<
    ::pressio::ode::ImplicitResidualJacobianPolicy<
      mpl::remove_cvref_t<ResidualJacobianPolicyType>>::value, int
    > = 0
  >
auto create_implicit_stepper(StepScheme schemeName,
			     ResidualJacobianPolicyType && policy)
{

  assert(schemeName == StepScheme::BDF1 ||
	 schemeName == StepScheme::BDF2 ||
	 schemeName == StepScheme::CrankNicolson);

  using policy_type   = mpl::remove_cvref_t<ResidualJacobianPolicyType>;
  using ind_var_type  = typename policy_type::independent_variable_type;
  using state_type    = typename policy_type::state_type;
  using residual_type = typename policy_type::residual_type;
  using jacobian_type = typename policy_type::jacobian_type;

  using impl_type = impl::ImplicitStepperStandardImpl<
    ind_var_type, state_type, residual_type,
    jacobian_type, ResidualJacobianPolicyType>;

  return impl::create_implicit_stepper_impl<
    impl_type>(schemeName, std::forward<ResidualJacobianPolicyType>(policy));
}

//
// auxiliary API
template<class ...Args>
auto create_bdf2_stepper(Args && ... args){
  return create_implicit_stepper(StepScheme::BDF2,

Parameters#

schemeName

the target stepping scheme

system

problem instance

Constraints#

Concepts are documented here. Note: constraints are enforced via proper C++20 concepts when PRESSIO_ENABLE_CXX20 is enabled, otherwise via SFINAE and static asserts.

Preconditions#

  • odeScheme must be one of pressio::ode::StepScheme::{BDF1, BDF2}.

  • if system does not bind to a temporary object, it must bind to an lvalue object whose lifetime is longer that that of the instantiated stepper, i.e., it is destructed after the stepper goes out of scope

Examples#

Full Demos

  1. full demo