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.InstationaryModelBase class of quadratic Hamiltonian systems.
To formulate a quadratic Hamiltonian system it is advised to use a
QuadraticHamiltonianModelwhich works with aBlockVectorSpaceasphase_spaceto 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:
BaseQuadraticHamiltonianModelGeneric 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_spaceis assumed to be aBlockVectorSpace. If required, the argumentsH_op,hand theinitial_dataare casted to operate on aBlockVectorSpace. With this construction, the solution u(t, μ) is based on aBlockVectorSpacewhich 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 aVectorArrayof length 1 or (for theParameter-dependent case) a vector-likeOperator(i.e. a linearOperatorwithsource.dim == 1) which applied toNumpyVectorArray(np.array([1]))will yield the initial data for a givenParameter.H_op – The
OperatorH_op.h – The state-independent part of the Hamiltonian h.
time_stepper – The
time-stepperto be used bysolve. Alternatively, the parameter nt can be specified to use theimplicit midpoint rule.nt – If time_stepper is
Noneand nt is specified, theimplicit midpoint ruleas 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 –
Operatormapping a given solution to the model output. In many applications, this will be aFunctional, i.e. anOperatormapping to scalars. This is not required, however.visualizer – A visualizer for the problem. This can be any object with a
visualize(U, m, ...)method. Ifvisualizeris notNone, avisualize(U, *args, **kwargs)method is added to the model which forwards its arguments to the visualizer’svisualizemethod.name – Name of the model.