Coverage for pySDC/implementations/convergence_controller_classes/store_uold.py: 100%
11 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-29 09:02 +0000
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-29 09:02 +0000
1from pySDC.core.ConvergenceController import ConvergenceController
4class StoreUOld(ConvergenceController):
5 """
6 Class to store the solution of the last iteration in a variable called 'uold' of the levels.
8 Default control order is 90.
9 """
11 def setup(self, controller, params, description, **kwargs):
12 """
13 Define parameters here
15 Args:
16 controller (pySDC.Controller): The controller
17 params (dict): The params passed for this specific convergence controller
18 description (dict): The description object used to instantiate the controller
20 Returns:
21 (dict): The updated params dictionary
22 """
23 return {"control_order": +90, **super().setup(controller, params, description, **kwargs)}
25 def post_iteration_processing(self, controller, S, **kwargs):
26 """
27 Store the solution at the current iteration
29 Args:
30 controller (pySDC.Controller): The controller
31 S (pySDC.Step): The current step
33 Return:
34 None
35 """
36 for L in S.levels:
37 L.uold[:] = L.u[:]
39 return None
41 def post_spread_processing(self, controller, S, **kwargs):
42 """
43 Store the initial conditions in u_old in the spread phase.
45 Args:
46 controller (pySDC.Controller): The controller
47 S (pySDC.Step): The current step
49 Return:
50 None
51 """
52 self.post_iteration_processing(controller, S, **kwargs)
53 return None