@@ -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