Skip to content

Commit 8e9c149

Browse files
Updated ParaDiag sweepers to #577 (#579)
1 parent 525f6a1 commit 8e9c149

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

pySDC/implementations/sweeper_classes/ParaDiagSweepers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ class QDiagonalization(generic_implicit):
2525
parameters if you want to use this sweeper in SDC.
2626
"""
2727

28-
def __init__(self, params):
28+
def __init__(self, params, level):
2929
"""
3030
Initialization routine for the custom sweeper
3131
3232
Args:
3333
params: parameters for the sweeper
34+
level (pySDC.Level.level): the level that uses this sweeper
3435
"""
3536
if 'G_inv' not in params.keys():
3637
params['G_inv'] = np.eye(params['num_nodes'])
3738
params['update_f_evals'] = params.get('update_f_evals', False)
3839
params['ignore_ic'] = params.get('ignore_ic', True)
3940

40-
super().__init__(params)
41+
super().__init__(params, level)
4142

4243
self.set_G_inv(self.params.G_inv)
4344

pySDC/tutorial/step_9/A_paradiag_for_linear_problems.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def my_print(*args, **kwargs):
3535
# setup pySDC infrastructure for Dahlquist problem and quadrature
3636
prob = problem_class(lambdas=-1.0 * np.ones(shape=(N)), u0=1.0)
3737
sweeper_params = params = {'num_nodes': M, 'quad_type': 'RADAU-RIGHT'}
38-
sweep = generic_implicit(sweeper_params)
38+
sweep = generic_implicit(sweeper_params, None)
3939

4040
# Setup a global NumPy array and insert initial conditions in the first step
4141
u = np.zeros((L, M, N), dtype=complex)
@@ -235,7 +235,7 @@ def residual(_u, u0):
235235
"""
236236
G = [(D_alpha_diag_vals[l] * H_M + I_M).tocsc() for l in range(L)] # MxM
237237
G_inv = [sp.linalg.inv(_G).toarray() for _G in G] # MxM
238-
sweepers = [QDiagonalization(params={**sweeper_params, 'G_inv': _G_inv}) for _G_inv in G_inv]
238+
sweepers = [QDiagonalization(params={**sweeper_params, 'G_inv': _G_inv}, level=None) for _G_inv in G_inv]
239239

240240

241241
sol_ParaDiag = u.copy().astype(complex)

pySDC/tutorial/step_9/B_paradiag_for_nonlinear_problems.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def my_print(*args, **kwargs):
5858
u = np.zeros((L, M, N), dtype=complex)
5959

6060
# setup collocation problem
61-
sweep = sweeper_class({'num_nodes': M, 'quad_type': 'RADAU-RIGHT'})
61+
sweep = sweeper_class({'num_nodes': M, 'quad_type': 'RADAU-RIGHT'}, None)
6262

6363
# initial conditions
6464
u[0, :, :] = prob.u_exact(t=0)

0 commit comments

Comments
 (0)