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 a BlockVectorSpace as phase_space to be compatible with the current implementation of the symplectic basis generation techniques.

Methods

eval_hamiltonian

Evaluate a quadratic Hamiltonian function.

eval_hamiltonian(u, mu=None)[source]

Evaluate a quadratic Hamiltonian function.

Evaluation follows the formula:

Ham(u, t, μ) = 1/2 * u * H_op(t, μ) * u + u * h(t, μ)
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-like Operator, and u_0 the initial data. The right-hand side of the Hamiltonian equation is J times the gradient of the Hamiltonian

Ham(u, t, μ) = 1/2* u * H_op(t, μ) * u + u * h(t, μ).

The phase_space is assumed to be a BlockVectorSpace. If required, the arguments H_op, h and the initial_data are casted to operate on a BlockVectorSpace. With this construction, the solution u(t, μ) is based on a BlockVectorSpace 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 a VectorArray of length 1 or (for the Parameter-dependent case) a vector-like Operator (i.e. a linear Operator with source.dim == 1) which applied to NumpyVectorArray(np.array([1])) will yield the initial data for a given Parameter.

H_op

The Operator H_op.

h

The state-independet part of the Hamiltonian h.

time_stepper

The time-stepper to be used by solve. Alternatively, the parameter nt can be specified to use the implicit midpoint rule.

nt

If time_stepper is None and nt is specified, the implicit 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 a Functional, i.e. an Operator 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. If visualizer is not None, a visualize(U, *args, **kwargs) method is added to the model which forwards its arguments to the visualizer’s visualize method.

name

Name of the model.