Skip to content

Commit

Permalink
fixed issue with cyrk class mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jrenaud90 committed Jul 27, 2023
1 parent 27a7b5e commit f64bb50
Show file tree
Hide file tree
Showing 2 changed files with 997 additions and 10,347 deletions.
16 changes: 9 additions & 7 deletions CyRK/cy/_cyrk_class.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,13 @@ cdef class CyRKSolver:
for i in range(self.y_size):
self.K_view[0, i] = self.dy_old_view[i]

# t_new must be updated for each loop of s in order to make the diffeq calls.
# But we need to return to its original value later on. Store in temp variable.
time_tmp = self.t_new
for s in range(1, self.len_C):
c = self.C_view[s]

# Update t_new so it can be used in the diffeq call.
# Keep old value so it can be restored.
time_tmp = self.t_new
self.t_new = self.t_old + c * step

# Dot Product (K, a) * step
Expand All @@ -525,8 +526,9 @@ cdef class CyRKSolver:
for i in range(self.y_size):
self.K_view[s, i] = self.dy_new_view[i]

# Restore t_new
# Restore t_new to its previous value.
self.t_new = time_tmp

# Dot Product (K, B) * step
for j in range(self.rk_n_stages):
# We do not use rk_n_stages_plus1 here because we are chopping off the last row of K to match
Expand Down Expand Up @@ -629,10 +631,10 @@ cdef class CyRKSolver:
# Issue with step convergence
self.status = -1
break
# elif not step_accepted:
# # Issue with step convergence
# self.status = -2
# break
elif not step_accepted:
# Issue with step convergence
self.status = -2
break

# End of step loop. Update the _now variables
self.t_old = self.t_new
Expand Down
Loading

0 comments on commit f64bb50

Please sign in to comment.