Skip to content

Commit 474a052

Browse files
committed
FixedSAV bound but seems to do nothing ?
1 parent b96a216 commit 474a052

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

python/plot_drift_JAES.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def Fext(t):
9696
storage["p_idx"] = None
9797

9898
solver.integrate(q0, u0, Fext, duration, ConstantRmid=True,
99-
plotter_config=NO_PLOTTER_CONFIG, storage_config=storage, BoundG=True)
99+
plotter_config=NO_PLOTTER_CONFIG, storage_config=storage, BoundG=False)
100100
solver.storage.write(os.path.join(
101101
result_folder, f"{mode}/sr{sr}_lambda{lambda0}.h5"))
102102

python/sav_solver.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,12 @@ def time_step(self, qlast, qnow, rn, unow, ConstantRmid=False, BoundG=False):
412412

413413
# The following bound is valid only for Rmid and M being a scalar time identity matrix
414414
if BoundG:
415-
# self.RHSn = self.B_op(qnow) + self.C_op(qlast, np.zeros_like(self.gn),
416-
# self.Rmidn) + self.Gn @ unow # eq 19b
415+
self.RHSn = self.B_op(qnow) + self.C_op(qlast, np.zeros_like(self.gn),
416+
self.Rmidn) + self.Gn @ unow # eq 19b
417417
if (self.gn.dot(self.A0_inv_n * (self.RHSn)) != 0):
418-
# multiplicative_bound = - 2 * rn / (self.gn.dot(self.A0_inv *
419-
# (self.RHSn)
420-
# ))
421-
multiplicative_bound = 0
418+
multiplicative_bound = - 2 * rn / (self.gn.dot(self.A0_inv_n *
419+
(self.RHSn)
420+
))
422421
else:
423422
multiplicative_bound = 0
424423
if (multiplicative_bound > 1):
@@ -427,12 +426,11 @@ def time_step(self, qlast, qnow, rn, unow, ConstantRmid=False, BoundG=False):
427426
g_mult = 1
428427
else:
429428
g_mult = 1
430-
g_mult = 1
431429

432430
den = (4 + g_mult**2 * self.gn.dot(self.A0_inv_n * self.gn)) # eq 19g
433431

434-
self.RHSn += self.B_op(qnow) + self.C_op(qlast, g_mult * self.gn,
435-
self.Rmidn) + self.Gn @ unow - g_mult * self.gn * rn
432+
self.RHSn = self.B_op(qnow) + self.C_op(qlast, g_mult * self.gn,
433+
self.Rmidn) + self.Gn @ unow - g_mult * self.gn * rn
436434

437435
qnext = self.model.J0 * self.A0_inv_n * self.RHSn \
438436
- self.model.J0 * self.A0_inv_n * g_mult * self.gn / den * \
@@ -441,6 +439,8 @@ def time_step(self, qlast, qnow, rn, unow, ConstantRmid=False, BoundG=False):
441439
# Update auxiliary variable
442440
rnext = rn + g_mult * \
443441
self.gn.dot((qnext - qlast) / (2 * self.model.J0))
442+
if (rnext < 0):
443+
print("wtf")
444444
return qnext, rnext, qn, pn, self.epsilon
445445

446446
def integrate(self, q0, u0, u_func, duration, ConstantRmid=False,

0 commit comments

Comments
 (0)