]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Update tests
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 2 Sep 2017 13:49:51 +0000 (15:49 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 2 Sep 2017 14:07:25 +0000 (16:07 +0200)
tests/lac/gmres_reorthogonalize_01.cc
tests/lac/gmres_reorthogonalize_01.debug.output
tests/lac/gmres_reorthogonalize_02.cc
tests/lac/gmres_reorthogonalize_03.cc
tests/lac/gmres_reorthogonalize_04.cc
tests/lac/gmres_reorthogonalize_05.cc
tests/lac/solver.output

index 9f6bf861983af34c507647bc994c589356e25c0f..0d54f59f5a6bf69a6ffe8286375ad5cfb0b33975 100644 (file)
@@ -15,7 +15,8 @@
 
 
 // tests that GMRES builds an orthonormal basis properly for a few difficult
-// test matrices
+// test matrices. In particular, this test monitors when re-orthogonalization
+// kicks in.
 
 #include "../tests.h"
 #include <deal.II/lac/vector.h>
@@ -26,7 +27,7 @@
 
 
 template <typename number>
-void test (unsigned int variant)
+void test (unsigned int variant, unsigned int min_convergence_steps)
 {
   const unsigned int n = 64;
   Vector<number> rhs(n), sol(n);
@@ -70,30 +71,38 @@ void test (unsigned int variant)
   data.max_n_tmp_vectors = 80;
 
   SolverGMRES<Vector<number> > solver(control, data);
-  solver.solve(matrix, sol, rhs, PreconditionIdentity());
+  auto print_re_orthogonalization =
+    [](int accumulated_iterations)
+  {
+    deallog.get_file_stream() << "Re-orthogonalization enabled at step "
+                              << accumulated_iterations << std::endl;
+  };
+  solver.connect_re_orthogonalization_slot(print_re_orthogonalization);
+
+  check_solver_within_range
+  (solver.solve(matrix, sol, rhs, PreconditionIdentity()),
+   control.last_step(), min_convergence_steps, min_convergence_steps+2);
 
   deallog.pop();
 }
 
 int main()
 {
-  std::ofstream logfile("output");
-  deallog << std::setprecision(3);
-  deallog.attach(logfile);
+  initlog();
 
   deallog.push("double");
-  test<double>(0);
-  test<double>(1);
-  test<double>(2);
-  test<double>(3);
-  test<double>(4);
-  test<double>(5);
+  test<double>(0, 56);
+  test<double>(1, 64);
+  test<double>(2, 56);
+  test<double>(3, 64);
+  test<double>(4, 56);
+  test<double>(5, 64);
   deallog.pop();
   deallog.push("float");
-  test<float>(0);
-  test<float>(1);
-  test<float>(2);
-  test<float>(3);
+  test<float>(0, 36);
+  test<float>(1, 64);
+  test<float>(2, 36);
+  test<float>(3, 64);
   deallog.pop();
 }
 
index 9f9b65c3c1f31770408b26fd90a9aa1ee7fb8333..5bb149d68a23eea658ee50e768dddad3cbbf12a7 100644 (file)
@@ -1,26 +1,16 @@
 
-DEAL:double:0:GMRES::Starting value 8.00
-DEAL:double:0:GMRES::Convergence step 57 value 1.62e-14
-DEAL:double:1:GMRES::Starting value 8.00
-DEAL:double:1:GMRES::Re-orthogonalization enabled at step 65
-DEAL:double:1:GMRES::Convergence step 65 value 1.04e-23
-DEAL:double:2:GMRES::Starting value 8.00
-DEAL:double:2:GMRES::Convergence step 57 value 1.72e-14
-DEAL:double:3:GMRES::Starting value 8.00
-DEAL:double:3:GMRES::Re-orthogonalization enabled at step 65
-DEAL:double:3:GMRES::Convergence step 65 value 2.56e-24
-DEAL:double:4:GMRES::Starting value 8.00
-DEAL:double:4:GMRES::Convergence step 57 value 1.59e-14
-DEAL:double:5:GMRES::Starting value 8.00
-DEAL:double:5:GMRES::Re-orthogonalization enabled at step 65
-DEAL:double:5:GMRES::Convergence step 65 value 1.96e-24
-DEAL:float:0:GMRES::Starting value 8.00
-DEAL:float:0:GMRES::Convergence step 37 value 7.73e-06
-DEAL:float:1:GMRES::Starting value 8.00
-DEAL:float:1:GMRES::Re-orthogonalization enabled at step 65
-DEAL:float:1:GMRES::Convergence step 65 value 1.11e-05
-DEAL:float:2:GMRES::Starting value 8.00
-DEAL:float:2:GMRES::Convergence step 37 value 6.87e-06
-DEAL:float:3:GMRES::Starting value 8.00
-DEAL:float:3:GMRES::Re-orthogonalization enabled at step 65
-DEAL:float:3:GMRES::Convergence step 66 value 3.27e-10
+DEAL:double:0::Solver stopped within 56 - 58 iterations
+Re-orthogonalization enabled at step 65
+DEAL:double:1::Solver stopped within 64 - 66 iterations
+DEAL:double:2::Solver stopped within 56 - 58 iterations
+Re-orthogonalization enabled at step 65
+DEAL:double:3::Solver stopped within 64 - 66 iterations
+DEAL:double:4::Solver stopped within 56 - 58 iterations
+Re-orthogonalization enabled at step 65
+DEAL:double:5::Solver stopped within 64 - 66 iterations
+DEAL:float:0::Solver stopped within 36 - 38 iterations
+Re-orthogonalization enabled at step 65
+DEAL:float:1::Solver stopped within 64 - 66 iterations
+DEAL:float:2::Solver stopped within 36 - 38 iterations
+Re-orthogonalization enabled at step 65
+DEAL:float:3::Solver stopped within 64 - 66 iterations
index 4a44534108b65907c13cb075e38511bac12c9922..cdc5fe4ffb36af183d260ad3af5b2098efcab185 100644 (file)
@@ -45,6 +45,13 @@ void test ()
   data.max_n_tmp_vectors = 202;
 
   SolverGMRES<Vector<number> > solver(control, data);
+  auto print_re_orthogonalization =
+    [](int accumulated_iterations)
+  {
+    deallog.get_file_stream() << "Re-orthogonalization enabled at step "
+                              << accumulated_iterations << std::endl;
+  };
+  solver.connect_re_orthogonalization_slot(print_re_orthogonalization);
   solver.solve(matrix, sol, rhs, PreconditionIdentity());
 }
 
index 523f0a6604e3f7d26c6d678c841c2cd0af089b4d..dc48dc6560140e3a92a1a25b960761efb6d65950 100644 (file)
@@ -70,6 +70,13 @@ void test (unsigned int variant)
   data.force_re_orthogonalization = true;
 
   SolverGMRES<Vector<number> > solver(control, data);
+  auto print_re_orthogonalization =
+    [](int accumulated_iterations)
+  {
+    deallog.get_file_stream() << "Re-orthogonalization enabled at step "
+                              << accumulated_iterations << std::endl;
+  };
+  solver.connect_re_orthogonalization_slot(print_re_orthogonalization);
   solver.solve(matrix, sol, rhs, PreconditionIdentity());
 
   deallog.pop();
index c63418069051c0eb09a7388440f486150d1692ee..fa8d5f32345a03326eb7c8e187fd8b4110e22b11 100644 (file)
@@ -73,6 +73,13 @@ void test ()
   data.max_n_tmp_vectors = 202;
 
   SolverGMRES<Vector<number> > solver(control, data);
+  auto print_re_orthogonalization =
+    [](int accumulated_iterations)
+  {
+    deallog.get_file_stream() << "Re-orthogonalization enabled at step "
+                              << accumulated_iterations << std::endl;
+  };
+  solver.connect_re_orthogonalization_slot(print_re_orthogonalization);
   solver.solve(matrix, sol, rhs, PreconditionIdentity());
 }
 
index 284981f46daa80086fb437229e43e1f4f9d777c5..13241a1518d0178bb832f9395b26326e1e8673d3 100644 (file)
@@ -71,6 +71,13 @@ void test ()
   data.force_re_orthogonalization = true;
 
   SolverGMRES<Vector<number> > solver(control, data);
+  auto print_re_orthogonalization =
+    [](int accumulated_iterations)
+  {
+    deallog.get_file_stream() << "Re-orthogonalization enabled at step "
+                              << accumulated_iterations << std::endl;
+  };
+  solver.connect_re_orthogonalization_slot(print_re_orthogonalization);
   solver.solve(matrix, sol, rhs, PreconditionIdentity());
 }
 
index ef1e643dcb263fa7af3ca9f450366eea66ca3381..8e9b4b983b04fd213d00a5a647b092a0a75d8986 100644 (file)
@@ -1,44 +1,44 @@
 
 DEAL::Size 4 Unknowns 9
-DEAL::SOR-diff:0
+DEAL::SOR-diff:0.000
 DEAL:no-fail:cg::Starting value 3.000
-DEAL:no-fail:cg::Convergence step 3 value 0
+DEAL:no-fail:cg::Convergence step 3 value 4.807e-17
 DEAL:no-fail:Bicgstab::Starting value 3.000
-DEAL:no-fail:Bicgstab::Convergence step 3 value 0
+DEAL:no-fail:Bicgstab::Convergence step 3 value 5.998e-18
 DEAL:no-fail:GMRES::Starting value 3.000
-DEAL:no-fail:GMRES::Convergence step 3 value 0
+DEAL:no-fail:GMRES::Convergence step 3 value 1.110e-16
 DEAL:no-fail:GMRES::Starting value 3.000
-DEAL:no-fail:GMRES::Convergence step 3 value 0
+DEAL:no-fail:GMRES::Convergence step 3 value 1.110e-16
 DEAL:no-fail:QMRS::Starting value 3.000
-DEAL:no-fail:QMRS::Convergence step 3 value 0
+DEAL:no-fail:QMRS::Convergence step 3 value 9.615e-17
 DEAL:no-fail:FIRE::Starting value 9.000
 DEAL:no-fail:FIRE::Convergence step 38 value 0.0002184
 DEAL:no:Richardson::Starting value 3.000
 DEAL:no:Richardson::Convergence step 24 value 0.0007118
 DEAL:no:cg::Starting value 3.000
-DEAL:no:cg::Convergence step 3 value 0
+DEAL:no:cg::Convergence step 3 value 4.807e-17
 DEAL:no:Bicgstab::Starting value 3.000
-DEAL:no:Bicgstab::Convergence step 3 value 0
+DEAL:no:Bicgstab::Convergence step 3 value 5.998e-18
 DEAL:no:GMRES::Starting value 3.000
-DEAL:no:GMRES::Convergence step 3 value 0
+DEAL:no:GMRES::Convergence step 3 value 1.110e-16
 DEAL:no:GMRES::Starting value 3.000
-DEAL:no:GMRES::Convergence step 3 value 0
+DEAL:no:GMRES::Convergence step 3 value 1.110e-16
 DEAL:no:QMRS::Starting value 3.000
-DEAL:no:QMRS::Convergence step 3 value 0
+DEAL:no:QMRS::Convergence step 3 value 9.615e-17
 DEAL:no:FIRE::Starting value 9.000
 DEAL:no:FIRE::Convergence step 38 value 0.0002184
 DEAL:rich:Richardson::Starting value 3.000
 DEAL:rich:Richardson::Convergence step 42 value 0.0008696
 DEAL:rich:cg::Starting value 3.000
-DEAL:rich:cg::Convergence step 3 value 0
+DEAL:rich:cg::Convergence step 3 value 3.102e-16
 DEAL:rich:Bicgstab::Starting value 3.000
-DEAL:rich:Bicgstab::Convergence step 3 value 0
+DEAL:rich:Bicgstab::Convergence step 3 value 7.254e-18
 DEAL:rich:GMRES::Starting value 1.800
-DEAL:rich:GMRES::Convergence step 3 value 0
+DEAL:rich:GMRES::Convergence step 3 value 6.029e-16
 DEAL:rich:GMRES::Starting value 3.000
-DEAL:rich:GMRES::Convergence step 3 value 0
+DEAL:rich:GMRES::Convergence step 3 value 1.078e-15
 DEAL:rich:QMRS::Starting value 3.000
-DEAL:rich:QMRS::Convergence step 3 value 0
+DEAL:rich:QMRS::Convergence step 3 value 7.195e-16
 DEAL:rich:FIRE::Starting value 9.000
 DEAL:rich:FIRE::Convergence step 32 value 0.0009708
 DEAL:ssor:RichardsonT::Starting value 3.000
@@ -65,13 +65,11 @@ DEAL:sor:cg::Starting value 3.000
 DEAL:sor:cg::Failure step 100 value 0.2585
 DEAL:sor::Exception: SolverControl::NoConvergence (it, res)
 DEAL:sor:Bicgstab::Starting value 3.000
-DEAL:sor:Bicgstab::Convergence step 5 value 0
+DEAL:sor:Bicgstab::Convergence step 5 value 6.247e-18
 DEAL:sor:GMRES::Starting value 1.462
-DEAL:sor:GMRES::Re-orthogonalization enabled at step 5
-DEAL:sor:GMRES::Convergence step 5 value 0
+DEAL:sor:GMRES::Convergence step 5 value 7.914e-19
 DEAL:sor:GMRES::Starting value 3.000
-DEAL:sor:GMRES::Re-orthogonalization enabled at step 5
-DEAL:sor:GMRES::Convergence step 5 value 0
+DEAL:sor:GMRES::Convergence step 5 value 6.144e-18
 DEAL:sor:FIRE::Starting value 9.000
 DEAL:sor:FIRE::Convergence step 51 value 0.0004993
 DEAL:psor:RichardsonT::Starting value 3.000
@@ -90,7 +88,7 @@ DEAL:psor:GMRES::Convergence step 6 value 0.0004455
 DEAL:psor:FIRE::Starting value 9.000
 DEAL:psor:FIRE::Convergence step 45 value 0.0009217
 DEAL::Size 12 Unknowns 121
-DEAL::SOR-diff:0
+DEAL::SOR-diff:0.000
 DEAL:no-fail:cg::Starting value 11.00
 DEAL:no-fail:cg::Failure step 10 value 0.1496
 DEAL:no-fail::Exception: SolverControl::NoConvergence (it, res)

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.