Skip to content

Commit 5bb103a

Browse files
author
Daniel Ruprecht
committed
Swepper correctly throws AssertionError if do_coll_update is set to False for collocation object with right_is_node=False
1 parent a892f5f commit 5bb103a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pySDC/Sweeper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self,params):
4545
coll = params['collocation_class'](params['num_nodes'],0,1)
4646
assert isinstance(coll, CollBase)
4747
if not coll.right_is_node:
48-
assert self.params['do_coll_update'], "For nodes where the right end point is not a node, do_coll_update has to be set to True"
48+
assert params['do_coll_update'], "For nodes where the right end point is not a node, do_coll_update has to be set to True"
4949

5050
# This will be set as soon as the sweeper is instantiated at the level
5151
self.__level = None

tests/test_imexsweeper.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def test_manysweepsequalmatrix(self):
204204
#
205205
# Make sure that update function for K sweeps computed from K-sweep matrix gives same result as K sweeps in node-to-node form plus compute_end_point
206206
#
207-
def test_maysweepupdate(self):
207+
def test_manysweepupdate(self):
208208

209209
step, level, problem, nnodes = self.setupLevelStepProblem()
210210
step.levels[0].sweep.predict()
@@ -229,3 +229,13 @@ def test_maysweepupdate(self):
229229
# Multiply u0 by value of update function to get end value directly
230230
uend_matrix = update*self.pparams['u0']
231231
assert abs(uend_matrix - uend_sweep)<1e-14, "Node-to-node sweep plus update yields different result than update function computed through K-sweep matrix"
232+
233+
#
234+
# Make sure that creating a sweeper object with a collocation object with right_is_node=False and do_coll_update=False throws an exception
235+
#
236+
def test_norightnode_collupdate_fails(self):
237+
self.swparams['collocation_class'] = collclass.CollGaussLegendre
238+
self.swparams['do_coll_update'] = False
239+
# Has to throw an exception
240+
with self.assertRaises(AssertionError):
241+
step, level, problem, nnodes = self.setupLevelStepProblem()

0 commit comments

Comments
 (0)