From: David Wells Date: Mon, 23 May 2022 01:54:26 +0000 (-0400) Subject: Massively lower some IDA solver tolerances. X-Git-Tag: v9.4.0-rc1~142^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13787%2Fhead;p=dealii.git Massively lower some IDA solver tolerances. ida_02 presently fails with a numdiff difference of about 1e-6: this makes sense since that's the provided solver tolerance. We can get consistent results by making it a few orders of magnitude lower. --- diff --git a/tests/sundials/ida_01.cc b/tests/sundials/ida_01.cc index c855ef41a6..7fa93d3e43 100644 --- a/tests/sundials/ida_01.cc +++ b/tests/sundials/ida_01.cc @@ -67,7 +67,6 @@ public: , A(2, 2) , Jinv(2, 2) , kappa(_kappa) - , out("output") { using VectorType = Vector; @@ -117,8 +116,8 @@ public: const VectorType & sol, const VectorType & sol_dot, const unsigned int step_number) -> int { - out << t << ' ' << sol[0] << ' ' << sol[1] << ' ' << sol_dot[0] << ' ' - << sol_dot[1] << std::endl; + deallog << t << ' ' << sol[0] << ' ' << sol[1] << ' ' << sol_dot[0] << ' ' + << sol_dot[1] << std::endl; return 0; }; } @@ -139,8 +138,6 @@ private: FullMatrix A; FullMatrix Jinv; double kappa; - - std::ofstream out; }; @@ -149,6 +146,8 @@ main(int argc, char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization( argc, argv, numbers::invalid_unsigned_int); + initlog(); + deallog << std::setprecision(10); SUNDIALS::IDA>::AdditionalData data; ParameterHandler prm; diff --git a/tests/sundials/ida_01.output b/tests/sundials/ida_01.output new file mode 100644 index 0000000000..bb8726d8d1 --- /dev/null +++ b/tests/sundials/ida_01.output @@ -0,0 +1,34 @@ + +DEAL::0.000000000 0.000000000 1.000000000 1.000000000 0.000000000 +DEAL::0.2000000000 0.1986693306 0.9800665773 0.9800665770 -0.1986693330 +DEAL::0.4000000000 0.3894183419 0.9210609931 0.9210609922 -0.3894183442 +DEAL::0.6000000000 0.5646424726 0.8253356137 0.8253356127 -0.5646424742 +DEAL::0.8000000000 0.7173560896 0.6967067080 0.6967067063 -0.7173560914 +DEAL::1.000000000 0.8414709829 0.5403023046 0.5403023026 -0.8414709843 +DEAL::1.200000000 0.9320390834 0.3623577534 0.3623577521 -0.9320390840 +DEAL::1.400000000 0.9854497269 0.1699671423 0.1699671398 -0.9854497274 +DEAL::1.600000000 0.9995735994 -0.02919952231 -0.02919952456 -0.9995735995 +DEAL::1.800000000 0.9738476269 -0.2272020939 -0.2272020963 -0.9738476265 +DEAL::2.000000000 0.9092974227 -0.4161468348 -0.4161468372 -0.9092974217 +DEAL::2.200000000 0.8084963997 -0.5885011145 -0.5885011162 -0.8084963987 +DEAL::2.400000000 0.6754631768 -0.7373937117 -0.7373937135 -0.6754631750 +DEAL::2.600000000 0.5155013686 -0.8568887485 -0.8568887499 -0.5155013666 +DEAL::2.800000000 0.3349881478 -0.9422223349 -0.9422223355 -0.3349881464 +DEAL::3.000000000 0.1411200068 -0.9899924900 -0.9899924905 -0.1411200044 +DEAL::3.200000000 -0.05837414331 -0.9982947687 -0.9982947687 0.05837414560 +DEAL::3.400000000 -0.2555411004 -0.9667981852 -0.9667981850 0.2555411014 +DEAL::3.600000000 -0.4425204401 -0.8967584090 -0.8967584080 0.4425204424 +DEAL::3.800000000 -0.6118578861 -0.7909677050 -0.7909677039 0.6118578878 +DEAL::4.000000000 -0.7568024889 -0.6536436148 -0.6536436130 0.7568024906 +DEAL::4.200000000 -0.8715757645 -0.4902608164 -0.4902608143 0.8715757658 +DEAL::4.400000000 -0.9516020648 -0.3073328666 -0.3073328650 0.9516020654 +DEAL::4.600000000 -0.9936909936 -0.1121525253 -0.1121525228 0.9936909940 +DEAL::4.800000000 -0.9961645982 0.08749898300 0.08749898532 0.9961645981 +DEAL::5.000000000 -0.9589242639 0.2836621828 0.2836621839 0.9589242637 +DEAL::5.200000000 -0.8834546453 0.4685166664 0.4685166687 0.8834546443 +DEAL::5.400000000 -0.7727644780 0.6346928688 0.6346928705 0.7727644768 +DEAL::5.600000000 -0.6312666296 0.7755658693 0.7755658710 0.6312666278 +DEAL::5.800000000 -0.4646021729 0.8855195059 0.8855195072 0.4646021708 +DEAL::6.000000000 -0.2794154939 0.9601702741 0.9601702747 0.2794154923 +DEAL::6.200000000 -0.08308940102 0.9965420835 0.9965420838 0.08308939852 +DEAL::6.300000000 0.01681390092 0.9998586225 0.9998586225 -0.01681390017 diff --git a/tests/sundials/ida_01.with_sundials.geq.4.0.0.output b/tests/sundials/ida_01.with_sundials.geq.4.0.0.output deleted file mode 100644 index 7238b14d99..0000000000 --- a/tests/sundials/ida_01.with_sundials.geq.4.0.0.output +++ /dev/null @@ -1,33 +0,0 @@ -0 0 1 1 0 -0.2 0.198666 0.98005 0.980056 -0.198635 -0.4 0.389414 0.92105 0.921063 -0.3894 -0.6 0.564639 0.825325 0.825346 -0.564653 -0.8 0.717354 0.696694 0.696713 -0.717367 -1 0.841469 0.540288 0.540295 -0.841478 -1.2 0.932034 0.362343 0.362339 -0.932034 -1.4 0.985441 0.169954 0.169952 -0.985442 -1.6 0.999562 -0.0292108 -0.0292135 -0.999563 -1.8 0.973833 -0.227211 -0.227214 -0.973833 -2 0.909281 -0.416152 -0.416155 -0.909281 -2.2 0.808479 -0.588503 -0.588506 -0.808478 -2.4 0.675445 -0.737392 -0.737394 -0.675443 -2.6 0.515484 -0.856883 -0.856885 -0.515482 -2.8 0.334972 -0.942213 -0.942214 -0.334969 -3 0.141106 -0.989979 -0.98998 -0.141103 -3.2 -0.0583858 -0.998279 -0.998279 0.0583887 -3.4 -0.255549 -0.966779 -0.966779 0.255552 -3.6 -0.442525 -0.896738 -0.896737 0.442528 -3.8 -0.611858 -0.790946 -0.790945 0.61186 -4 -0.756798 -0.653622 -0.65362 0.7568 -4.2 -0.871566 -0.49024 -0.490238 0.871568 -4.4 -0.951588 -0.307314 -0.307312 0.95159 -4.6 -0.993674 -0.112137 -0.112134 0.993674 -4.8 -0.996144 0.0875108 0.0875137 0.996144 -5 -0.958901 0.28367 0.283673 0.958901 -5.2 -0.88343 0.468519 0.468522 0.883429 -5.4 -0.772739 0.63469 0.634693 0.772738 -5.6 -0.631242 0.775558 0.77556 0.63124 -5.8 -0.464579 0.885506 0.885508 0.464577 -6 -0.279395 0.960152 0.960154 0.279393 -6.2 -0.0830731 0.99652 0.996521 0.0830703 -6.3 0.016828 0.999835 0.999835 -0.0168267 diff --git a/tests/sundials/ida_01.with_sundials.le.4.0.0.output b/tests/sundials/ida_01.with_sundials.le.4.0.0.output deleted file mode 100644 index 7241ab086f..0000000000 --- a/tests/sundials/ida_01.with_sundials.le.4.0.0.output +++ /dev/null @@ -1,33 +0,0 @@ -0 0 1 1 0 -0.2 0.198666 0.98005 0.980056 -0.198643 -0.4 0.389414 0.921051 0.921063 -0.3894 -0.6 0.56464 0.825325 0.825346 -0.564654 -0.8 0.717354 0.696694 0.696713 -0.717368 -1 0.841469 0.540288 0.540295 -0.841478 -1.2 0.932034 0.362343 0.362338 -0.932036 -1.4 0.985441 0.169953 0.16995 -0.985443 -1.6 0.999562 -0.0292115 -0.0292147 -0.999563 -1.8 0.973833 -0.227212 -0.227216 -0.973833 -2 0.90928 -0.416153 -0.416157 -0.90928 -2.2 0.808478 -0.588504 -0.588507 -0.808476 -2.4 0.675444 -0.737392 -0.737395 -0.675442 -2.6 0.515482 -0.856883 -0.856886 -0.515479 -2.8 0.33497 -0.942212 -0.942214 -0.334967 -3 0.141104 -0.989978 -0.98998 -0.141101 -3.2 -0.058387 -0.998277 -0.998278 0.0583908 -3.4 -0.25555 -0.966777 -0.966777 0.255554 -3.6 -0.442525 -0.896735 -0.896735 0.442529 -3.8 -0.611857 -0.790944 -0.790942 0.611861 -4 -0.756797 -0.65362 -0.653617 0.7568 -4.2 -0.871565 -0.490238 -0.490235 0.871568 -4.4 -0.951586 -0.307312 -0.307309 0.951588 -4.6 -0.993671 -0.112135 -0.112131 0.993672 -4.8 -0.996141 0.0875123 0.0875162 0.996141 -5 -0.958897 0.28367 0.283674 0.958897 -5.2 -0.883426 0.468519 0.468523 0.883425 -5.4 -0.772735 0.634689 0.634693 0.772733 -5.6 -0.631238 0.775556 0.775559 0.631236 -5.8 -0.464576 0.885504 0.885506 0.464573 -6 -0.279392 0.960149 0.960151 0.279389 -6.2 -0.0830705 0.996516 0.996517 0.0830668 -6.3 0.0168302 0.99983 0.99983 -0.0168291 diff --git a/tests/sundials/ida_01_in.prm b/tests/sundials/ida_01_in.prm index e37096a166..7bcaf91852 100644 --- a/tests/sundials/ida_01_in.prm +++ b/tests/sundials/ida_01_in.prm @@ -2,18 +2,18 @@ set Final time = 6.3 set Initial time = 0 set Time interval between each output = 0.2 subsection Error control - set Absolute error tolerance = 1e-6 + set Absolute error tolerance = 1e-10 set Ignore algebraic terms for error computations = true - set Relative error tolerance = 1e-5 + set Relative error tolerance = 1e-10 end subsection Initial condition correction parameters set Correction type at initial time = none set Correction type after restart = none - set Maximum number of nonlinear iterations = 5 + set Maximum number of nonlinear iterations = 10 end subsection Running parameters - set Initial step size = 0.1 + set Initial step size = 1e-6 set Maximum number of nonlinear iterations = 10 set Maximum order of BDF = 5 - set Minimum step size = 0.000001 + set Minimum step size = 1e-7 end diff --git a/tests/sundials/ida_02.cc b/tests/sundials/ida_02.cc index 8722aa3a42..ea94760cdf 100644 --- a/tests/sundials/ida_02.cc +++ b/tests/sundials/ida_02.cc @@ -70,7 +70,6 @@ public: , A(2, 2) , Jinv(2, 2) , kappa(_kappa) - , out("output") { using VectorType = Vector; @@ -104,7 +103,7 @@ public: time_stepper.solve_with_jacobian = [&](const VectorType &src, VectorType & dst, const double tolerance) -> int { - SolverControl solver_control(1000, tolerance); + SolverControl solver_control(1000, tolerance, false, false); SolverGMRES> solver(solver_control); solver.solve(J, dst, src, PreconditionIdentity()); return 0; @@ -114,8 +113,8 @@ public: const VectorType & sol, const VectorType & sol_dot, const unsigned int step_number) -> int { - out << t << ' ' << sol[0] << ' ' << sol[1] << ' ' << sol_dot[0] << ' ' - << sol_dot[1] << std::endl; + deallog << t << ' ' << sol[0] << ' ' << sol[1] << ' ' << sol_dot[0] << ' ' + << sol_dot[1] << std::endl; return 0; }; } @@ -136,8 +135,6 @@ private: FullMatrix A; FullMatrix Jinv; double kappa; - - std::ofstream out; }; @@ -146,6 +143,8 @@ main(int argc, char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization( argc, argv, numbers::invalid_unsigned_int); + initlog(); + deallog << std::setprecision(10); SUNDIALS::IDA>::AdditionalData data; ParameterHandler prm; diff --git a/tests/sundials/ida_02.with_sundials.geq.4.0.0.output b/tests/sundials/ida_02.with_sundials.geq.4.0.0.output index 7238b14d99..bb8726d8d1 100644 --- a/tests/sundials/ida_02.with_sundials.geq.4.0.0.output +++ b/tests/sundials/ida_02.with_sundials.geq.4.0.0.output @@ -1,33 +1,34 @@ -0 0 1 1 0 -0.2 0.198666 0.98005 0.980056 -0.198635 -0.4 0.389414 0.92105 0.921063 -0.3894 -0.6 0.564639 0.825325 0.825346 -0.564653 -0.8 0.717354 0.696694 0.696713 -0.717367 -1 0.841469 0.540288 0.540295 -0.841478 -1.2 0.932034 0.362343 0.362339 -0.932034 -1.4 0.985441 0.169954 0.169952 -0.985442 -1.6 0.999562 -0.0292108 -0.0292135 -0.999563 -1.8 0.973833 -0.227211 -0.227214 -0.973833 -2 0.909281 -0.416152 -0.416155 -0.909281 -2.2 0.808479 -0.588503 -0.588506 -0.808478 -2.4 0.675445 -0.737392 -0.737394 -0.675443 -2.6 0.515484 -0.856883 -0.856885 -0.515482 -2.8 0.334972 -0.942213 -0.942214 -0.334969 -3 0.141106 -0.989979 -0.98998 -0.141103 -3.2 -0.0583858 -0.998279 -0.998279 0.0583887 -3.4 -0.255549 -0.966779 -0.966779 0.255552 -3.6 -0.442525 -0.896738 -0.896737 0.442528 -3.8 -0.611858 -0.790946 -0.790945 0.61186 -4 -0.756798 -0.653622 -0.65362 0.7568 -4.2 -0.871566 -0.49024 -0.490238 0.871568 -4.4 -0.951588 -0.307314 -0.307312 0.95159 -4.6 -0.993674 -0.112137 -0.112134 0.993674 -4.8 -0.996144 0.0875108 0.0875137 0.996144 -5 -0.958901 0.28367 0.283673 0.958901 -5.2 -0.88343 0.468519 0.468522 0.883429 -5.4 -0.772739 0.63469 0.634693 0.772738 -5.6 -0.631242 0.775558 0.77556 0.63124 -5.8 -0.464579 0.885506 0.885508 0.464577 -6 -0.279395 0.960152 0.960154 0.279393 -6.2 -0.0830731 0.99652 0.996521 0.0830703 -6.3 0.016828 0.999835 0.999835 -0.0168267 + +DEAL::0.000000000 0.000000000 1.000000000 1.000000000 0.000000000 +DEAL::0.2000000000 0.1986693306 0.9800665773 0.9800665770 -0.1986693330 +DEAL::0.4000000000 0.3894183419 0.9210609931 0.9210609922 -0.3894183442 +DEAL::0.6000000000 0.5646424726 0.8253356137 0.8253356127 -0.5646424742 +DEAL::0.8000000000 0.7173560896 0.6967067080 0.6967067063 -0.7173560914 +DEAL::1.000000000 0.8414709829 0.5403023046 0.5403023026 -0.8414709843 +DEAL::1.200000000 0.9320390834 0.3623577534 0.3623577521 -0.9320390840 +DEAL::1.400000000 0.9854497269 0.1699671423 0.1699671398 -0.9854497274 +DEAL::1.600000000 0.9995735994 -0.02919952231 -0.02919952456 -0.9995735995 +DEAL::1.800000000 0.9738476269 -0.2272020939 -0.2272020963 -0.9738476265 +DEAL::2.000000000 0.9092974227 -0.4161468348 -0.4161468372 -0.9092974217 +DEAL::2.200000000 0.8084963997 -0.5885011145 -0.5885011162 -0.8084963987 +DEAL::2.400000000 0.6754631768 -0.7373937117 -0.7373937135 -0.6754631750 +DEAL::2.600000000 0.5155013686 -0.8568887485 -0.8568887499 -0.5155013666 +DEAL::2.800000000 0.3349881478 -0.9422223349 -0.9422223355 -0.3349881464 +DEAL::3.000000000 0.1411200068 -0.9899924900 -0.9899924905 -0.1411200044 +DEAL::3.200000000 -0.05837414331 -0.9982947687 -0.9982947687 0.05837414560 +DEAL::3.400000000 -0.2555411004 -0.9667981852 -0.9667981850 0.2555411014 +DEAL::3.600000000 -0.4425204401 -0.8967584090 -0.8967584080 0.4425204424 +DEAL::3.800000000 -0.6118578861 -0.7909677050 -0.7909677039 0.6118578878 +DEAL::4.000000000 -0.7568024889 -0.6536436148 -0.6536436130 0.7568024906 +DEAL::4.200000000 -0.8715757645 -0.4902608164 -0.4902608143 0.8715757658 +DEAL::4.400000000 -0.9516020648 -0.3073328666 -0.3073328650 0.9516020654 +DEAL::4.600000000 -0.9936909936 -0.1121525253 -0.1121525228 0.9936909940 +DEAL::4.800000000 -0.9961645982 0.08749898300 0.08749898532 0.9961645981 +DEAL::5.000000000 -0.9589242639 0.2836621828 0.2836621839 0.9589242637 +DEAL::5.200000000 -0.8834546453 0.4685166664 0.4685166687 0.8834546443 +DEAL::5.400000000 -0.7727644780 0.6346928688 0.6346928705 0.7727644768 +DEAL::5.600000000 -0.6312666296 0.7755658693 0.7755658710 0.6312666278 +DEAL::5.800000000 -0.4646021729 0.8855195059 0.8855195072 0.4646021708 +DEAL::6.000000000 -0.2794154939 0.9601702741 0.9601702747 0.2794154923 +DEAL::6.200000000 -0.08308940102 0.9965420835 0.9965420838 0.08308939852 +DEAL::6.300000000 0.01681390092 0.9998586225 0.9998586225 -0.01681390017