pymor.models.symplectic
¶
Module Contents¶
- class pymor.models.symplectic.BaseQuadraticHamiltonianModel(T, initial_data, J, H_op, h=None, time_stepper=None, nt=None, num_values=None, output_functional=None, visualizer=None, name=None)[source]¶
Bases:
pymor.models.basic.InstationaryModel
Base class of quadratic Hamiltonian systems.
To formulate a quadratic Hamiltonian system it is advised to use a
QuadraticHamiltonianModel
which works with aBlockVectorSpace
asphase_space
to be compatible with the current implementation of the symplectic basis generation techniques.Methods
Evaluate a quadratic Hamiltonian function.
- class pymor.models.symplectic.QuadraticHamiltonianModel(T, initial_data, H_op, h=None, time_stepper=None, nt=None, num_values=None, output_functional=None, visualizer=None, name=None)[source]¶
Bases:
BaseQuadraticHamiltonianModel
Generic class for quadratic Hamiltonian systems.
This class describes Hamiltonian systems given by the equations:
∂_t u(t, μ) = J * H_op(t, μ) * u(t, μ) + J * h(t, μ) u(0, μ) = u_0(μ)
for t in [0,T], where H_op is a linear time-dependent
Operator
, J is a canonical Poisson matrix, h is a (possibly) time-dependent vector-likeOperator
, and u_0 the initial data. The right-hand side of the Hamiltonian equation is J times the gradient of the HamiltonianHam(u, t, μ) = 1/2* u * H_op(t, μ) * u + u * h(t, μ).
The
phase_space
is assumed to be aBlockVectorSpace
. If required, the argumentsH_op
,h
and theinitial_data
are casted to operate on aBlockVectorSpace
. With this construction, the solution u(t, μ) is based on aBlockVectorSpace
which is required for the current implementation of the symplectic basis generation techniques.Parameters
- T
The final time T.
- initial_data
The initial data
u_0
. Either aVectorArray
of length 1 or (for theParameter
-dependent case) a vector-likeOperator
(i.e. a linearOperator
withsource.dim == 1
) which applied toNumpyVectorArray(np.array([1]))
will yield the initial data for a givenParameter
.- H_op
The
Operator
H_op.- h
The state-independent part of the Hamiltonian h.
- time_stepper
The
time-stepper
to be used bysolve
. Alternatively, the parameter nt can be specified to use theimplicit midpoint rule
.- nt
If time_stepper is
None
and nt is specified, theimplicit midpoint rule
as time_stepper.- num_values
The number of returned vectors of the solution trajectory. If
None
, each intermediate vector that is calculated is returned.- output_functional
Operator
mapping a given solution to the model output. In many applications, this will be aFunctional
, i.e. anOperator
mapping to scalars. This is not required, however.- visualizer
A visualizer for the problem. This can be any object with a
visualize(U, m, ...)
method. Ifvisualizer
is notNone
, avisualize(U, *args, **kwargs)
method is added to the model which forwards its arguments to the visualizer’svisualize
method.- name
Name of the model.