Splitting methods#

Some methods to solve a problem of the form:

\[\dot{u} = \sum_i f_i(t,u)\]

with the initial condition \(u(t=0)=u_0\). We note with \(\phi_{\tau}^{[f_i]}(t^n,\tilde{u}^n)\) the solution at time \(t^n+\tau\) of the subproblem \(\dot{u}=f_i(t,u)\) with the initial condition \(u(t^n)=\tilde{u}^n\).

Lie splitting method#

In Lie splitting method, the solution is computed as:

\[u^{n+1} = \phi_{\Delta t}^{[f_1]}\circ \cdots \circ \phi_{\Delta t}^{[f_n]} (t^n,u^n)\]
template<typename value_t, typename ...Methods_t>
class lie#

Lie splitting method.

Template Parameters:
  • value_t – type of time steps

  • Methods_t – list of methods to solve each sub-problem

Public Functions

lie(std::tuple<Methods_t...> const &meths, std::array<value_t, sizeof...(Methods_t)> const &dts)#

constructor of lie from a tuple

template<std::size_t I = 0, typename Problem_t, typename state_t>
inline void _call_inc(Problem_t &f, value_t tn, state_t &ui, value_t dt)#

incremental call of each method of each subproblem

The parameter ui is update to \(\phi_{\Delta t}^{[f_i]}(t^n,\texttt{ui})\)

Template Parameters:

I – solving step

Parameters:
  • fproblem to solve

  • tn – current time \(t^n\)

  • ui[inout] \(\texttt{ui}=\phi_{\Delta t}^{[f_1]}\circ\cdots\circ\phi_{\Delta t}^{[f_{i-1}]}(t^n,u^n)\)

  • dt – time step \(\Delta t\)

template<typename Problem_t, typename state_t>
auto operator()(Problem_t &f, value_t tn, state_t const &un, value_t dt)#

call operator to initiate Lie splitting recursion

Parameters:
  • fproblem to solve

  • tn – current time \(t^n\)

  • un – current solution \(u^n \approx u(t^n)\)

  • dt – time step \(\Delta t\)

Helper functions and classes#

template<typename value_t, typename ...Methods_t>
auto ponio::splitting::lie::make_lie_from_tuple(std::tuple<Methods_t...> const &meths, std::array<value_t, sizeof...(Methods_t)> const &dts)#

a helper factory for lie functor from a tuple of methods

Template Parameters:
  • value_t – type of coefficients

  • Methods_t – variadic list of types of methods

Parameters:
  • meths – list of methods

  • dts – associated time step foreach method

Returns:

a lie object build from the tuple of methods

template<typename value_t, typename ...Algorithms_t>
class lie_tuple#

a helper to deduce method for ponio::make_method(splitting::lie::lie_tuple<Algorithms_t…> const &, state_t const &)

This is a dummy class to select correct method to solve the problem

Template Parameters:
  • value_t – type of time steps

  • Algorithms_t – variadic template of algorithms to solve each subproblem

Public Functions

inline lie_tuple(std::tuple<Algorithms_t...> &&algs, std::array<value_t, sizeof...(Algorithms_t)> &&dts)#

constructor of lie_tuple from a variadic number of algorithms

template<typename value_t, typename ...Algorithms_t>
auto ponio::splitting::lie::make_lie_tuple(std::pair<Algorithms_t, value_t>&&... args)#

a helper factory for lie_tuple from a tuple of algorithms

Template Parameters:
  • value_t – type of coefficients

  • Algorithms_t – variadic list of types of algorithms

Parameters:

args – variadic list of pairs of algorithm and time step

Returns:

a lie_tuple object build from the tuple of methods

Strang splitting method#

In Strang splitting method, the solution is computed as:

\[u^{n+1} = \phi_{\frac{\Delta t}{2}}^{[f_1]}\circ \cdots \circ \phi_{\frac{\Delta t}{2}}^{[f_{n-1}]} \circ \phi_{\Delta t}^{[f_n]} \circ \phi_{\frac{\Delta t}{2}}^{[f_{n-1}]}\circ\cdots\circ \phi_{\frac{\Delta t}{2}}^{[f_1]} (t^n,u^n)\]
template<typename value_t, typename ...Methods_t>
class strang : public ponio::splitting::lie::lie<value_t, Methods_t...>#

Strang splitting method.

Template Parameters:

Methods_t – list of methods to solve each sub-problem

Public Functions

template<std::size_t I = 0, typename Problem_t, typename state_t>
inline void _call_inc(Problem_t &f, value_t tn, state_t &ui, value_t dt)#

incremental call of each method of each subproblem

The parameter ui is update to \(\phi_{^{\Delta t}/_2}^{[f_i]}(t^n,\texttt{ui})\)

Template Parameters:

I – solving step

Parameters:
  • fproblem to solve

  • tn – current time \(t^n\)

  • ui[inout] \(\texttt{ui}=\phi_{^{\Delta t}/_2}^{[f_1]}\circ\cdots\circ\phi_{^{\Delta t}/_2}^{[f_{i-1}]}(t^n,u^n)\)

  • dt – time step \(\Delta t\)

template<std::size_t I = sizeof...(Methods_t) - 1, typename Problem_t, typename state_t>
inline void _call_dec(Problem_t &f, value_t tn, state_t &ui, value_t dt)#

decremental call of each method of each subproblem

The parameter ui is update to \(\phi_{^{\Delta t}/_2}^{[f_i]}(t^n,\texttt{ui})\)

Template Parameters:

I – solving step

Parameters:
  • fproblem to solve

  • tn – current time \(t^n\)

  • ui[inout] current state of the substep I \(\texttt{ui}=\phi_{^{\Delta t}/_2}^{[f_1]}\circ\cdots\circ\phi_{\Delta t}^{[f_{n}]}\circ\cdots\circ\phi_{^{\Delta t}/_2}^{[f_{i+1}]}(t^n,u^n)\)

  • dt – time step \(\Delta t\)

template<typename Problem_t, typename state_t>
auto operator()(Problem_t &f, value_t tn, state_t const &un, value_t dt)#

call operator to initiate Strang splitting recursion

Parameters:
  • fproblem to solve

  • tn – current time \(t^n\)

  • un – current solution \(u^n \approx u(t^n)\)

  • dt – time step \(\Delta t\)

Helper functions and classes#

template<typename value_t, typename ...Methods_t>
auto ponio::splitting::strang::make_strang_from_tuple(std::tuple<Methods_t...> const &meths, std::array<value_t, sizeof...(Methods_t)> const &dts)#

a helper factory for strang functor from a tuple of methods

Template Parameters:
  • value_t – type of coefficients

  • Methods_t – variadic list of types of methods

Parameters:
  • meths – list of methods

  • dts – associated time step foreach method

Returns:

a strang object build from the tuple of methods

template<typename value_t, typename ...Algorithms_t>
class strang_tuple#

a helper to deduce method for ponio::make_method(splitting::strang::strang_tuple<Algorithms_t…> const &, state_t const &)

This is a dummy class to select correct method to solve the problem

Template Parameters:

Algorithms_t – variadic template of algorithms to solve each subproblem

Public Functions

inline strang_tuple(std::tuple<Algorithms_t...> &&algs, std::array<value_t, sizeof...(Algorithms_t)> &&dts)#

constructor of strang_tuple from a variadic number of algorithms

template<typename value_t, typename ...Algorithms_t>
auto ponio::splitting::strang::make_strang_tuple(std::pair<Algorithms_t, value_t>&&... args)#

a helper factory for strang_tuple from a tuple of algorithms

Template Parameters:
  • value_t – type of coefficients

  • Algorithms_t – variadic list of types of algorithms

Parameters:

args – variadic list of pairs of algorithm and time step

Returns:

a strang_tuple object build from the tuple of methods