pymor.algorithms.timestepping
¶
Generic timestepping algorithms for the solution of instationary problems.
The algorithms are generic in the sense that each algorithms operates exclusively
on Operators
and VectorArrays
. In particular, the algorithms
can also be used to turn an arbitrary stationary Model
provided
by an external library into an instationary Model
.
Currently, implementations of explicit_euler
and implicit_euler
timestepping are provided. The TimeStepper
defines a
common interface that has to be fulfilled by the timesteppers used
by InstationaryModel
. The classes ExplicitEulerTimeStepper
and ImplicitEulerTimeStepper
encapsulate explicit_euler
and
implicit_euler
to provide this interface.
Module Contents¶
Classes¶
Interface for timestepping algorithms. 

Implicit Euler timestepper. 

Explicit Euler timestepper. 
Functions¶
 class pymor.algorithms.timestepping.TimeStepper[source]¶
Bases:
pymor.core.base.ImmutableObject
Interface for timestepping algorithms.
Algorithms implementing this interface solve timedependent problems of the form
M * d_t u + A(u, mu, t) = F(mu, t).
Timesteppers used by
InstationaryModel
have to fulfill this interface. abstract solve(self, initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Apply timestepper to the equation
M * d_t u + A(u, mu, t) = F(mu, t).
Parameters
 initial_time
The time at which to begin timestepping.
 end_time
The time until which to perform timestepping.
 initial_data
The solution vector at
initial_time
. operator
The
Operator
A. rhs
The righthand side F (either
VectorArray
of length 1 orOperator
withsource.dim == 1
). IfNone
, zero righthand side is assumed. mass
The
Operator
M. IfNone
, the identity operator is assumed. mu
Parameter values
for whichoperator
andrhs
are evaluated. The current time is added tomu
with keyt
. num_values
The number of returned vectors of the solution trajectory. If
None
, each intermediate vector that is calculated is returned.
Returns
VectorArray
containing the solution trajectory.
 class pymor.algorithms.timestepping.ImplicitEulerTimeStepper(nt, solver_options='operator')[source]¶
Bases:
TimeStepper
Implicit Euler timestepper.
Solves equations of the form
M * d_t u + A(u, mu, t) = F(mu, t).
Parameters
 nt
The number of timesteps the timestepper will perform.
 solver_options
The
solver_options
used to invertM + dt*A
. The special values'mass'
and'operator'
are recognized, in which case the solver_options of M (resp. A) are used.
 solve(self, initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Apply timestepper to the equation
M * d_t u + A(u, mu, t) = F(mu, t).
Parameters
 initial_time
The time at which to begin timestepping.
 end_time
The time until which to perform timestepping.
 initial_data
The solution vector at
initial_time
. operator
The
Operator
A. rhs
The righthand side F (either
VectorArray
of length 1 orOperator
withsource.dim == 1
). IfNone
, zero righthand side is assumed. mass
The
Operator
M. IfNone
, the identity operator is assumed. mu
Parameter values
for whichoperator
andrhs
are evaluated. The current time is added tomu
with keyt
. num_values
The number of returned vectors of the solution trajectory. If
None
, each intermediate vector that is calculated is returned.
Returns
VectorArray
containing the solution trajectory.
 class pymor.algorithms.timestepping.ExplicitEulerTimeStepper(nt)[source]¶
Bases:
TimeStepper
Explicit Euler timestepper.
Solves equations of the form
M * d_t u + A(u, mu, t) = F(mu, t).
Parameters
 nt
The number of timesteps the timestepper will perform.
 solve(self, initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Apply timestepper to the equation
M * d_t u + A(u, mu, t) = F(mu, t).
Parameters
 initial_time
The time at which to begin timestepping.
 end_time
The time until which to perform timestepping.
 initial_data
The solution vector at
initial_time
. operator
The
Operator
A. rhs
The righthand side F (either
VectorArray
of length 1 orOperator
withsource.dim == 1
). IfNone
, zero righthand side is assumed. mass
The
Operator
M. IfNone
, the identity operator is assumed. mu
Parameter values
for whichoperator
andrhs
are evaluated. The current time is added tomu
with keyt
. num_values
The number of returned vectors of the solution trajectory. If
None
, each intermediate vector that is calculated is returned.
Returns
VectorArray
containing the solution trajectory.
 pymor.algorithms.timestepping.implicit_euler(A, F, M, U0, t0, t1, nt, mu=None, num_values=None, solver_options='operator')[source]¶