diff --git a/.doctrees/environment.pickle b/.doctrees/environment.pickle index b2470932d0..088a9fc04e 100644 Binary files a/.doctrees/environment.pickle and b/.doctrees/environment.pickle differ diff --git a/.doctrees/projects/Hamiltonian.doctree b/.doctrees/projects/Hamiltonian.doctree index a1394e5b52..71113db5a2 100644 Binary files a/.doctrees/projects/Hamiltonian.doctree and b/.doctrees/projects/Hamiltonian.doctree differ diff --git a/.doctrees/projects/Resilience.doctree b/.doctrees/projects/Resilience.doctree index 5d2560393a..51d3dfc4e9 100644 Binary files a/.doctrees/projects/Resilience.doctree and b/.doctrees/projects/Resilience.doctree differ diff --git a/.doctrees/projects/doc_fput.doctree b/.doctrees/projects/doc_fput.doctree index ba8c8dfb8c..8fa6ac165e 100644 Binary files a/.doctrees/projects/doc_fput.doctree and b/.doctrees/projects/doc_fput.doctree differ diff --git a/.doctrees/pySDC/implementations.convergence_controller_classes.step_size_limiter.doctree b/.doctrees/pySDC/implementations.convergence_controller_classes.step_size_limiter.doctree index a6df5c0506..d87815938f 100644 Binary files a/.doctrees/pySDC/implementations.convergence_controller_classes.step_size_limiter.doctree and b/.doctrees/pySDC/implementations.convergence_controller_classes.step_size_limiter.doctree differ diff --git a/.doctrees/pySDC/implementations.problem_classes.generic_spectral.doctree b/.doctrees/pySDC/implementations.problem_classes.generic_spectral.doctree index 3e3d5d4841..e0d379dd3b 100644 Binary files a/.doctrees/pySDC/implementations.problem_classes.generic_spectral.doctree and b/.doctrees/pySDC/implementations.problem_classes.generic_spectral.doctree differ diff --git a/.doctrees/tutorial/doc_step_2_C.doctree b/.doctrees/tutorial/doc_step_2_C.doctree index c09d9cacec..ccde54e2da 100644 Binary files a/.doctrees/tutorial/doc_step_2_C.doctree and b/.doctrees/tutorial/doc_step_2_C.doctree differ diff --git a/.doctrees/tutorial/doc_step_3_B.doctree b/.doctrees/tutorial/doc_step_3_B.doctree index 921539ac39..e711d59784 100644 Binary files a/.doctrees/tutorial/doc_step_3_B.doctree and b/.doctrees/tutorial/doc_step_3_B.doctree differ diff --git a/.doctrees/tutorial/doc_step_4_D.doctree b/.doctrees/tutorial/doc_step_4_D.doctree index cb4d10f0e8..8c303e4919 100644 Binary files a/.doctrees/tutorial/doc_step_4_D.doctree and b/.doctrees/tutorial/doc_step_4_D.doctree differ diff --git a/.doctrees/tutorial/doc_step_7_A.doctree b/.doctrees/tutorial/doc_step_7_A.doctree index 8c92d6dda0..935450725f 100644 Binary files a/.doctrees/tutorial/doc_step_7_A.doctree and b/.doctrees/tutorial/doc_step_7_A.doctree differ diff --git a/.doctrees/tutorial/doc_step_7_B.doctree b/.doctrees/tutorial/doc_step_7_B.doctree index 4f28ab76f4..643f06aa94 100644 Binary files a/.doctrees/tutorial/doc_step_7_B.doctree and b/.doctrees/tutorial/doc_step_7_B.doctree differ diff --git a/.doctrees/tutorial/doc_step_7_C.doctree b/.doctrees/tutorial/doc_step_7_C.doctree index 392b053107..ecfac1c411 100644 Binary files a/.doctrees/tutorial/doc_step_7_C.doctree and b/.doctrees/tutorial/doc_step_7_C.doctree differ diff --git a/.doctrees/tutorial/doc_step_7_D.doctree b/.doctrees/tutorial/doc_step_7_D.doctree index fb026f56ad..62676c64c0 100644 Binary files a/.doctrees/tutorial/doc_step_7_D.doctree and b/.doctrees/tutorial/doc_step_7_D.doctree differ diff --git a/.doctrees/tutorial/doc_step_8_C.doctree b/.doctrees/tutorial/doc_step_8_C.doctree index b94037f6d4..86164a5fb8 100644 Binary files a/.doctrees/tutorial/doc_step_8_C.doctree and b/.doctrees/tutorial/doc_step_8_C.doctree differ diff --git a/.doctrees/tutorial/step_2.doctree b/.doctrees/tutorial/step_2.doctree index f7251a65a0..046f5f2c1e 100644 Binary files a/.doctrees/tutorial/step_2.doctree and b/.doctrees/tutorial/step_2.doctree differ diff --git a/.doctrees/tutorial/step_3.doctree b/.doctrees/tutorial/step_3.doctree index 4c0074644a..5ce8bfe4f1 100644 Binary files a/.doctrees/tutorial/step_3.doctree and b/.doctrees/tutorial/step_3.doctree differ diff --git a/.doctrees/tutorial/step_4.doctree b/.doctrees/tutorial/step_4.doctree index 1e88fa5002..bb289fa72e 100644 Binary files a/.doctrees/tutorial/step_4.doctree and b/.doctrees/tutorial/step_4.doctree differ diff --git a/.doctrees/tutorial/step_7.doctree b/.doctrees/tutorial/step_7.doctree index 944a3846ca..5f7ac61ede 100644 Binary files a/.doctrees/tutorial/step_7.doctree and b/.doctrees/tutorial/step_7.doctree differ diff --git a/.doctrees/tutorial/step_8.doctree b/.doctrees/tutorial/step_8.doctree index d19041b0de..10fe6d41c4 100644 Binary files a/.doctrees/tutorial/step_8.doctree and b/.doctrees/tutorial/step_8.doctree differ diff --git a/_images/coverage-badge.svg b/_images/coverage-badge.svg index ba9b89aa6b..31d7f6663b 100644 --- a/_images/coverage-badge.svg +++ b/_images/coverage-badge.svg @@ -1 +1 @@ -coverage: 78.54%coverage78.54% \ No newline at end of file +coverage: 77.97%coverage77.97% \ No newline at end of file diff --git a/_images/timings_SDC_variants_Fisher.png b/_images/timings_SDC_variants_Fisher.png index 56d1a16d2d..e7aa0f78b2 100644 Binary files a/_images/timings_SDC_variants_Fisher.png and b/_images/timings_SDC_variants_Fisher.png differ diff --git a/_images/timings_SDC_variants_GrayScott.png b/_images/timings_SDC_variants_GrayScott.png index 6ac6b434fd..44ab145c41 100644 Binary files a/_images/timings_SDC_variants_GrayScott.png and b/_images/timings_SDC_variants_GrayScott.png differ diff --git a/_modules/helpers/plot_helper.html b/_modules/helpers/plot_helper.html index 34cb13e11b..9cc4163372 100644 --- a/_modules/helpers/plot_helper.html +++ b/_modules/helpers/plot_helper.html @@ -87,11 +87,13 @@

Source code for helpers.plot_helper

         'JSC_beamer': 426.79135,
         'Springer_Numerical_Algorithms': 338.58778,
         'JSC_thesis': 434.26027,
+        'TUHH_thesis': 426.79135,
     }
     # store text height in points here, get this from LaTeX using \the\textheight
     textheights = {
         'JSC_beamer': 214.43411,
         'JSC_thesis': 635.5,
+        'TUHH_thesis': 631.65118,
     }
     assert (
         journal in textwidths.keys()
diff --git a/_modules/helpers/pysdc_helper.html b/_modules/helpers/pysdc_helper.html
index 2af5ed34d3..01296c72fd 100644
--- a/_modules/helpers/pysdc_helper.html
+++ b/_modules/helpers/pysdc_helper.html
@@ -56,7 +56,7 @@ 

Source code for helpers.pysdc_helper

 
     def __setattr__(self, key, value):
         """
-        Function called when setting arttributes
+        Function called when setting attributes
 
         Args:
             key: the attribute
@@ -76,7 +76,7 @@ 

Source code for helpers.pysdc_helper

         if key in self.attrs:
             return None
         else:
-            super().__getattr__(key)
+            super().__getattribute__(key)
 
 
[docs] diff --git a/_modules/implementations/convergence_controller_classes/step_size_limiter.html b/_modules/implementations/convergence_controller_classes/step_size_limiter.html index ec8233c51d..7058de4398 100644 --- a/_modules/implementations/convergence_controller_classes/step_size_limiter.html +++ b/_modules/implementations/convergence_controller_classes/step_size_limiter.html @@ -204,7 +204,7 @@

Source code for implementations.convergence_controller_classes.step_size_lim S, ) L.status.dt_new = dt_new - elif abs(L.status.dt_new / L.params.dt - 1) < self.params.dt_rel_min_slope: + elif abs(L.status.dt_new / L.params.dt - 1) < self.params.dt_rel_min_slope and not S.status.restart: L.status.dt_new = L.params.dt self.log( f"Step size did not change sufficiently to warrant step size change, keeping {L.status.dt_new:.2e}", @@ -214,6 +214,79 @@

Source code for implementations.convergence_controller_classes.step_size_lim return None

+ + +
+[docs] +class StepSizeRounding(ConvergenceController): + """ + Class to round step size when using adaptive step size selection. + """ + +
+[docs] + def setup(self, controller, params, description, **kwargs): + """ + Define parameters here + + Args: + controller (pySDC.Controller): The controller + params (dict): The params passed for this specific convergence controller + description (dict): The description object used to instantiate the controller + + Returns: + (dict): The updated params dictionary + """ + defaults = { + "control_order": +93, + "digits": 1, + "fac": 5, + } + return {**defaults, **super().setup(controller, params, description, **kwargs)}
+ + + @staticmethod + def _round_step_size(dt, fac, digits): + dt_rounded = None + exponent = np.log10(dt) // 1 + + dt_norm = dt / 10 ** (exponent - digits) + dt_norm_round = (dt_norm // fac) * fac + dt_rounded = dt_norm_round * 10 ** (exponent - digits) + return dt_rounded + +
+[docs] + def get_new_step_size(self, controller, S, **kwargs): + """ + Enforce an upper and lower limit to the step size here. + Be aware that this is only tested when a new step size has been determined. That means if you set an initial + value for the step size outside of the limits, and you don't do any further step size control, that value will + go through. + Also, the final step is adjusted such that we reach Tend as best as possible, which might give step sizes below + the lower limit set here. + + Args: + controller (pySDC.Controller): The controller + S (pySDC.Step): The current step + + Returns: + None + """ + for L in S.levels: + if L.status.dt_new is not None: + dt_rounded = self._round_step_size(L.status.dt_new, self.params.fac, self.params.digits) + + if L.status.dt_new != dt_rounded: + self.log( + f"Step size rounded from {L.status.dt_new:.6e} to {dt_rounded:.6e}", + S, + ) + L.status.dt_new = dt_rounded + + return None
+
+
diff --git a/_modules/implementations/problem_classes/generic_spectral.html b/_modules/implementations/problem_classes/generic_spectral.html index f97a893e4b..1e62be988a 100644 --- a/_modules/implementations/problem_classes/generic_spectral.html +++ b/_modules/implementations/problem_classes/generic_spectral.html @@ -450,6 +450,31 @@

Source code for implementations.problem_classes.generic_spectral

return None
+ + +
+[docs] +def get_extrapolated_error_DAE(self, S, **kwargs): + """ + The extrapolation estimate combines values of u and f from multiple steps to extrapolate and compare to the + solution obtained by the time marching scheme. This function can be used in `EstimateExtrapolationError`. + + Args: + S (pySDC.Step): The current step + + Returns: + None + """ + u_ex = self.get_extrapolated_solution(S) + diff_mask = S.levels[0].prob.diff_mask + if u_ex is not None: + S.levels[0].status.error_extrapolation_estimate = ( + abs((u_ex - S.levels[0].u[-1])[diff_mask]) * self.coeff.prefactor + ) + # print([abs(me) for me in (u_ex - S.levels[0].u[-1]) * self.coeff.prefactor]) + else: + S.levels[0].status.error_extrapolation_estimate = None
+
diff --git a/_modules/implementations/sweeper_classes/Runge_Kutta.html b/_modules/implementations/sweeper_classes/Runge_Kutta.html index c4fe7be81f..a61a940042 100644 --- a/_modules/implementations/sweeper_classes/Runge_Kutta.html +++ b/_modules/implementations/sweeper_classes/Runge_Kutta.html @@ -526,9 +526,12 @@

Source code for implementations.sweeper_classes.Runge_Kutta

rhs += lvl.dt * (self.QI[m + 1, j] * lvl.f[j].impl + self.QE[m + 1, j] * lvl.f[j].expl) # implicit solve with prefactor stemming from the diagonal of Qd, use previous stage as initial guess - lvl.u[m + 1][:] = prob.solve_system( - rhs, lvl.dt * self.QI[m + 1, m + 1], lvl.u[m], lvl.time + lvl.dt * self.coll.nodes[m + 1] - ) + if self.QI[m + 1, m + 1] != 0: + lvl.u[m + 1][:] = prob.solve_system( + rhs, lvl.dt * self.QI[m + 1, m + 1], lvl.u[m], lvl.time + lvl.dt * self.coll.nodes[m + 1] + ) + else: + lvl.u[m + 1][:] = rhs[:] # update function values (we don't usually need to evaluate the RHS at the solution of the step) if m < M - self.coll.num_solution_stages or self.params.eval_rhs_at_right_boundary: diff --git a/coverage/class_index.html b/coverage/class_index.html index 21d6b61e0e..0a739af3f5 100644 --- a/coverage/class_index.html +++ b/coverage/class_index.html @@ -11,7 +11,7 @@

Coverage report: - 79% + 78%

@@ -373,7 +373,7 @@

(no class) 33 2 - 38 + 40 94% @@ -912,13 +912,21 @@

1 100% + + pySDC/implementations/convergence_controller_classes/step_size_limiter.py + StepSizeRounding + 15 + 9 + 1 + 40% + pySDC/implementations/convergence_controller_classes/step_size_limiter.py (no class) - 9 + 14 0 0 - 100% + 100% pySDC/implementations/convergence_controller_classes/store_uold.py @@ -2268,9 +2276,9 @@

pySDC/implementations/problem_classes/Van_der_Pol_implicit.py vanderpol 46 + 3 2 - 2 - 96% + 93% pySDC/implementations/problem_classes/Van_der_Pol_implicit.py @@ -2515,10 +2523,10 @@

pySDC/implementations/problem_classes/generic_spectral.py (no class) - 59 - 43 + 65 + 48 3 - 27% + 26% pySDC/implementations/problem_classes/nonlinear_ODE_1.py @@ -2675,78 +2683,78 @@

pySDC/implementations/sweeper_classes/Runge_Kutta.py RungeKuttaIMEX - 33 + 35 8 0 - 76% + 77% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - Heun_Euler + pySDC/implementations/sweeper_classes/Runge_Kutta.py + Heun_Euler 1 0 0 100% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - Cash_Karp + pySDC/implementations/sweeper_classes/Runge_Kutta.py + Cash_Karp 1 0 0 100% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - DIRK43 + pySDC/implementations/sweeper_classes/Runge_Kutta.py + DIRK43 1 0 0 100% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - ESDIRK53 + pySDC/implementations/sweeper_classes/Runge_Kutta.py + ESDIRK53 1 0 0 100% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - ESDIRK43 + pySDC/implementations/sweeper_classes/Runge_Kutta.py + ESDIRK43 1 0 0 100% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - ARK548L2SAERK + pySDC/implementations/sweeper_classes/Runge_Kutta.py + ARK548L2SAERK 1 0 0 100% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - ARK54 + pySDC/implementations/sweeper_classes/Runge_Kutta.py + ARK54 1 0 0 100% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - ARK548L2SAESDIRK2 + pySDC/implementations/sweeper_classes/Runge_Kutta.py + ARK548L2SAESDIRK2 1 0 0 100% - pySDC/implementations/sweeper_classes/Runge_Kutta.py - ARK548L2SA + pySDC/implementations/sweeper_classes/Runge_Kutta.py + ARK548L2SA 1 0 0 @@ -4232,6 +4240,22 @@

23 100% + + pySDC/projects/Resilience/RBC.py + ReachTendExactly + 12 + 0 + 0 + 100% + + + pySDC/projects/Resilience/RBC.py + (no class) + 175 + 152 + 3 + 13% + pySDC/projects/Resilience/Schroedinger.py (no class) @@ -4321,20 +4345,20 @@

98% - pySDC/projects/Resilience/fault_stats.py - FaultStats - 311 - 108 + pySDC/projects/Resilience/fault_stats.py + FaultStats + 313 + 110 587 - 65% + 65% pySDC/projects/Resilience/fault_stats.py (no class) - 126 - 73 + 131 + 77 69 - 42% + 41% pySDC/projects/Resilience/heat.py @@ -4381,7 +4405,7 @@

(no class) 26 26 - 509 + 573 0% @@ -4403,178 +4427,178 @@

pySDC/projects/Resilience/strategies.py Strategy - 104 - 33 + 113 + 42 4 - 68% + 63% - pySDC/projects/Resilience/strategies.py - InexactBaseStrategy + pySDC/projects/Resilience/strategies.py + InexactBaseStrategy 37 13 0 65% - pySDC/projects/Resilience/strategies.py - BaseStrategy + pySDC/projects/Resilience/strategies.py + BaseStrategy 22 4 0 82% - pySDC/projects/Resilience/strategies.py - AdaptivityStrategy - 50 - 13 + pySDC/projects/Resilience/strategies.py + AdaptivityStrategy + 54 + 16 1 - 74% + 70% - pySDC/projects/Resilience/strategies.py - AdaptivityRestartFirstStep + pySDC/projects/Resilience/strategies.py + AdaptivityRestartFirstStep 8 8 0 0% - pySDC/projects/Resilience/strategies.py - AdaptiveHotRodStrategy + pySDC/projects/Resilience/strategies.py + AdaptiveHotRodStrategy 30 5 1 83% - pySDC/projects/Resilience/strategies.py - IterateStrategy - 37 - 12 + pySDC/projects/Resilience/strategies.py + IterateStrategy + 39 + 14 1 - 68% + 64% - pySDC/projects/Resilience/strategies.py - kAdaptivityStrategy - 25 - 12 + pySDC/projects/Resilience/strategies.py + kAdaptivityStrategy + 30 + 16 0 - 52% + 47% - pySDC/projects/Resilience/strategies.py - HotRodStrategy - 58 - 29 + pySDC/projects/Resilience/strategies.py + HotRodStrategy + 61 + 32 1 - 50% + 48% - pySDC/projects/Resilience/strategies.py - AdaptivityCollocationStrategy + pySDC/projects/Resilience/strategies.py + AdaptivityCollocationStrategy 35 13 1 63% - pySDC/projects/Resilience/strategies.py - AdaptivityCollocationTypeStrategy + pySDC/projects/Resilience/strategies.py + AdaptivityCollocationTypeStrategy 11 2 0 82% - pySDC/projects/Resilience/strategies.py - AdaptivityCollocationRefinementStrategy + pySDC/projects/Resilience/strategies.py + AdaptivityCollocationRefinementStrategy 11 2 0 82% - pySDC/projects/Resilience/strategies.py - AdaptivityCollocationDerefinementStrategy + pySDC/projects/Resilience/strategies.py + AdaptivityCollocationDerefinementStrategy 11 2 0 82% - pySDC/projects/Resilience/strategies.py - DIRKStrategy + pySDC/projects/Resilience/strategies.py + DIRKStrategy 30 6 0 80% - pySDC/projects/Resilience/strategies.py - ARKStrategy - 26 - 2 + pySDC/projects/Resilience/strategies.py + ARKStrategy + 29 + 3 0 - 92% + 90% - pySDC/projects/Resilience/strategies.py - ESDIRKStrategy + pySDC/projects/Resilience/strategies.py + ESDIRKStrategy 35 10 0 71% - pySDC/projects/Resilience/strategies.py - ERKStrategy + pySDC/projects/Resilience/strategies.py + ERKStrategy 25 10 0 60% - pySDC/projects/Resilience/strategies.py - DoubleAdaptivityStrategy + pySDC/projects/Resilience/strategies.py + DoubleAdaptivityStrategy 27 3 0 89% - pySDC/projects/Resilience/strategies.py - AdaptivityAvoidRestartsStrategy + pySDC/projects/Resilience/strategies.py + AdaptivityAvoidRestartsStrategy 13 2 0 85% - pySDC/projects/Resilience/strategies.py - AdaptivityInterpolationStrategy + pySDC/projects/Resilience/strategies.py + AdaptivityInterpolationStrategy 15 15 0 0% - pySDC/projects/Resilience/strategies.py - AdaptivityExtrapolationWithinQStrategy + pySDC/projects/Resilience/strategies.py + AdaptivityExtrapolationWithinQStrategy 40 14 1 65% - pySDC/projects/Resilience/strategies.py - AdaptivityPolynomialError - 70 - 34 + pySDC/projects/Resilience/strategies.py + AdaptivityPolynomialError + 82 + 42 1 - 51% + 49% pySDC/projects/Resilience/strategies.py @@ -4627,10 +4651,10 @@

pySDC/projects/Resilience/work_precision.py (no class) - 348 - 348 - 464 - 0% + 358 + 358 + 465 + 0% pySDC/projects/SDC_showdown/SDC_timing_Fisher.py @@ -5252,9 +5276,9 @@

pySDC/projects/soft_failure/generate_statistics.py (no class) 199 - 49 + 50 16 - 75% + 75% pySDC/projects/soft_failure/implicit_sweeper_faults.py @@ -5268,9 +5292,9 @@

pySDC/projects/soft_failure/implicit_sweeper_faults.py implicit_sweeper_faults 115 - 5 + 8 0 - 96% + 93% pySDC/projects/soft_failure/implicit_sweeper_faults.py @@ -5565,10 +5589,10 @@

Total   - 27637 - 5931 - 5304 - 79% + 27907 + 6148 + 5375 + 78% @@ -5581,7 +5605,7 @@

coverage.py v7.6.3, - created at 2024-10-21 10:32 +0000 + created at 2024-10-21 15:25 +0000

diff --git a/coverage/z_020efe120a771d8a_hamiltonian_and_energy_output_py.html b/coverage/z_020efe120a771d8a_hamiltonian_and_energy_output_py.html index 4c94cc2f58..58023c802e 100644 --- a/coverage/z_020efe120a771d8a_hamiltonian_and_energy_output_py.html +++ b/coverage/z_020efe120a771d8a_hamiltonian_and_energy_output_py.html @@ -65,7 +65,7 @@

» next       coverage.py v7.6.3, - created at 2024-10-21 10:32 +0000 + created at 2024-10-21 15:25 +0000