From d38e9c33a5c977fb7d7fdd010d30c3fae9ab74b3 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 14 Aug 2017 01:35:49 +0200 Subject: [PATCH] Make trilinos/precondition more robust --- tests/trilinos/precondition.cc | 60 ++++++++++++++----------- tests/trilinos/precondition.output | 66 ++++++++++------------------ tests/trilinos/precondition.output.2 | 45 ------------------- tests/trilinos/precondition.output.3 | 45 ------------------- tests/trilinos/precondition.output.4 | 45 ------------------- 5 files changed, 57 insertions(+), 204 deletions(-) delete mode 100644 tests/trilinos/precondition.output.2 delete mode 100644 tests/trilinos/precondition.output.3 delete mode 100644 tests/trilinos/precondition.output.4 diff --git a/tests/trilinos/precondition.cc b/tests/trilinos/precondition.cc index fcfed69d4c..29ff9f2a23 100644 --- a/tests/trilinos/precondition.cc +++ b/tests/trilinos/precondition.cc @@ -48,7 +48,7 @@ private: void make_grid (); void setup_system(); void assemble_system (); - void solve (); + void solve (int cycle); Triangulation triangulation; FE_Q fe; @@ -202,48 +202,52 @@ void Step4::assemble_system () template -void Step4::solve () +void Step4::solve (int cycle) { deallog.push(Utilities::int_to_string(dof_handler.n_dofs(),5)); { deallog.push("Jacobi"); + static constexpr std::array lower {49,100}; TrilinosWrappers::PreconditionJacobi preconditioner; solution = 0; SolverControl solver_control (1000, 1e-10); SolverCG<> solver (solver_control); preconditioner.initialize(system_matrix); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { deallog.push("SSOR"); + static constexpr std::array lower {40,77}; TrilinosWrappers::PreconditionSSOR preconditioner; solution = 0; SolverControl solver_control (1000, 1e-10); SolverCG<> solver (solver_control); preconditioner.initialize(system_matrix); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { deallog.push("SOR"); + static constexpr std::array lower {31,62}; TrilinosWrappers::PreconditionSOR preconditioner; solution = 0; SolverControl solver_control (1000, 1e-5); SolverBicgstab<> solver (solver_control); preconditioner.initialize(system_matrix); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { deallog.push("BlockJacobi"); + static constexpr std::array lower {73,145}; TrilinosWrappers::PreconditionBlockJacobi preconditioner; TrilinosWrappers::PreconditionBlockJacobi::AdditionalData data; data.block_size = 16; @@ -251,13 +255,14 @@ void Step4::solve () SolverControl solver_control (1000, 1e-10); SolverCG<> solver (solver_control); preconditioner.initialize(system_matrix, data); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { deallog.push("BlockSSOR"); + static constexpr std::array lower {30,59}; TrilinosWrappers::PreconditionBlockSSOR preconditioner; TrilinosWrappers::PreconditionBlockSSOR::AdditionalData data; data.block_size = 16; @@ -266,13 +271,14 @@ void Step4::solve () SolverControl solver_control (1000, 1e-10); SolverCG<> solver (solver_control); preconditioner.initialize(system_matrix, data); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { deallog.push("BlockSOR"); + static constexpr std::array lower {18,37}; TrilinosWrappers::PreconditionBlockSOR preconditioner; TrilinosWrappers::PreconditionBlockSOR::AdditionalData data; data.block_size = 16; @@ -281,37 +287,40 @@ void Step4::solve () SolverControl solver_control (1000, 1e-5); SolverBicgstab<> solver (solver_control); preconditioner.initialize(system_matrix, data); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { deallog.push("IC"); + static constexpr std::array lower {51,69}; TrilinosWrappers::PreconditionIC preconditioner; solution = 0; SolverControl solver_control (1000, 1e-10); SolverCG<> solver (solver_control); preconditioner.initialize(system_matrix); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { + static constexpr std::array lower {30,56}; deallog.push("ILU"); TrilinosWrappers::PreconditionILU preconditioner; solution = 0; SolverControl solver_control (1000, 1e-10); SolverCG<> solver (solver_control); preconditioner.initialize(system_matrix); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { deallog.push("ILUT"); + static constexpr std::array lower {11,19}; TrilinosWrappers::PreconditionILUT preconditioner; TrilinosWrappers::PreconditionILUT::AdditionalData data; data.ilut_drop = 1e-6; @@ -320,13 +329,14 @@ void Step4::solve () SolverControl solver_control (1000, 1e-5); SolverBicgstab<> solver (solver_control); preconditioner.initialize(system_matrix, data); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } { deallog.push("Chebyshev"); + static constexpr std::array lower {23,46}; TrilinosWrappers::PreconditionChebyshev preconditioner; TrilinosWrappers::PreconditionChebyshev::AdditionalData data; data.max_eigenvalue = 2.5; @@ -335,8 +345,8 @@ void Step4::solve () SolverControl solver_control (1000, 1e-10); SolverCG<> solver (solver_control); preconditioner.initialize(system_matrix, data); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), lower[cycle], lower[cycle]+2); deallog.pop(); } @@ -347,8 +357,8 @@ void Step4::solve () SolverControl solver_control (1000, 1e-10); SolverCG<> solver (solver_control); preconditioner.initialize(system_matrix); - solver.solve (system_matrix, solution, system_rhs, - preconditioner); + check_solver_within_range(solver.solve(system_matrix,solution,system_rhs,preconditioner), + solver_control.last_step(), 1, 1); deallog.pop(); } @@ -370,7 +380,7 @@ void Step4::run() setup_system(); assemble_system(); - solve(); + solve(cycle); } } diff --git a/tests/trilinos/precondition.output b/tests/trilinos/precondition.output index 28c7e71134..0e7329815e 100644 --- a/tests/trilinos/precondition.output +++ b/tests/trilinos/precondition.output @@ -1,45 +1,23 @@ -DEAL:01089:Jacobi:cg::Starting value 15.4650 -DEAL:01089:Jacobi:cg::Convergence step 50 value 4.48478e-11 -DEAL:01089:SSOR:cg::Starting value 15.4650 -DEAL:01089:SSOR:cg::Convergence step 41 value 4.42998e-11 -DEAL:01089:SOR:Bicgstab::Starting value 15.4650 -DEAL:01089:SOR:Bicgstab::Convergence step 32 value 3.30388e-06 -DEAL:01089:BlockJacobi:cg::Starting value 15.4650 -DEAL:01089:BlockJacobi:cg::Convergence step 74 value 6.73830e-11 -DEAL:01089:BlockSSOR:cg::Starting value 15.4650 -DEAL:01089:BlockSSOR:cg::Convergence step 31 value 7.86992e-11 -DEAL:01089:BlockSOR:Bicgstab::Starting value 15.4650 -DEAL:01089:BlockSOR:Bicgstab::Convergence step 19 value 7.10623e-06 -DEAL:01089:IC:cg::Starting value 15.4650 -DEAL:01089:IC:cg::Convergence step 52 value 8.58018e-11 -DEAL:01089:ILU:cg::Starting value 15.4650 -DEAL:01089:ILU:cg::Convergence step 31 value 4.81299e-11 -DEAL:01089:ILUT:Bicgstab::Starting value 15.4650 -DEAL:01089:ILUT:Bicgstab::Convergence step 12 value 1.37052e-06 -DEAL:01089:Chebyshev:cg::Starting value 15.4650 -DEAL:01089:Chebyshev:cg::Convergence step 24 value 9.92823e-11 -DEAL:01089:Direct:cg::Starting value 15.4650 -DEAL:01089:Direct:cg::Convergence step 1 value 4.94722e-14 -DEAL:04225:Jacobi:cg::Starting value 21.8299 -DEAL:04225:Jacobi:cg::Convergence step 101 value 5.77109e-11 -DEAL:04225:SSOR:cg::Starting value 21.8299 -DEAL:04225:SSOR:cg::Convergence step 78 value 4.50033e-11 -DEAL:04225:SOR:Bicgstab::Starting value 21.8299 -DEAL:04225:SOR:Bicgstab::Convergence step 63 value 7.96877e-06 -DEAL:04225:BlockJacobi:cg::Starting value 21.8299 -DEAL:04225:BlockJacobi:cg::Convergence step 146 value 9.98613e-11 -DEAL:04225:BlockSSOR:cg::Starting value 21.8299 -DEAL:04225:BlockSSOR:cg::Convergence step 60 value 6.80642e-11 -DEAL:04225:BlockSOR:Bicgstab::Starting value 21.8299 -DEAL:04225:BlockSOR:Bicgstab::Convergence step 38 value 9.92349e-06 -DEAL:04225:IC:cg::Starting value 21.8299 -DEAL:04225:IC:cg::Convergence step 69 value 9.23798e-11 -DEAL:04225:ILU:cg::Starting value 21.8299 -DEAL:04225:ILU:cg::Convergence step 57 value 8.22307e-11 -DEAL:04225:ILUT:Bicgstab::Starting value 21.8299 -DEAL:04225:ILUT:Bicgstab::Convergence step 20 value 3.49065e-06 -DEAL:04225:Chebyshev:cg::Starting value 21.8299 -DEAL:04225:Chebyshev:cg::Convergence step 47 value 7.80130e-11 -DEAL:04225:Direct:cg::Starting value 21.8299 -DEAL:04225:Direct:cg::Convergence step 1 value 1.51477e-13 +DEAL:01089:Jacobi::Solver stopped within 49 - 51 iterations +DEAL:01089:SSOR::Solver stopped within 40 - 42 iterations +DEAL:01089:SOR::Solver stopped within 31 - 33 iterations +DEAL:01089:BlockJacobi::Solver stopped within 73 - 75 iterations +DEAL:01089:BlockSSOR::Solver stopped within 30 - 32 iterations +DEAL:01089:BlockSOR::Solver stopped within 18 - 20 iterations +DEAL:01089:IC::Solver stopped within 51 - 53 iterations +DEAL:01089:ILU::Solver stopped within 30 - 32 iterations +DEAL:01089:ILUT::Solver stopped within 11 - 13 iterations +DEAL:01089:Chebyshev::Solver stopped within 23 - 25 iterations +DEAL:01089:Direct::Solver stopped within 1 - 1 iterations +DEAL:04225:Jacobi::Solver stopped within 100 - 102 iterations +DEAL:04225:SSOR::Solver stopped within 77 - 79 iterations +DEAL:04225:SOR::Solver stopped within 62 - 64 iterations +DEAL:04225:BlockJacobi::Solver stopped within 145 - 147 iterations +DEAL:04225:BlockSSOR::Solver stopped within 59 - 61 iterations +DEAL:04225:BlockSOR::Solver stopped within 37 - 39 iterations +DEAL:04225:IC::Solver stopped within 69 - 71 iterations +DEAL:04225:ILU::Solver stopped within 56 - 58 iterations +DEAL:04225:ILUT::Solver stopped within 19 - 21 iterations +DEAL:04225:Chebyshev::Solver stopped within 46 - 48 iterations +DEAL:04225:Direct::Solver stopped within 1 - 1 iterations diff --git a/tests/trilinos/precondition.output.2 b/tests/trilinos/precondition.output.2 deleted file mode 100644 index 5cb13577df..0000000000 --- a/tests/trilinos/precondition.output.2 +++ /dev/null @@ -1,45 +0,0 @@ - -DEAL:01089:Jacobi:cg::Starting value 15.4650 -DEAL:01089:Jacobi:cg::Convergence step 50 value 0 -DEAL:01089:SSOR:cg::Starting value 15.4650 -DEAL:01089:SSOR:cg::Convergence step 41 value 0 -DEAL:01089:SOR:Bicgstab::Starting value 15.4650 -DEAL:01089:SOR:Bicgstab::Convergence step 32 value 0 -DEAL:01089:BlockJacobi:cg::Starting value 15.4650 -DEAL:01089:BlockJacobi:cg::Convergence step 74 value 0 -DEAL:01089:BlockSSOR:cg::Starting value 15.4650 -DEAL:01089:BlockSSOR:cg::Convergence step 31 value 0 -DEAL:01089:BlockSOR:Bicgstab::Starting value 15.4650 -DEAL:01089:BlockSOR:Bicgstab::Convergence step 19 value 0 -DEAL:01089:IC:cg::Starting value 15.4650 -DEAL:01089:IC:cg::Convergence step 53 value 0 -DEAL:01089:ILU:cg::Starting value 15.4650 -DEAL:01089:ILU:cg::Convergence step 31 value 0 -DEAL:01089:ILUT:Bicgstab::Starting value 15.4650 -DEAL:01089:ILUT:Bicgstab::Convergence step 12 value 0 -DEAL:01089:Chebyshev:cg::Starting value 15.4650 -DEAL:01089:Chebyshev:cg::Convergence step 24 value 0 -DEAL:01089:Direct:cg::Starting value 15.4650 -DEAL:01089:Direct:cg::Convergence step 1 value 0 -DEAL:04225:Jacobi:cg::Starting value 21.8299 -DEAL:04225:Jacobi:cg::Convergence step 101 value 0 -DEAL:04225:SSOR:cg::Starting value 21.8299 -DEAL:04225:SSOR:cg::Convergence step 78 value 0 -DEAL:04225:SOR:Bicgstab::Starting value 21.8299 -DEAL:04225:SOR:Bicgstab::Convergence step 63 value 0 -DEAL:04225:BlockJacobi:cg::Starting value 21.8299 -DEAL:04225:BlockJacobi:cg::Convergence step 146 value 0 -DEAL:04225:BlockSSOR:cg::Starting value 21.8299 -DEAL:04225:BlockSSOR:cg::Convergence step 60 value 0 -DEAL:04225:BlockSOR:Bicgstab::Starting value 21.8299 -DEAL:04225:BlockSOR:Bicgstab::Convergence step 38 value 0 -DEAL:04225:IC:cg::Starting value 21.8299 -DEAL:04225:IC:cg::Convergence step 70 value 0 -DEAL:04225:ILU:cg::Starting value 21.8299 -DEAL:04225:ILU:cg::Convergence step 57 value 0 -DEAL:04225:ILUT:Bicgstab::Starting value 21.8299 -DEAL:04225:ILUT:Bicgstab::Convergence step 20 value 0 -DEAL:04225:Chebyshev:cg::Starting value 21.8299 -DEAL:04225:Chebyshev:cg::Convergence step 47 value 0 -DEAL:04225:Direct:cg::Starting value 21.8299 -DEAL:04225:Direct:cg::Convergence step 1 value 0 diff --git a/tests/trilinos/precondition.output.3 b/tests/trilinos/precondition.output.3 deleted file mode 100644 index 9415d6d5c9..0000000000 --- a/tests/trilinos/precondition.output.3 +++ /dev/null @@ -1,45 +0,0 @@ - -DEAL:01089:Jacobi:cg::Starting value 15.4650 -DEAL:01089:Jacobi:cg::Convergence step 50 value 0 -DEAL:01089:SSOR:cg::Starting value 15.4650 -DEAL:01089:SSOR:cg::Convergence step 41 value 0 -DEAL:01089:SOR:Bicgstab::Starting value 15.4650 -DEAL:01089:SOR:Bicgstab::Convergence step 32 value 0 -DEAL:01089:BlockJacobi:cg::Starting value 15.4650 -DEAL:01089:BlockJacobi:cg::Convergence step 74 value 0 -DEAL:01089:BlockSSOR:cg::Starting value 15.4650 -DEAL:01089:BlockSSOR:cg::Convergence step 31 value 0 -DEAL:01089:BlockSOR:Bicgstab::Starting value 15.4650 -DEAL:01089:BlockSOR:Bicgstab::Convergence step 19 value 0 -DEAL:01089:IC:cg::Starting value 15.4650 -DEAL:01089:IC:cg::Convergence step 53 value 0 -DEAL:01089:ILU:cg::Starting value 15.4650 -DEAL:01089:ILU:cg::Convergence step 31 value 0 -DEAL:01089:ILUT:Bicgstab::Starting value 15.4650 -DEAL:01089:ILUT:Bicgstab::Convergence step 12 value 0 -DEAL:01089:Chebyshev:cg::Starting value 15.4650 -DEAL:01089:Chebyshev:cg::Convergence step 24 value 0 -DEAL:01089:Direct:cg::Starting value 15.4650 -DEAL:01089:Direct:cg::Convergence step 1 value 0 -DEAL:04225:Jacobi:cg::Starting value 21.8299 -DEAL:04225:Jacobi:cg::Convergence step 101 value 0 -DEAL:04225:SSOR:cg::Starting value 21.8299 -DEAL:04225:SSOR:cg::Convergence step 78 value 0 -DEAL:04225:SOR:Bicgstab::Starting value 21.8299 -DEAL:04225:SOR:Bicgstab::Convergence step 63 value 0 -DEAL:04225:BlockJacobi:cg::Starting value 21.8299 -DEAL:04225:BlockJacobi:cg::Convergence step 146 value 0 -DEAL:04225:BlockSSOR:cg::Starting value 21.8299 -DEAL:04225:BlockSSOR:cg::Convergence step 60 value 0 -DEAL:04225:BlockSOR:Bicgstab::Starting value 21.8299 -DEAL:04225:BlockSOR:Bicgstab::Convergence step 38 value 0 -DEAL:04225:IC:cg::Starting value 21.8299 -DEAL:04225:IC:cg::Convergence step 69 value 0 -DEAL:04225:ILU:cg::Starting value 21.8299 -DEAL:04225:ILU:cg::Convergence step 57 value 0 -DEAL:04225:ILUT:Bicgstab::Starting value 21.8299 -DEAL:04225:ILUT:Bicgstab::Convergence step 20 value 0 -DEAL:04225:Chebyshev:cg::Starting value 21.8299 -DEAL:04225:Chebyshev:cg::Convergence step 47 value 0 -DEAL:04225:Direct:cg::Starting value 21.8299 -DEAL:04225:Direct:cg::Convergence step 1 value 0 diff --git a/tests/trilinos/precondition.output.4 b/tests/trilinos/precondition.output.4 deleted file mode 100644 index 61a471167a..0000000000 --- a/tests/trilinos/precondition.output.4 +++ /dev/null @@ -1,45 +0,0 @@ - -DEAL:01089:Jacobi:cg::Starting value 15.4650 -DEAL:01089:Jacobi:cg::Convergence step 50 value 0 -DEAL:01089:SSOR:cg::Starting value 15.4650 -DEAL:01089:SSOR:cg::Convergence step 41 value 0 -DEAL:01089:SOR:Bicgstab::Starting value 15.4650 -DEAL:01089:SOR:Bicgstab::Convergence step 32 value 0 -DEAL:01089:BlockJacobi:cg::Starting value 15.4650 -DEAL:01089:BlockJacobi:cg::Convergence step 74 value 0 -DEAL:01089:BlockSSOR:cg::Starting value 15.4650 -DEAL:01089:BlockSSOR:cg::Convergence step 31 value 0 -DEAL:01089:BlockSOR:Bicgstab::Starting value 15.4650 -DEAL:01089:BlockSOR:Bicgstab::Convergence step 19 value 0 -DEAL:01089:IC:cg::Starting value 15.4650 -DEAL:01089:IC:cg::Convergence step 52 value 0 -DEAL:01089:ILU:cg::Starting value 15.4650 -DEAL:01089:ILU:cg::Convergence step 31 value 0 -DEAL:01089:ILUT:Bicgstab::Starting value 15.4650 -DEAL:01089:ILUT:Bicgstab::Convergence step 12 value 0 -DEAL:01089:Chebyshev:cg::Starting value 15.4650 -DEAL:01089:Chebyshev:cg::Convergence step 24 value 0 -DEAL:01089:Direct:cg::Starting value 15.4650 -DEAL:01089:Direct:cg::Convergence step 1 value 0 -DEAL:04225:Jacobi:cg::Starting value 21.8299 -DEAL:04225:Jacobi:cg::Convergence step 101 value 0 -DEAL:04225:SSOR:cg::Starting value 21.8299 -DEAL:04225:SSOR:cg::Convergence step 78 value 0 -DEAL:04225:SOR:Bicgstab::Starting value 21.8299 -DEAL:04225:SOR:Bicgstab::Convergence step 63 value 0 -DEAL:04225:BlockJacobi:cg::Starting value 21.8299 -DEAL:04225:BlockJacobi:cg::Convergence step 146 value 0 -DEAL:04225:BlockSSOR:cg::Starting value 21.8299 -DEAL:04225:BlockSSOR:cg::Convergence step 60 value 0 -DEAL:04225:BlockSOR:Bicgstab::Starting value 21.8299 -DEAL:04225:BlockSOR:Bicgstab::Convergence step 38 value 0 -DEAL:04225:IC:cg::Starting value 21.8299 -DEAL:04225:IC:cg::Convergence step 69 value 0 -DEAL:04225:ILU:cg::Starting value 21.8299 -DEAL:04225:ILU:cg::Convergence step 57 value 0 -DEAL:04225:ILUT:Bicgstab::Starting value 21.8299 -DEAL:04225:ILUT:Bicgstab::Convergence step 20 value 0 -DEAL:04225:Chebyshev:cg::Starting value 21.8299 -DEAL:04225:Chebyshev:cg::Convergence step 47 value 0 -DEAL:04225:Direct:cg::Starting value 21.8299 -DEAL:04225:Direct:cg::Convergence step 1 value 0 -- 2.39.5