]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix another SUNDIALS 6 incompatibility. 13918/head
authorDavid Wells <drwells@email.unc.edu>
Mon, 6 Jun 2022 18:24:43 +0000 (14:24 -0400)
committerDavid Wells <drwells@email.unc.edu>
Mon, 6 Jun 2022 18:24:43 +0000 (14:24 -0400)
Technically this is a bug in our use case - it doesn't make sense to evolve an
ODE past the provided end time.

source/sundials/arkode.cc
tests/sundials/arkode_repeated_solve.cc
tests/sundials/arkode_repeated_solve.output
tests/sundials/arkode_repeated_solve_in.prm

index 9849519f2e560e708bb823d6b4d261e04c6c9312..c72141037ca424493ff4637ce1399b02fe187234 100644 (file)
@@ -346,6 +346,16 @@ namespace SUNDIALS
                       solution,
                       time.get_step_number());
       }
+    else
+      {
+        // If we don't do a full reset then we still need to fix the end time.
+        // In SUNDIALS 6 and later, SUNDIALS will not do timesteps if the
+        // current time is past the set end point (i.e., ARKStepEvolve will
+        // return ARK_TSTOP_RETURN).
+        const int status = ARKStepSetStopTime(arkode_mem, time.get_end_time());
+        (void)status;
+        AssertARKode(status);
+      }
 
     auto solution_nvector = internal::make_nvector_view(solution
 #  if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
index e63f78304637477344b8e699a1605d7de6c5c6b1..a2649ba339098a61f5640de4e23c7869488a1954 100644 (file)
@@ -51,7 +51,8 @@ create_solver()
   ode->output_step = [&](const double       t,
                          const VectorType & sol,
                          const unsigned int step_number) -> int {
-    deallog << t << ' ' << sol[0] << ' ' << sol[1] << std::endl;
+    deallog << std::setprecision(16) << t << ' ' << sol[0] << ' ' << sol[1]
+            << std::endl;
     return 0;
   };
   return ode;
index 3f6116f868729e675c3784a080d03592259a538c..061adaf202941ba068f2745880b04099201f52b0 100644 (file)
 
-DEAL::0.00000 0.00000 1.00000
-DEAL::0.100000 0.0998334 0.995004
-DEAL::0.200000 0.198669 0.980067
-DEAL::0.300000 0.295521 0.955336
-DEAL::0.400000 0.389420 0.921060
-DEAL::0.500000 0.479426 0.877583
-DEAL::0.600000 0.564643 0.825335
-DEAL::0.700000 0.644219 0.764841
-DEAL::0.800000 0.717356 0.696707
-DEAL::0.900000 0.783330 0.621606
-DEAL::1.00000 0.841478 0.540292
-DEAL::1.10000 0.891214 0.453587
-DEAL::1.20000 0.932042 0.362356
-DEAL::1.30000 0.963560 0.267498
-DEAL::1.40000 0.985452 0.169958
-DEAL::1.50000 0.997498 0.0707265
-DEAL::1.60000 0.999576 -0.0292043
-DEAL::1.70000 0.991667 -0.128845
-DEAL::1.80000 0.973849 -0.227205
-DEAL::1.90000 0.946302 -0.323292
-DEAL::2.00000 0.909300 -0.416148
+DEAL::0.000000000000000 0.000000000000000 1.000000000000000
+DEAL::0.1000000000000000 0.09983342048370678 0.9950041648151554
+DEAL::0.2000000000000000 0.1986693340976245 0.9800665772561309
+DEAL::0.3000000000000000 0.2955202094535971 0.9553364885180363
+DEAL::0.4000000000000000 0.3894183446361489 0.9210609934622588
+DEAL::0.5000000000000000 0.4794255405318394 0.8775825614906699
+DEAL::0.6000000000000000 0.5646424750037689 0.8253356147047274
+DEAL::0.7000000000000000 0.6442176886201780 0.7648421873037656
+DEAL::0.7999999999999999 0.7173560921547424 0.6967067095923436
+DEAL::0.8999999999999999 0.7833269108544605 0.6216099687131261
+DEAL::0.9999999999999999 0.8414709860986708 0.5403023064476528
+DEAL::1.100000000000000 0.8912073614934606 0.4535961220503129
+DEAL::1.200000000000000 0.9320390875947615 0.3623577550275560
+DEAL::1.300000000000000 0.9635581872579762 0.2674988290028678
+DEAL::1.400000000000000 0.9854497320342321 0.1699671430176150
+DEAL::1.500000000000000 0.9974949888249982 0.07073720143885316
+DEAL::1.600000000000000 0.9995736053875207 -0.02919952295447363
+DEAL::1.700000000000000 0.9916648128551802 -0.1288444954401037
+DEAL::1.800000000000000 0.9738476332536075 -0.2272020963817117
+DEAL::1.900000000000001 0.9463000899391015 -0.3232895691316534
+DEAL::2.000000000000000 0.9092974293812843 -0.4161468378514534
 DEAL::First solve done
-DEAL::0.00000 0.00000 1.00000
-DEAL::0.100000 0.0998334 0.995004
-DEAL::0.200000 0.198669 0.980067
-DEAL::0.300000 0.295521 0.955336
-DEAL::0.400000 0.389420 0.921060
-DEAL::0.500000 0.479426 0.877583
-DEAL::0.600000 0.564643 0.825335
-DEAL::0.700000 0.644219 0.764841
-DEAL::0.800000 0.717356 0.696707
-DEAL::0.900000 0.783330 0.621606
-DEAL::1.00000 0.841478 0.540292
-DEAL::1.10000 0.891214 0.453587
-DEAL::1.20000 0.932042 0.362356
-DEAL::1.30000 0.963560 0.267498
-DEAL::1.40000 0.985452 0.169958
-DEAL::1.50000 0.997498 0.0707265
-DEAL::1.60000 0.999576 -0.0292043
-DEAL::1.70000 0.991667 -0.128845
-DEAL::1.80000 0.973849 -0.227205
-DEAL::1.90000 0.946302 -0.323292
-DEAL::2.00000 0.909300 -0.416148
+DEAL::0.000000000000000 0.000000000000000 1.000000000000000
+DEAL::0.1000000000000000 0.09983342048370678 0.9950041648151554
+DEAL::0.2000000000000000 0.1986693340976245 0.9800665772561309
+DEAL::0.3000000000000000 0.2955202094535971 0.9553364885180363
+DEAL::0.4000000000000000 0.3894183446361489 0.9210609934622588
+DEAL::0.5000000000000000 0.4794255405318394 0.8775825614906699
+DEAL::0.6000000000000000 0.5646424750037689 0.8253356147047274
+DEAL::0.7000000000000000 0.6442176886201780 0.7648421873037656
+DEAL::0.7999999999999999 0.7173560921547424 0.6967067095923436
+DEAL::0.8999999999999999 0.7833269108544605 0.6216099687131261
+DEAL::0.9999999999999999 0.8414709860986708 0.5403023064476528
+DEAL::1.100000000000000 0.8912073614934606 0.4535961220503129
+DEAL::1.200000000000000 0.9320390875947615 0.3623577550275560
+DEAL::1.300000000000000 0.9635581872579762 0.2674988290028678
+DEAL::1.400000000000000 0.9854497320342321 0.1699671430176150
+DEAL::1.500000000000000 0.9974949888249982 0.07073720143885316
+DEAL::1.600000000000000 0.9995736053875207 -0.02919952295447363
+DEAL::1.700000000000000 0.9916648128551802 -0.1288444954401037
+DEAL::1.800000000000000 0.9738476332536075 -0.2272020963817117
+DEAL::1.900000000000001 0.9463000899391015 -0.3232895691316534
+DEAL::2.000000000000000 0.9092974293812843 -0.4161468378514534
 DEAL::Second solve done
-DEAL::2.10000 0.863210 -0.504849
-DEAL::2.20000 0.808497 -0.588504
-DEAL::2.30000 0.745707 -0.666278
-DEAL::2.40000 0.675463 -0.737397
-DEAL::2.50000 0.598472 -0.801147
-DEAL::2.60000 0.515502 -0.856891
-DEAL::2.70000 0.427379 -0.904075
-DEAL::2.80000 0.334987 -0.942226
-DEAL::2.90000 0.239250 -0.970961
-DEAL::3.00000 0.141118 -0.989995
+DEAL::2.100000000000000 0.8632093684553683 -0.5048461072551343
+DEAL::2.200000000000000 0.8084964043086702 -0.5885011216211814
+DEAL::2.300000000000000 0.7457052117782352 -0.6662760263496602
+DEAL::2.400000000000000 0.6754631801915725 -0.7373937202082199
+DEAL::2.500000000000000 0.5984721445567351 -0.8011436192916422
+DEAL::2.600000000000001 0.5155013731318810 -0.8568887564315812
+DEAL::2.700000000000001 0.4273798813143578 -0.9040721451999901
+DEAL::2.800000000000001 0.3349881492411476 -0.9422223445752042
+DEAL::2.900000000000001 0.2392493264102993 -0.9709581694064077
+DEAL::3.000000000000000 0.1411200084123756 -0.9899925001135254
 DEAL::Solve further than final time done
-DEAL::0.00000 0.00000 1.00000
-DEAL::0.100000 0.0998334 0.995004
-DEAL::0.200000 0.198669 0.980067
-DEAL::0.300000 0.295521 0.955336
-DEAL::0.400000 0.389420 0.921060
-DEAL::0.500000 0.479426 0.877583
-DEAL::0.600000 0.564643 0.825335
-DEAL::0.700000 0.644219 0.764841
-DEAL::0.800000 0.717356 0.696707
-DEAL::0.900000 0.783330 0.621606
-DEAL::1.00000 0.841478 0.540292
+DEAL::0.000000000000000 0.000000000000000 1.000000000000000
+DEAL::0.1000000000000000 0.09983342048370678 0.9950041648151554
+DEAL::0.2000000000000000 0.1986693340976245 0.9800665772561309
+DEAL::0.3000000000000000 0.2955202094535971 0.9553364885180363
+DEAL::0.4000000000000000 0.3894183446361489 0.9210609934622588
+DEAL::0.5000000000000000 0.4794255405318394 0.8775825614906699
+DEAL::0.6000000000000000 0.5646424750037689 0.8253356147047274
+DEAL::0.7000000000000000 0.6442176886201780 0.7648421873037656
+DEAL::0.7999999999999999 0.7173560921547424 0.6967067095923436
+DEAL::0.8999999999999999 0.7833269108544605 0.6216099687131261
+DEAL::1.000000000000000 0.8414709860986694 0.5403023064476515
 DEAL::Split solve - part 1 done
-DEAL::1.10000 0.891214 0.453587
-DEAL::1.20000 0.932042 0.362356
-DEAL::1.30000 0.963560 0.267498
-DEAL::1.40000 0.985452 0.169958
-DEAL::1.50000 0.997498 0.0707265
-DEAL::1.60000 0.999576 -0.0292043
-DEAL::1.70000 0.991667 -0.128845
-DEAL::1.80000 0.973849 -0.227205
-DEAL::1.90000 0.946302 -0.323292
-DEAL::2.00000 0.909300 -0.416148
+DEAL::1.100000000000000 0.8912073614934606 0.4535961220503129
+DEAL::1.200000000000000 0.9320390875947616 0.3623577550275558
+DEAL::1.300000000000000 0.9635581872579760 0.2674988290028675
+DEAL::1.400000000000000 0.9854497320342320 0.1699671430176147
+DEAL::1.500000000000000 0.9974949888249981 0.07073720143885294
+DEAL::1.600000000000001 0.9995736053875205 -0.02919952295447385
+DEAL::1.700000000000001 0.9916648128551804 -0.1288444954401039
+DEAL::1.800000000000001 0.9738476332536070 -0.2272020963817119
+DEAL::1.900000000000001 0.9463000899391015 -0.3232895691316536
+DEAL::2.000000000000000 0.9092974293812843 -0.4161468378514534
 DEAL::Split solve - part 2 done
-DEAL::0.00000 0.00000 1.00000
-DEAL::0.100000 0.0998334 0.995004
-DEAL::0.200000 0.198669 0.980067
-DEAL::0.300000 0.295521 0.955336
-DEAL::0.400000 0.389420 0.921060
-DEAL::0.500000 0.479426 0.877583
-DEAL::0.600000 0.564643 0.825335
-DEAL::0.700000 0.644219 0.764841
-DEAL::0.800000 0.717356 0.696707
-DEAL::0.900000 0.783330 0.621606
-DEAL::1.00000 0.841478 0.540292
-DEAL::1.10000 0.891214 0.453587
-DEAL::1.20000 0.932042 0.362356
-DEAL::1.30000 0.963560 0.267498
-DEAL::1.40000 0.985452 0.169958
-DEAL::1.50000 0.997498 0.0707265
-DEAL::1.60000 0.999576 -0.0292043
-DEAL::1.70000 0.991667 -0.128845
-DEAL::1.80000 0.973849 -0.227205
-DEAL::1.90000 0.946302 -0.323292
-DEAL::2.00000 0.909300 -0.416148
+DEAL::0.000000000000000 0.000000000000000 1.000000000000000
+DEAL::0.1000000000000000 0.09983342048370678 0.9950041648151554
+DEAL::0.2000000000000000 0.1986693340976245 0.9800665772561309
+DEAL::0.3000000000000000 0.2955202094535971 0.9553364885180363
+DEAL::0.4000000000000000 0.3894183446361489 0.9210609934622588
+DEAL::0.5000000000000000 0.4794255405318394 0.8775825614906699
+DEAL::0.6000000000000000 0.5646424750037689 0.8253356147047274
+DEAL::0.7000000000000000 0.6442176886201780 0.7648421873037656
+DEAL::0.7999999999999999 0.7173560921547424 0.6967067095923436
+DEAL::0.8999999999999999 0.7833269108544605 0.6216099687131261
+DEAL::0.9999999999999999 0.8414709860986708 0.5403023064476528
+DEAL::1.100000000000000 0.8912073614934606 0.4535961220503129
+DEAL::1.200000000000000 0.9320390875947615 0.3623577550275560
+DEAL::1.300000000000000 0.9635581872579762 0.2674988290028678
+DEAL::1.400000000000000 0.9854497320342321 0.1699671430176150
+DEAL::1.500000000000000 0.9974949888249982 0.07073720143885316
+DEAL::1.600000000000000 0.9995736053875207 -0.02919952295447363
+DEAL::1.700000000000000 0.9916648128551802 -0.1288444954401037
+DEAL::1.800000000000000 0.9738476332536075 -0.2272020963817117
+DEAL::1.900000000000001 0.9463000899391015 -0.3232895691316534
+DEAL::2.000000000000000 0.9092974293812843 -0.4161468378514534
 DEAL::Rerun with single argument call done
-DEAL::0.100000 0.0998334 0.995004
-DEAL::0.200000 0.198669 0.980067
-DEAL::0.300000 0.295521 0.955336
-DEAL::0.400000 0.389420 0.921060
-DEAL::0.500000 0.479426 0.877583
-DEAL::0.600000 0.564643 0.825335
-DEAL::0.700000 0.644219 0.764841
-DEAL::0.800000 0.717356 0.696707
-DEAL::0.900000 0.783330 0.621606
-DEAL::1.00000 0.841478 0.540292
-DEAL::1.10000 0.891214 0.453587
-DEAL::1.20000 0.932042 0.362356
-DEAL::1.30000 0.963560 0.267498
-DEAL::1.40000 0.985452 0.169958
-DEAL::1.50000 0.997498 0.0707265
-DEAL::1.60000 0.999576 -0.0292043
-DEAL::1.70000 0.991667 -0.128845
-DEAL::1.80000 0.973849 -0.227205
-DEAL::1.90000 0.946302 -0.323292
-DEAL::2.00000 0.909300 -0.416148
+DEAL::0.1000000000000000 0.09983341696097162 0.9950041652581183
+DEAL::0.2000000000000000 0.1986693413879923 0.9800665762270833
+DEAL::0.3000000000000000 0.2955202163203371 0.9553364867602949
+DEAL::0.4000000000000000 0.3894183525482616 0.9210609904544820
+DEAL::0.5000000000000000 0.4794255486705832 0.8775825573382786
+DEAL::0.6000000000000000 0.5646424825749274 0.8253356097758897
+DEAL::0.7000000000000000 0.6442176949764787 0.7648421821781130
+DEAL::0.7999999999999999 0.7173560968998428 0.6967067049561305
+DEAL::0.8999999999999999 0.7833269139100103 0.6216099652045708
+DEAL::0.9999999999999999 0.8414709877164632 0.5403023044614421
+DEAL::1.100000000000000 0.8912073621964636 0.4535961215154428
+DEAL::1.200000000000000 0.9320390880345447 0.3623577551747312
+DEAL::1.300000000000000 0.9635581878848255 0.2674988287502407
+DEAL::1.400000000000000 0.9854497329105383 0.1699671416656676
+DEAL::1.500000000000000 0.9974949897648812 0.07073719848909771
+DEAL::1.600000000000000 0.9995736060512689 -0.02919952772931267
+DEAL::1.700000000000000 0.9916648128590909 -0.1288445019669655
+DEAL::1.800000000000000 0.9738476322802048 -0.2272021043012367
+DEAL::1.900000000000001 0.9463000878327641 -0.3232895778530001
+DEAL::2.000000000000000 0.9092974300640930 -0.4161468382093891
index 2bdb712fba385e96d98350e28a2aae9a77ed5eaa..7116f78f15793cb49bc7e75ba889e782e208005e 100644 (file)
@@ -2,12 +2,12 @@ set Final time                        = 2.0
 set Initial time                      = 0
 set Time interval between each output = 0.1
 subsection Error control
-  set Absolute error tolerance = 0.000001
-  set Relative error tolerance = 0.000010
+  set Absolute error tolerance = 1e-8
+  set Relative error tolerance = 1e-8
 end
 subsection Running parameters
-  set Initial step size                      = 0.010000
+  set Initial step size                      = 1e-6
   set Maximum number of nonlinear iterations = 10
   set Maximum order of ARK                   = 5
-  set Minimum step size                      = 0.000001
+  set Minimum step size                      = 1e-7
 end

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.