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

Flipped sign in operator to match the definition of InstationaryModel

parent 2bc85224
......@@ -301,10 +301,10 @@ def implicit_midpoint_rule(A, F, M, U0, t0, t1, nt, mu=None, num_values=None, so
else:
options = solver_options
M_dt_A_impl = (M - A * (dt/2)).with_(solver_options=options)
M_dt_A_impl = (M + A * (dt/2)).with_(solver_options=options)
if not _depends_on_time(M_dt_A_impl, mu):
M_dt_A_impl = M_dt_A_impl.assemble(mu)
M_dt_A_expl = (M + A * (dt/2)).with_(solver_options=options)
M_dt_A_expl = (M - A * (dt/2)).with_(solver_options=options)
if not _depends_on_time(M_dt_A_expl, mu):
M_dt_A_expl = M_dt_A_expl.assemble(mu)
......
......@@ -90,7 +90,8 @@ class QuadraticHamiltonianModel(InstationaryModel):
raise NotImplementedError('Canonical Poisson matrix not implemented for this case.')
# the contract expand structure is mainly relevant for reduced quadratic Hamiltonian systems
operator = contract(expand(ConcatenationOperator([self.J, H_op])))
# minus is required since operator in an InstationaryModel is on the LHS
operator = -contract(expand(ConcatenationOperator([self.J, H_op])))
rhs = ConcatenationOperator([self.J, h])
super().__init__(T, initial_data, operator, rhs,
time_stepper=time_stepper,
......
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