Skip to content

Commit 9a4a9ee

Browse files
author
Daniel Ruprecht
committed
removed function in test_imexsweeper that build LHS and RHS matrices - now all taken care of inside imex_sweeper
1 parent 1d51a57 commit 9a4a9ee

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

tests/test_imexsweeper.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ def setupLevelStepProblem(self):
3232
problem = level.prob
3333
return step, level, problem, nnodes
3434

35-
def setupSweeperMatrices(self, level, problem):
36-
lambdas = [ problem.lambda_f[0] , problem.lambda_s[0] ]
37-
LHS, RHS = level.sweep.get_scalar_problems_sweeper_mats( lambdas = lambdas )
38-
return LHS, RHS
39-
4035
#
4136
# General setUp function used by all tests
4237
#
@@ -108,7 +103,8 @@ def test_sweepequalmatrix(self):
108103
# Perform node-to-node SDC sweep
109104
level.sweep.update_nodes()
110105

111-
LHS, RHS = self.setupSweeperMatrices(level, problem)
106+
lambdas = [ problem.lambda_f[0] , problem.lambda_s[0] ]
107+
LHS, RHS = level.sweep.get_scalar_problems_sweeper_mats( lambdas = lambdas )
112108

113109
unew = np.linalg.inv(LHS).dot( u0full + RHS.dot(u0full) )
114110
usweep = np.array([ level.u[l].values.flatten() for l in range(1,nnodes+1) ])
@@ -141,7 +137,6 @@ def test_updateformula(self):
141137
def test_collocationinvariant(self):
142138
for type in classes:
143139
self.swparams['collocation_class'] = getattr(pySDC.CollocationClasses, type)
144-
145140
step, level, problem, nnodes = self.setupLevelStepProblem()
146141
level.sweep.predict()
147142
u0full = np.array([ level.u[l].values.flatten() for l in range(1,nnodes+1) ])
@@ -163,9 +158,9 @@ def test_collocationinvariant(self):
163158
# Perform node-to-node SDC sweep
164159
level.sweep.update_nodes()
165160

166-
# Build matrices for matrix formulation of sweep
167-
LHS = np.eye(nnodes) - step.status.dt*( problem.lambda_f[0]*QI + problem.lambda_s[0]*QE )
168-
RHS = step.status.dt*( (problem.lambda_f[0]+problem.lambda_s[0])*Q - (problem.lambda_f[0]*QI + problem.lambda_s[0]*QE) )
161+
lambdas = [ problem.lambda_f[0] , problem.lambda_s[0] ]
162+
LHS, RHS = level.sweep.get_scalar_problems_sweeper_mats( lambdas = lambdas )
163+
169164
# Make sure both matrix and node-to-node sweep leave collocation unaltered
170165
unew = np.linalg.inv(LHS).dot( u0full + RHS.dot(ucoll) )
171166
assert np.linalg.norm( unew - ucoll, np.infty )<1e-14, "Collocation solution not invariant under matrix SDC sweep"
@@ -189,7 +184,9 @@ def test_manysweepsequalmatrix(self):
189184
level.sweep.update_nodes()
190185
usweep = np.array([ level.u[l].values.flatten() for l in range(1,nnodes+1) ])
191186

192-
LHS, RHS = self.setupSweeperMatrices(level, problem)
187+
lambdas = [ problem.lambda_f[0] , problem.lambda_s[0] ]
188+
LHS, RHS = level.sweep.get_scalar_problems_sweeper_mats( lambdas = lambdas )
189+
193190
unew = u0full
194191
for i in range(0,K):
195192
unew = np.linalg.inv(LHS).dot( u0full + RHS.dot(unew) )
@@ -223,7 +220,9 @@ def test_manysweepupdate(self):
223220
level.sweep.compute_end_point()
224221
uend_sweep = level.uend.values
225222

226-
LHS, RHS = self.setupSweeperMatrices(level, problem)
223+
lambdas = [ problem.lambda_f[0] , problem.lambda_s[0] ]
224+
LHS, RHS = level.sweep.get_scalar_problems_sweeper_mats( lambdas = lambdas )
225+
227226
# Build single matrix representing K sweeps
228227
Pinv = np.linalg.inv(LHS)
229228
Mat_sweep = np.linalg.matrix_power(Pinv.dot(RHS), K)

0 commit comments

Comments
 (0)