pymor.algorithms.timestepping¶
Generic time-stepping 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.
The TimeStepper defines a common interface that has to be fulfilled by
the time-steppers used by InstationaryModel.
Module Contents¶
- class pymor.algorithms.timestepping.DiscreteTimeStepper[source]¶
Bases:
TimeStepperDiscrete time-stepper.
Solves equations of the form
M(mu) * u_k+1 + A(u_k, mu, k) = F(mu, k). u(mu, k_0) = u_0(mu).
by direct time stepping.
Methods
Estimate the number of time steps.
Iterate time-stepper to the equation.
- estimate_time_step_count(initial_time, end_time)[source]¶
Estimate the number of time steps.
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping.
- iterate(initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Iterate time-stepper to the equation.
The equation is of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping. The end time is also allowed to be smaller than the initial time which results in solving the corresponding terminal value problem, i.e.
initial_dataserves as terminal data in this case and is also stored first in the resultingVectorArray.initial_data – The solution vector at
initial_time.operator – The
OperatorA.rhs – The right-hand side. Either a vector-like
Operatorwithsource.dim == 1or aVectorArray. If theVectorArraycontains more than one vector,vector_array_to_selection_operatoris used to convert the array to anOperatorthat is piecewise constant in time. IfNone, zero right-hand side is assumed.mass – The
OperatorM. IfNone, the identity operator is assumed.mu –
Parameter valuesfor whichoperatorandrhsare evaluated. The current time is added tomuwith keyt.num_values – The number of returned vectors of the solution trajectory. If
None, each intermediate vector that is calculated is returned.
- Returns:
Generator yielding tuples (U, t) of snapshots and times.
- class pymor.algorithms.timestepping.ExplicitEulerTimeStepper(nt)[source]¶
Bases:
TimeStepperExplicit Euler time-stepper.
Solves equations of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
by explicit Euler time integration.
- Parameters:
nt – The number of time-steps the time-stepper will perform.
Methods
Estimate the number of time steps.
Iterate time-stepper to the equation.
- estimate_time_step_count(initial_time, end_time)[source]¶
Estimate the number of time steps.
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping.
- iterate(initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Iterate time-stepper to the equation.
The equation is of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping. The end time is also allowed to be smaller than the initial time which results in solving the corresponding terminal value problem, i.e.
initial_dataserves as terminal data in this case and is also stored first in the resultingVectorArray.initial_data – The solution vector at
initial_time.operator – The
OperatorA.rhs – The right-hand side. Either a vector-like
Operatorwithsource.dim == 1or aVectorArray. If theVectorArraycontains more than one vector,vector_array_to_selection_operatoris used to convert the array to anOperatorthat is piecewise constant in time. IfNone, zero right-hand side is assumed.mass – The
OperatorM. IfNone, the identity operator is assumed.mu –
Parameter valuesfor whichoperatorandrhsare evaluated. The current time is added tomuwith keyt.num_values – The number of returned vectors of the solution trajectory. If
None, each intermediate vector that is calculated is returned.
- Returns:
Generator yielding tuples (U, t) of snapshots and times.
- class pymor.algorithms.timestepping.ImplicitEulerTimeStepper(nt, solver=None)[source]¶
Bases:
TimeStepperImplicit Euler time-stepper.
Solves equations of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
by implicit Euler time integration.
- Parameters:
nt – The number of time-steps the time-stepper will perform.
solver – The
Solverfor each time step.
Methods
Estimate the number of time steps.
Iterate time-stepper to the equation.
- estimate_time_step_count(initial_time, end_time)[source]¶
Estimate the number of time steps.
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping.
- iterate(initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Iterate time-stepper to the equation.
The equation is of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping. The end time is also allowed to be smaller than the initial time which results in solving the corresponding terminal value problem, i.e.
initial_dataserves as terminal data in this case and is also stored first in the resultingVectorArray.initial_data – The solution vector at
initial_time.operator – The
OperatorA.rhs – The right-hand side. Either a vector-like
Operatorwithsource.dim == 1or aVectorArray. If theVectorArraycontains more than one vector,vector_array_to_selection_operatoris used to convert the array to anOperatorthat is piecewise constant in time. IfNone, zero right-hand side is assumed.mass – The
OperatorM. IfNone, the identity operator is assumed.mu –
Parameter valuesfor whichoperatorandrhsare evaluated. The current time is added tomuwith keyt.num_values – The number of returned vectors of the solution trajectory. If
None, each intermediate vector that is calculated is returned.
- Returns:
Generator yielding tuples (U, t) of snapshots and times.
- class pymor.algorithms.timestepping.ImplicitMidpointTimeStepper(nt, solver=None)[source]¶
Bases:
TimeStepperImplicit midpoint rule time-stepper. Symplectic integrator + preserves quadratic invariants.
Solves equations of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
by implicit midpoint time integration.
- Parameters:
nt – The number of time-steps the time-stepper will perform.
solver – The
Solverfor each time step.
Methods
Estimate the number of time steps.
Iterate time-stepper to the equation.
- estimate_time_step_count(initial_time, end_time)[source]¶
Estimate the number of time steps.
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping.
- iterate(initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Iterate time-stepper to the equation.
The equation is of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping. The end time is also allowed to be smaller than the initial time which results in solving the corresponding terminal value problem, i.e.
initial_dataserves as terminal data in this case and is also stored first in the resultingVectorArray.initial_data – The solution vector at
initial_time.operator – The
OperatorA.rhs – The right-hand side. Either a vector-like
Operatorwithsource.dim == 1or aVectorArray. If theVectorArraycontains more than one vector,vector_array_to_selection_operatoris used to convert the array to anOperatorthat is piecewise constant in time. IfNone, zero right-hand side is assumed.mass – The
OperatorM. IfNone, the identity operator is assumed.mu –
Parameter valuesfor whichoperatorandrhsare evaluated. The current time is added tomuwith keyt.num_values – The number of returned vectors of the solution trajectory. If
None, each intermediate vector that is calculated is returned.
- Returns:
Generator yielding tuples (U, t) of snapshots and times.
- class pymor.algorithms.timestepping.TimeStepper[source]¶
Bases:
pymor.core.base.ImmutableObjectInterface for time-stepping algorithms.
Algorithms implementing this interface solve time-dependent initial value problems of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
Time-steppers used by
InstationaryModelhave to fulfill this interface.Methods
Estimate the number of time steps.
Iterate time-stepper to the equation.
Apply time-stepper to the equation.
- abstract estimate_time_step_count(initial_time, end_time)[source]¶
Estimate the number of time steps.
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping.
- abstract iterate(initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Iterate time-stepper to the equation.
The equation is of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping. The end time is also allowed to be smaller than the initial time which results in solving the corresponding terminal value problem, i.e.
initial_dataserves as terminal data in this case and is also stored first in the resultingVectorArray.initial_data – The solution vector at
initial_time.operator – The
OperatorA.rhs – The right-hand side. Either a vector-like
Operatorwithsource.dim == 1or aVectorArray. If theVectorArraycontains more than one vector,vector_array_to_selection_operatoris used to convert the array to anOperatorthat is piecewise constant in time. IfNone, zero right-hand side is assumed.mass – The
OperatorM. IfNone, the identity operator is assumed.mu –
Parameter valuesfor whichoperatorandrhsare evaluated. The current time is added tomuwith keyt.num_values – The number of returned vectors of the solution trajectory. If
None, each intermediate vector that is calculated is returned.
- Returns:
Generator yielding tuples (U, t) of snapshots and times.
- solve(initial_time, end_time, initial_data, operator, rhs=None, mass=None, mu=None, num_values=None)[source]¶
Apply time-stepper to the equation.
The equation is of the form
M(mu) * d_t u + A(u, mu, t) = F(mu, t), u(mu, t_0) = u_0(mu).
- Parameters:
initial_time – The time at which to begin time-stepping.
end_time – The time until which to perform time-stepping. The end time is also allowed to be smaller than the initial time which results in solving the corresponding terminal value problem, i.e.
initial_dataserves as terminal data in this case and is also stored first in the resultingVectorArray.initial_data – The solution vector at
initial_time.operator – The
OperatorA.rhs – The right-hand side. Either a vector-like
Operatorwithsource.dim == 1or aVectorArray. If theVectorArraycontains more than one vector,vector_array_to_selection_operatoris used to convert the array to anOperatorthat is piecewise constant in time. IfNone, zero right-hand side is assumed.mass – The
OperatorM. IfNone, the identity operator is assumed.mu –
Parameter valuesfor whichoperatorandrhsare evaluated. The current time is added tomuwith 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.