From c8d00d90559e977de7e5df7f55c533ced1f55620 Mon Sep 17 00:00:00 2001 From: David Wells Date: Wed, 8 Jun 2022 14:00:06 -0400 Subject: [PATCH] Use stricter timestep limits in an ARKODE test. For whatever reason this test is less stable than the others. Setting bounds on the timesteps makes this pass on more configurations with the same output. --- tests/sundials/arkode_03.cc | 15 +++++++++++++++ tests/sundials/arkode_03.output | 20 ++++++++++---------- tests/sundials/arkode_03_in.prm | 8 ++++---- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/tests/sundials/arkode_03.cc b/tests/sundials/arkode_03.cc index b6a54046b0..ba63b093b0 100644 --- a/tests/sundials/arkode_03.cc +++ b/tests/sundials/arkode_03.cc @@ -20,6 +20,8 @@ #include +#include + #include "../tests.h" @@ -100,6 +102,19 @@ main() return 0; }; + // This test, for reasons I don't fully understand, generates some output + // which varies between environments much more than the other ARKODE + // tests. Work around it by setting a fairly stringent maximum time step. + ode.custom_setup = [&](void *arkode_mem) -> int { + int ierr = ARKStepSetMinStep(arkode_mem, 1e-8); + AssertThrow(ierr == 0, ExcInternalError()); + ierr = ARKStepSetMaxStep(arkode_mem, 1e-4); + AssertThrow(ierr == 0, ExcInternalError()); + ierr = ARKStepSetMaxNumSteps(arkode_mem, 5000); + AssertThrow(ierr == 0, ExcInternalError()); + return 0; + }; + VectorType y(3); y[0] = u0; y[1] = v0; diff --git a/tests/sundials/arkode_03.output b/tests/sundials/arkode_03.output index 4d8a78f72d..3a7fb961fa 100644 --- a/tests/sundials/arkode_03.output +++ b/tests/sundials/arkode_03.output @@ -1,12 +1,12 @@ DEAL::0.00000 3.900000000 1.100000000 2.800000000 -DEAL::1.000000000 2.075274578 1.059601971 2.499947382 -DEAL::2.000000000 1.100460018 1.723610111 2.499972220 -DEAL::3.000000000 0.7896202372 2.326668043 2.499980117 -DEAL::4.000000000 0.8117726433 2.725583965 2.499984008 -DEAL::5.000000000 1.187002916 2.595541878 2.499971084 -DEAL::6.000000000 1.887311324 1.494098057 2.499930049 -DEAL::7.000000000 1.323271341 1.619016372 2.499966501 -DEAL::8.000000000 0.9217874641 2.130219386 2.499975040 -DEAL::9.000000000 0.8495425770 2.539475069 2.499979558 -DEAL::10.00000000 1.064969831 2.595955794 2.499973382 +DEAL::1.000000000 2.075274578 1.059601971 2.499948104 +DEAL::2.000000000 1.100460018 1.723610111 2.499972489 +DEAL::3.000000000 0.7896202372 2.326668043 2.499980186 +DEAL::4.000000000 0.8117726432 2.725583965 2.499979565 +DEAL::5.000000000 1.187002916 2.595541878 2.499970331 +DEAL::6.000000000 1.887311324 1.494098057 2.499952819 +DEAL::7.000000000 1.323271341 1.619016372 2.499966920 +DEAL::8.000000000 0.9217874641 2.130219386 2.499976990 +DEAL::9.000000000 0.8495425770 2.539475069 2.499978832 +DEAL::10.00000000 1.064969831 2.595955794 2.499973393 diff --git a/tests/sundials/arkode_03_in.prm b/tests/sundials/arkode_03_in.prm index f035bb5164..a412b2b72f 100644 --- a/tests/sundials/arkode_03_in.prm +++ b/tests/sundials/arkode_03_in.prm @@ -4,16 +4,16 @@ set Time interval between each output = 0.1 subsection Error control # making this tolerance any lower prevents convergence in 5.4: # this is fixed in 6.2 - set Absolute error tolerance = 1e-8 - set Relative error tolerance = 1e-8 + set Absolute error tolerance = 5e-9 + set Relative error tolerance = 5e-9 end subsection Running parameters set Implicit function is linear = true set Implicit function is time independent = true set Initial step size = 1e-6 - set Maximum number of nonlinear iterations = 30 + set Maximum number of nonlinear iterations = 50 set Maximum order of ARK = 5 set Minimum step size = 1e-7 # A larger subspace, combined with looser tolerances, are required by 5.4 - set Anderson-acceleration subspace = 5 + set Anderson-acceleration subspace = 10 end -- 2.39.5