Coverage for pySDC/projects/FastWaveSlowWave/HookClass_boussinesq.py: 0%

11 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-16 14:51 +0000

1from pySDC.core.hooks import Hooks 

2 

3 

4class gmres_tolerance(Hooks): 

5 def pre_iteration(self, step, level_number): 

6 """ 

7 Routine called before iteration starts, set new GMRES tolerance depending on the initial SDC residual 

8 

9 Args: 

10 step (pySDC.Step.step): the current step 

11 level_number (int): the current level number 

12 """ 

13 super(gmres_tolerance, self).pre_iteration(step, level_number) 

14 

15 L = step.levels[level_number] 

16 L.sweep.compute_residual() 

17 L.prob.gmres_tol_limit = max(L.status.residual * L.prob.gmres_tol_factor, L.prob.gmres_tol_limit) 

18 

19 def post_sweep(self, step, level_number): 

20 """ 

21 Routine called after each sweep, set new GMRES tolerance depending on the previous SDC residual 

22 

23 Args: 

24 step (pySDC.Step.step): the current step 

25 level_number (int): the current level number 

26 """ 

27 

28 super(gmres_tolerance, self).post_sweep(step, level_number) 

29 

30 L = step.levels[level_number] 

31 

32 L.prob.gmres_tol_limit = max(L.status.residual * L.prob.gmres_tol_factor, L.prob.gmres_tol_limit)