From 14c60a2129c8cc0bc31ff1a417969f72a507f171 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 27 May 2022 20:43:39 -0400 Subject: [PATCH] Fix the ARKODE 4 test. --- tests/sundials/arkode_04.cc | 22 ++-- tests/sundials/arkode_04.output | 202 ++++++++++++++++---------------- tests/sundials/arkode_04_in.prm | 12 +- 3 files changed, 117 insertions(+), 119 deletions(-) diff --git a/tests/sundials/arkode_04.cc b/tests/sundials/arkode_04.cc index 93b58ce499..30678b58d0 100644 --- a/tests/sundials/arkode_04.cc +++ b/tests/sundials/arkode_04.cc @@ -76,6 +76,7 @@ main(int argc, char **argv) double u0 = 3.9, v0 = 1.1, w0 = 2.8, a = 1.2, b = 2.5, eps = 1e-5; // Explicit jacobian. FullMatrix J(3, 3); + J(2, 2) = -1.0 / eps; ode.implicit_function = [&](double, const VectorType &y, VectorType &ydot) -> int { @@ -94,26 +95,21 @@ main(int argc, char **argv) return 0; }; - ode.solve_jacobian_system = [&](const double t, - const double gamma, - const VectorType &, - const VectorType &, - const VectorType &src, - VectorType & dst) -> int { - J = 0; - J(0, 0) = 1; - J(1, 1) = 1; - J(2, 2) = 1 + gamma / eps; - J.gauss_jordan(); + ode.jacobian_times_vector = [&](const VectorType &src, + VectorType & dst, + double t, + const VectorType & /*y*/, + const VectorType & /*fy*/) -> int { J.vmult(dst, src); + return 0; }; ode.output_step = [&](const double t, const VectorType & sol, const unsigned int step_number) -> int { - deallog << t << ' ' << sol[0] << ' ' << sol[1] << ' ' << sol[2] - << std::endl; + deallog << std::setprecision(16) << t << ' ' << sol[0] << ' ' << sol[1] + << ' ' << sol[2] << std::endl; return 0; }; diff --git a/tests/sundials/arkode_04.output b/tests/sundials/arkode_04.output index 890ce32ab9..9ce42f0c27 100644 --- a/tests/sundials/arkode_04.output +++ b/tests/sundials/arkode_04.output @@ -1,102 +1,102 @@ -DEAL::0 3.9 1.1 2.8 -DEAL::0.1 3.99995 0.720431 2.49989 -DEAL::0.2 3.78894 0.660967 2.49996 -DEAL::0.3 3.52275 0.681501 2.49984 -DEAL::0.4 3.26217 0.72296 2.49995 -DEAL::0.5 3.01935 0.771864 2.49995 -DEAL::0.6 2.79594 0.82467 2.49988 -DEAL::0.7 2.59116 0.880241 2.49998 -DEAL::0.8 2.4037 0.938097 2.49993 -DEAL::0.9 2.23217 0.997959 2.49992 -DEAL::1 2.07527 1.0596 2.49999 -DEAL::1.1 1.93182 1.12281 2.49992 -DEAL::1.2 1.80073 1.18737 2.49995 -DEAL::1.3 1.68106 1.25304 2.49999 -DEAL::1.4 1.57194 1.31959 2.49993 -DEAL::1.5 1.47261 1.38677 2.49997 -DEAL::1.6 1.38237 1.45434 2.49999 -DEAL::1.7 1.3006 1.52203 2.49994 -DEAL::1.8 1.2267 1.58963 2.49998 -DEAL::1.9 1.16015 1.65689 2.49998 -DEAL::2 1.10046 1.72361 2.49996 -DEAL::2.1 1.04715 1.78959 2.49998 -DEAL::2.2 0.999783 1.85466 2.49997 -DEAL::2.3 0.957942 1.91866 2.49997 -DEAL::2.4 0.921233 1.98145 2.49999 -DEAL::2.5 0.889283 2.04291 2.49997 -DEAL::2.6 0.861743 2.10294 2.49998 -DEAL::2.7 0.838291 2.16142 2.49999 -DEAL::2.8 0.818628 2.21827 2.49997 -DEAL::2.9 0.802485 2.27338 2.49998 -DEAL::3 0.78962 2.32667 2.49998 -DEAL::3.1 0.779824 2.37802 2.49998 -DEAL::3.2 0.772919 2.42731 2.49998 -DEAL::3.3 0.768758 2.47441 2.49999 -DEAL::3.4 0.767229 2.51916 2.49998 -DEAL::3.5 0.768257 2.56138 2.5 -DEAL::3.6 0.7718 2.60085 2.49995 -DEAL::3.7 0.777859 2.63733 2.50005 -DEAL::3.8 0.786474 2.67052 2.49999 -DEAL::3.9 0.797733 2.70008 2.49988 -DEAL::4 0.811773 2.72558 2.5001 -DEAL::4.1 0.828789 2.74657 2.5001 -DEAL::4.2 0.84904 2.76245 2.50009 -DEAL::4.3 0.872862 2.77257 2.50012 -DEAL::4.4 0.900673 2.77611 2.49986 -DEAL::4.5 0.932987 2.77216 2.50009 -DEAL::4.6 0.970423 2.75959 2.49999 -DEAL::4.7 1.01371 2.73716 2.50002 -DEAL::4.8 1.06366 2.70339 2.50006 -DEAL::4.9 1.12115 2.65673 2.49999 -DEAL::5 1.187 2.59554 2.49993 -DEAL::5.1 1.26179 2.51839 2.50005 -DEAL::5.2 1.34554 2.42435 2.49986 -DEAL::5.3 1.43719 2.31362 2.50002 -DEAL::5.4 1.53404 2.18823 2.50001 -DEAL::5.5 1.6313 2.05269 2.4999 -DEAL::5.6 1.72208 1.91414 2.49987 -DEAL::5.7 1.79854 1.7815 2.49991 -DEAL::5.8 1.85371 1.66352 2.49995 -DEAL::5.9 1.88345 1.56671 2.49996 -DEAL::6 1.88731 1.4941 2.49995 -DEAL::6.1 1.86803 1.44543 2.49992 -DEAL::6.2 1.83015 1.41827 2.49989 -DEAL::6.3 1.77867 1.40922 2.50001 -DEAL::6.4 1.71817 1.41482 2.50005 -DEAL::6.5 1.65242 1.43201 2.50005 -DEAL::6.6 1.58434 1.45824 2.50005 -DEAL::6.7 1.51607 1.49149 2.49991 -DEAL::6.8 1.44916 1.53017 2.4999 -DEAL::6.9 1.38465 1.57301 2.50006 -DEAL::7 1.32327 1.61902 2.49995 -DEAL::7.1 1.26548 1.6674 2.49989 -DEAL::7.2 1.21156 1.7175 2.50005 -DEAL::7.3 1.16164 1.76879 2.49998 -DEAL::7.4 1.11578 1.82081 2.49991 -DEAL::7.5 1.07396 1.87319 2.50002 -DEAL::7.6 1.03609 1.92558 2.5 -DEAL::7.7 1.00208 1.97772 2.49993 -DEAL::7.8 0.971784 2.02935 2.49999 -DEAL::7.9 0.945072 2.08025 2.5 -DEAL::8 0.921787 2.13022 2.49995 -DEAL::8.1 0.901781 2.17907 2.49997 -DEAL::8.2 0.884906 2.22664 2.5 -DEAL::8.3 0.871025 2.27275 2.49997 -DEAL::8.4 0.860013 2.31723 2.49997 -DEAL::8.5 0.851761 2.35992 2.49999 -DEAL::8.6 0.84618 2.40062 2.49998 -DEAL::8.7 0.843199 2.43916 2.49998 -DEAL::8.8 0.842774 2.47531 2.49999 -DEAL::8.9 0.844885 2.50883 2.49997 -DEAL::9 0.849543 2.53948 2.50004 -DEAL::9.1 0.856788 2.56694 2.49994 -DEAL::9.2 0.866696 2.59088 2.49999 -DEAL::9.3 0.879382 2.61091 2.50009 -DEAL::9.4 0.895002 2.6266 2.49992 -DEAL::9.5 0.913755 2.63743 2.49985 -DEAL::9.6 0.935893 2.64284 2.49987 -DEAL::9.7 0.961713 2.64217 2.50002 -DEAL::9.8 0.991567 2.63469 2.49996 -DEAL::9.9 1.02585 2.61958 2.50009 -DEAL::10 1.06497 2.59596 2.49997 \ No newline at end of file +DEAL::0.000000000000000 3.900000000000000 1.100000000000000 2.800000000000000 +DEAL::0.1000000000000000 3.999954663145372 0.7204316161077872 2.499899653610265 +DEAL::0.2000000000000000 3.788936970070295 0.6609672917013164 2.499905249696827 +DEAL::0.3000000000000000 3.522745784350997 0.6815013817667387 2.499911368534391 +DEAL::0.4000000000000000 3.262167657017658 0.7229595935634598 2.499917669968496 +DEAL::0.5000000000000000 3.019348935313043 0.7718637877379310 2.499923841627438 +DEAL::0.6000000000000000 2.795938132115932 0.8246702792881361 2.499929742235909 +DEAL::0.7000000000000000 2.591162759876589 0.8802406794430150 2.499935161889427 +DEAL::0.7999999999999999 2.403701439557558 0.9380972541963858 2.499939853255266 +DEAL::0.8999999999999999 2.232173064002601 0.9979590867236592 2.499943919458207 +DEAL::0.9999999999999999 2.075274578279956 1.059601970577344 2.499947683394216 +DEAL::1.100000000000000 1.931817529181708 1.122811791158828 2.499951282776737 +DEAL::1.200000000000000 1.800732166307195 1.187368611565352 2.499954717691959 +DEAL::1.300000000000000 1.681060281941994 1.253042267509972 2.499957900056776 +DEAL::1.400000000000000 1.571944035093605 1.319592929515776 2.499960692600467 +DEAL::1.500000000000000 1.472613530069562 1.386774104777678 2.499963067180770 +DEAL::1.600000000000000 1.382374380149378 1.454336903936943 2.499965214907631 +DEAL::1.700000000000000 1.300595926868299 1.522034867479652 2.499967239917031 +DEAL::1.800000000000000 1.226700560521851 1.589628817066658 2.499969158035221 +DEAL::1.900000000000001 1.160154466388844 1.656891280088327 2.499970929605994 +DEAL::2.000000000000000 1.100460018135786 1.723610111454883 2.499972486060028 +DEAL::2.100000000000001 1.047149927911091 1.789591031937581 2.499973780491607 +DEAL::2.200000000000001 0.9997831418946556 1.854658918173370 2.499974904035290 +DEAL::2.300000000000001 0.9579423530855202 1.918657803499070 2.499975929017252 +DEAL::2.400000000000001 0.9212329058233618 1.981449663980430 2.499976873429875 +DEAL::2.500000000000001 0.8892828019526302 2.042912154679778 2.499977723493630 +DEAL::2.600000000000001 0.8617434931640233 2.102935517191095 2.499978451478211 +DEAL::2.700000000000001 0.8382911568571214 2.161418897864243 2.499979033421224 +DEAL::2.800000000000001 0.8186281966190632 2.218266300683054 2.499979501008720 +DEAL::2.900000000000001 0.8024847722990943 2.273382357692037 2.499979894770173 +DEAL::3.000000000000001 0.7896202372362503 2.326668043190232 2.499980225542400 +DEAL::3.100000000000001 0.7798244317219958 2.378016395012518 2.499980477141999 +DEAL::3.200000000000002 0.7729188455590992 2.427308244258313 2.499980638681301 +DEAL::3.300000000000002 0.7687577152727458 2.474407898114452 2.499980772262222 +DEAL::3.400000000000002 0.7672291627028960 2.519158670539376 2.499980736879695 +DEAL::3.500000000000002 0.7682565130060038 2.561378111968658 2.499984148801817 +DEAL::3.600000000000002 0.7717999538697109 2.600852750378166 2.499983561092105 +DEAL::3.700000000000002 0.7778587177434001 2.637332118846111 2.499981019628537 +DEAL::3.800000000000002 0.7864739845842315 2.670521810068073 2.499981631927603 +DEAL::3.900000000000002 0.7977327166866334 2.700075263706916 2.499982217565526 +DEAL::4.000000000000002 0.8117726432442937 2.725583964841273 2.499981362528249 +DEAL::4.100000000000001 0.8287885993363914 2.746565723386505 2.499979315188737 +DEAL::4.200000000000001 0.8490403696366368 2.762450740498919 2.499980084295369 +DEAL::4.300000000000001 0.8728620436982314 2.772565302541470 2.499979966076433 +DEAL::4.400000000000000 0.9006725717571656 2.776113274341892 2.499977804012925 +DEAL::4.500000000000000 0.9329865587835054 2.772156274664554 2.499976693071011 +DEAL::4.600000000000000 0.9704230763452322 2.759594827464488 2.499977153237681 +DEAL::4.699999999999999 1.013707947682141 2.737155433515020 2.499975875091458 +DEAL::4.799999999999999 1.063660874060138 2.703393234933302 2.499974882104756 +DEAL::4.899999999999999 1.121152042470720 2.656727847139595 2.499973261874597 +DEAL::4.999999999999998 1.187002916435298 2.595541877913893 2.499971256044831 +DEAL::5.099999999999998 1.261794144105020 2.518386540766508 2.499968548912124 +DEAL::5.199999999999998 1.345537262490581 2.424349148770446 2.499966608745877 +DEAL::5.299999999999997 1.437186119322323 2.313621743711252 2.499964192065731 +DEAL::5.399999999999997 1.534044499172598 2.188228610920321 2.499962798850400 +DEAL::5.499999999999996 1.631296486322295 2.052686950619994 2.499959594649711 +DEAL::5.599999999999996 1.722084217932804 1.914143817047508 2.499957444752513 +DEAL::5.699999999999996 1.798543224459697 1.781501984009354 2.499955760205580 +DEAL::5.799999999999995 1.853709331725711 1.663523120436956 2.499953661840753 +DEAL::5.899999999999995 1.883445105035375 1.566710232647432 2.499953099661390 +DEAL::5.999999999999995 1.887311323879574 1.494098056773874 2.499948998725679 +DEAL::6.099999999999994 1.868034896798648 1.445431598898616 2.499952953116337 +DEAL::6.199999999999994 1.830153906125955 1.418269091012518 2.499952887343040 +DEAL::6.299999999999994 1.778669906602703 1.409218707303112 2.499954107906120 +DEAL::6.399999999999993 1.718165738674587 1.414823010251126 2.499956234876726 +DEAL::6.499999999999993 1.652417816563038 1.432011460804723 2.499957706794417 +DEAL::6.599999999999993 1.584337645817469 1.458244426860415 2.499960237762559 +DEAL::6.699999999999992 1.516072450863051 1.491494783487037 2.499961974931505 +DEAL::6.799999999999992 1.449155109892951 1.530167026526324 2.499963027886044 +DEAL::6.899999999999991 1.384649469936970 1.573005969422929 2.499964198117149 +DEAL::6.999999999999991 1.323271340519140 1.619016372072400 2.499965830410916 +DEAL::7.099999999999991 1.265482129078435 1.667399208880861 2.499967804387005 +DEAL::7.199999999999990 1.211558595081264 1.717503689107264 2.499969656210217 +DEAL::7.299999999999990 1.161643854044269 1.768792032473365 2.499970804318965 +DEAL::7.399999999999990 1.115784452591756 1.820813806479801 2.499971531294262 +DEAL::7.499999999999989 1.073957420200010 1.873187109088414 2.499972378889431 +DEAL::7.599999999999989 1.036090241193611 1.925584500808475 2.499973481131451 +DEAL::7.699999999999989 1.002075872301957 1.977722156531730 2.499974688756566 +DEAL::7.799999999999988 0.9717842953791208 2.029351163917069 2.499975696902804 +DEAL::7.899999999999988 0.9450716258252408 2.080250239950046 2.499976251137461 +DEAL::7.999999999999988 0.9217874641071346 2.130219386045843 2.499976636145428 +DEAL::8.099999999999987 0.9017809496789920 2.179074173582222 2.499977093639638 +DEAL::8.199999999999987 0.8849058268793307 2.226640463584197 2.499977634251643 +DEAL::8.299999999999986 0.8710247390736183 2.272749431689248 2.499978147732173 +DEAL::8.399999999999986 0.8600129131280058 2.317232805052128 2.499978499054386 +DEAL::8.499999999999986 0.8517613678393973 2.359918231691021 2.499978659758959 +DEAL::8.599999999999985 0.8461797672021946 2.400624702893315 2.499978776359771 +DEAL::8.699999999999985 0.8431990351568379 2.439157941705411 2.499978919265217 +DEAL::8.799999999999985 0.8427738477469130 2.475305659636530 2.499989556593801 +DEAL::8.899999999999984 0.8448851168090848 2.508832573965512 2.499982185776126 +DEAL::8.999999999999984 0.8495425769950730 2.539475069080805 2.499982352018700 +DEAL::9.099999999999984 0.8567875716032834 2.566935391110659 2.499980611294215 +DEAL::9.199999999999983 0.8666961134127005 2.590875275660291 2.499978482768264 +DEAL::9.299999999999983 0.8793822456908451 2.610908954243885 2.499980541193942 +DEAL::9.399999999999983 0.8950016462110704 2.626595568474095 2.499979958748708 +DEAL::9.499999999999982 0.9137552694913937 2.637431181159516 2.499979061088469 +DEAL::9.599999999999982 0.9358925691778807 2.642840858781866 2.499977847551920 +DEAL::9.699999999999982 0.9617134218503661 2.642171785544933 2.499976983869399 +DEAL::9.799999999999981 0.9915671866756427 2.634689175572261 2.499976374174905 +DEAL::9.899999999999981 1.025846255704860 2.619578036102738 2.499975601370500 +DEAL::10.00000000000000 1.064969830839542 2.595955793721647 2.499973380658211 diff --git a/tests/sundials/arkode_04_in.prm b/tests/sundials/arkode_04_in.prm index 55a91a0b7c..06eda8bad9 100644 --- a/tests/sundials/arkode_04_in.prm +++ b/tests/sundials/arkode_04_in.prm @@ -2,14 +2,16 @@ set Final time = 10. 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 + # This test is somewhat easier since we have a way to evaluate the Jacobian + set Absolute error tolerance = 4e-9 + set Relative error tolerance = 4e-9 end subsection Running parameters set Implicit function is linear = true set Implicit function is time independent = true - set Initial step size = 0.010000 - set Maximum number of nonlinear iterations = 10 + set Initial step size = 5e-7 + set Maximum number of nonlinear iterations = 50 set Maximum order of ARK = 5 - set Minimum step size = 0.000001 + set Minimum step size = 1e-8 + set Anderson-acceleration subspace = 5 end -- 2.39.5