Skip to content

Commit 7a758d9

Browse files
committed
Small fix for computations of power for state-dependent R and G matrices
1 parent b28164c commit 7a758d9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

python/sav_solver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,11 @@ def time_step(self, qlast, qnow, rn, unow, ConstantRmid = False):
384384

385385
# Compute Rmid and G
386386
if not ConstantRmid:
387+
self.Rmidnlast = self.Rmidn
387388
self.Rmidn = self.model.Rmid(qnow)
388389
# Get qnext q^{n+3/2} using Shermann-Morrison
389390
self.A0_inv_n = self.A0_inv(self.Rmidn)
391+
self.Gnlast = self.Gn
390392
self.Gn = self.model.G(qnow)
391393

392394
den = (4 + self.gn.dot(self.A0_inv_n * self.gn)) # eq 19g
@@ -439,8 +441,8 @@ def integrate(self, q0, u0, u_func, duration, ConstantRmid = False,
439441
qnext, rnext, qn, pn, epsilon = self.time_step(qlast, qnow, rnow, u_func((i+0.5) * self.dt), ConstantRmid=ConstantRmid)
440442

441443
self.storage.store(q = qn, p = pn, r= rnow,
442-
epsilon = epsilon, i = i, Rmid=self.Rmidn,
443-
G = self.Gn, u = u_func((i+0.5) * self.dt), solver=self)
444+
epsilon = epsilon, i = i, Rmid=self.Rmidnlast,
445+
G = self.Gnlast, u = u_func((i-0.5) * self.dt), solver=self)
444446
self.plotter.update_plots(self.storage, block=False)
445447

446448
qlast = qnow

0 commit comments

Comments
 (0)