Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pySDC/implementations/sweeper_classes/ParaDiagSweepers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@ class QDiagonalization(generic_implicit):
parameters if you want to use this sweeper in SDC.
"""

def __init__(self, params):
def __init__(self, params, level):
"""
Initialization routine for the custom sweeper

Args:
params: parameters for the sweeper
level (pySDC.Level.level): the level that uses this sweeper
"""
if 'G_inv' not in params.keys():
params['G_inv'] = np.eye(params['num_nodes'])
params['update_f_evals'] = params.get('update_f_evals', False)
params['ignore_ic'] = params.get('ignore_ic', True)

super().__init__(params)
super().__init__(params, level)

self.set_G_inv(self.params.G_inv)

Expand Down
4 changes: 2 additions & 2 deletions pySDC/tutorial/step_9/A_paradiag_for_linear_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def my_print(*args, **kwargs):
# setup pySDC infrastructure for Dahlquist problem and quadrature
prob = problem_class(lambdas=-1.0 * np.ones(shape=(N)), u0=1.0)
sweeper_params = params = {'num_nodes': M, 'quad_type': 'RADAU-RIGHT'}
sweep = generic_implicit(sweeper_params)
sweep = generic_implicit(sweeper_params, None)

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


sol_ParaDiag = u.copy().astype(complex)
Expand Down
2 changes: 1 addition & 1 deletion pySDC/tutorial/step_9/B_paradiag_for_nonlinear_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def my_print(*args, **kwargs):
u = np.zeros((L, M, N), dtype=complex)

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

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