Skip to content

Commit

Permalink
Fix AAb/CCone
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottMacLachlan committed Nov 18, 2024
1 parent e4e193d commit 26d5135
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions irksome/dirk_stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,8 @@ def __init__(self, F, butcher_tableau, t, dt, u0, bcs=None,

self.butcher_tableau = butcher_tableau
self.num_stages = num_stages = butcher_tableau.num_stages
self.AAb = numpy.zeros((num_stages+1, num_stages))
self.AAb[:-1, :] = butcher_tableau.A
self.AAb[-1, :] = butcher_tableau.b
self.CCone = numpy.zeros(num_stages+1)
self.CCone[:-1] = butcher_tableau.c
self.CCone[-1] = 1.0
self.AAb = numpy.vstack((butcher_tableau.A, butcher_tableau.b))
self.CCone = numpy.append(butcher_tableau.c, 1.0)

self.V = V = u0.function_space()
self.u0 = u0
Expand Down Expand Up @@ -134,7 +130,9 @@ def __init__(self, F, butcher_tableau, t, dt, u0, bcs=None,

self.kgac = k, g, a, c, a_vals, d_val

def update_bc_constants(self, AAb, CCone, i, a_vals, d_val, c):
def update_bc_constants(self, i, a_vals, d_val, c):
AAb = self.AAb
CCone = self.CCone
ns = AAb.shape[1]
for j in range(i):
a_vals[j].assign(AAb[i, j])
Expand Down Expand Up @@ -162,7 +160,7 @@ def advance(self):
gbit += dtc * float(AA[i, j]) * kbit

# update BC constants for the variational problem
self.update_bc_constants(self.AAb, self.CCone, i, a_vals, d_val, c)
self.update_bc_constants(i, a_vals, d_val, c)
a.assign(AA[i, i])

# solve new variational problem, stash the computed
Expand Down

0 comments on commit 26d5135

Please sign in to comment.