Commit 183b33a3 authored by Patrick Buchfink's avatar Patrick Buchfink Committed by Stephan Rave
Browse files

Classmethod with_implicit_midpoint

parent bef96d52
......@@ -4,6 +4,7 @@
import numpy as np
from pymor.algorithms.simplify import contract, expand
from pymor.algorithms.timestepping import ImplicitMidpointTimeStepper
from pymor.algorithms.to_matrix import to_matrix
from pymor.models.basic import InstationaryModel
from pymor.operators.block import BlockOperator
......@@ -101,6 +102,22 @@ class QuadraticHamiltonianModel(InstationaryModel):
name=name)
self.__auto_init(locals())
@classmethod
def with_implicit_midpoint(cls, T, initial_data, H_op, nt, h=None, time_stepper=None,
num_values=None, output_functional=None, visualizer=None, name=None):
"""Init QuadraticHamiltonianModel with ImplicitMidpointTimeStepper.
Parameters
----------
nt
Number of time steps in ImplicitMidpointTimeStepper.
others
See __init__.
"""
time_stepper = ImplicitMidpointTimeStepper(nt)
cls(T, initial_data, H_op, nt, h=h, time_stepper=time_stepper, num_values=num_values,
output_functional=output_functional, visualizer=visualizer, name=name)
def eval_hamiltonian(self, u, mu=None):
"""Evaluate a quadratic Hamiltonian function
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment