Skip to content

Commit

Permalink
fixed issue in cyrk class first step
Browse files Browse the repository at this point in the history
  • Loading branch information
jrenaud90 committed Jul 27, 2023
1 parent d203195 commit 3085a0d
Show file tree
Hide file tree
Showing 3 changed files with 7,583 additions and 1,025 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

### v0.6.0

TODO:
- fix potential power issue in cyrk_ode

Bug Fixes:
- Fixed missing declarations for variables in `cyrk_ode`

Expand Down
24 changes: 17 additions & 7 deletions CyRK/cy/_cyrk_class.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,26 @@ cdef class CyRKSolver:
# Dummy Variables, set equal to E3
self.E_view[i] = DOP_E3[i]

# Reset live variables to their starting values.
# Set current and old y variables equal to y0
for i in range(self.y_size):
self.y_new_view[i] = self.y0_view[i]
self.y_old_view[i] = self.y0_view[i]
# Set current and old time variables equal to t0
self.t_old = self.t_start
self.t_new = self.t_start

# Initialize dy_new_view for start of integration (important for first_step calculation)
if not self.capture_extra:
# If `capture_extra` is True then this step was already performed so we can skip it.
self.diffeq()

for i in range(self.y_size):
self.dy_old_view[i] = self.dy_new_view[i]

# Determine first step
if first_step == 0.:
self.step_size = self.calc_first_step()

# Reset state variables
self.t_old = self.t_start
self.t_new = self.t_start
for i in range(self.y_size):
self.y_new_view[i] = self.y0_view[i]
self.y_old_view[i] = self.y0_view[i]
else:
if first_step <= 0.:
raise Exception('Error in user-provided step size: Step size must be a positive number.')
Expand Down
Loading

0 comments on commit 3085a0d

Please sign in to comment.