From 43f163886f9b0962a9585a19eda499e4fd2014a4 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Mon, 6 Feb 2017 15:43:21 +0100 Subject: [PATCH] Test: Make lac/schur_complement_05 a bit more robust Do not output residuals and convergence numbers. We now only check whether we do the right thing by comparing the difference of the result to a reference computation. --- tests/lac/schur_complement_05.cc | 51 +++++++++++-------- ...rilinos=true.with_mpi=true.mpirun=1.output | 41 ++++----------- ...rilinos=true.with_mpi=true.mpirun=3.output | 41 ++++----------- 3 files changed, 50 insertions(+), 83 deletions(-) diff --git a/tests/lac/schur_complement_05.cc b/tests/lac/schur_complement_05.cc index 42dff70780..0f8394e99a 100644 --- a/tests/lac/schur_complement_05.cc +++ b/tests/lac/schur_complement_05.cc @@ -536,10 +536,9 @@ namespace Step22 TrilinosWrappers::PreconditionAMG preconditioner; preconditioner.initialize (system_matrix.block(1,1)); - cg.solve (schur_complement, - tmp.block(1), - schur_rhs, - preconditioner); + check_solver_within_range( + cg.solve (schur_complement, tmp.block(1), schur_rhs, preconditioner), + solver_control.last_step(), 10, 12); constraints.distribute (tmp); solution_reference.block(1)=tmp.block(1); @@ -618,7 +617,6 @@ namespace Step22 1e-9, 1e-6); SolverType solver_S (solver_control_S); const auto S_inv = inverse_operator(S,solver_S,preconditioner_M); - // const auto S_inv = inverse_operator(S,solver_S,S_inv_approx); TrilinosWrappers::MPI::BlockVector solution_tmp; solution_tmp.reinit (owned_partitioning, @@ -628,16 +626,17 @@ namespace Step22 const VectorType &f = system_rhs.block(0); const VectorType &g = system_rhs.block(1); - deallog.push("Pre"); - // auto rhs = condense_schur_rhs (A_inv,C,f,g); // Delays computation - const VectorType rhs = condense_schur_rhs (A_inv,C,f,g); - deallog.pop(); - deallog.push("Main"); - y = S_inv * rhs; - deallog.pop(); - deallog.push("Post"); - x = postprocess_schur_solution (A_inv,B,y,f); - deallog.pop(); + + { + const unsigned int previous_depth = deallog.depth_file(0); + + const VectorType rhs = condense_schur_rhs (A_inv,C,f,g); + y = S_inv * rhs; + x = postprocess_schur_solution (A_inv,B,y,f); + + deallog.depth_file(previous_depth); + } + constraints.distribute (solution_tmp); solution = solution_tmp; @@ -671,13 +670,23 @@ namespace Step22 const double global_error = std::sqrt(Utilities::MPI::sum( local_error * local_error, mpi_communicator)); - deallog - << "Rel. norm of error in SchurOperator solve: " << global_error/ref_global_norm - << std::endl; - // Check solution - AssertThrow(global_error/ref_global_norm < 1e-3, - ExcMessage("Solution does not match reference result")); + if (global_error/ref_global_norm < 1.e-3) + { + deallog << "Relative difference of results less than 1.e-3" + << std::endl; + + } + else + { + deallog + << "Relative difference of results too large: " + << global_error/ref_global_norm + << std::endl; + + AssertThrow(false, + ExcMessage("Solution does not match reference result")); + } } template diff --git a/tests/lac/schur_complement_05.with_cxx11=on.with_trilinos=true.with_mpi=true.mpirun=1.output b/tests/lac/schur_complement_05.with_cxx11=on.with_trilinos=true.with_mpi=true.mpirun=1.output index b245d633da..10fd76b9e2 100644 --- a/tests/lac/schur_complement_05.with_cxx11=on.with_trilinos=true.with_mpi=true.mpirun=1.output +++ b/tests/lac/schur_complement_05.with_cxx11=on.with_trilinos=true.with_mpi=true.mpirun=1.output @@ -1,15 +1,8 @@ Refinement cycle 0 Assembling... Solving... -DEAL:ManualSchur:cg::Starting value 7.49608e-06 -DEAL:ManualSchur:cg::Convergence step 11 value 0 -DEAL:SchurComplementOp:Pre::Starting value 12.7149 -DEAL:SchurComplementOp:Pre::Convergence step 43 value 1.05660e-05 -DEAL:SchurComplementOp:Main::Starting value 7.49608e-06 -DEAL:SchurComplementOp:Main::Convergence step 12 value 4.00858e-10 -DEAL:SchurComplementOp:Post::Starting value 12.7149 -DEAL:SchurComplementOp:Post::Convergence step 74 value 1.05660e-05 -DEAL::Rel. norm of error in SchurOperator solve: 0.000618530 +DEAL:ManualSchur::Solver stopped within 10 - 12 iterations +DEAL::Relative difference of results less than 1.e-3 0.00000 0.632812 -1.58049 0.00000 0.00000 0.757812 -1.31971 0.00000 0.00000 0.882812 -1.13281 0.00000 @@ -17,15 +10,8 @@ DEAL::Rel. norm of error in SchurOperator solve: 0.000618530 Refinement cycle 1 Assembling... Solving... -DEAL:ManualSchur:cg::Starting value 5.38429e-06 -DEAL:ManualSchur:cg::Convergence step 11 value 0 -DEAL:SchurComplementOp:Pre::Starting value 16.9566 -DEAL:SchurComplementOp:Pre::Convergence step 59 value 1.46447e-05 -DEAL:SchurComplementOp:Main::Starting value 5.38429e-06 -DEAL:SchurComplementOp:Main::Convergence step 11 value 7.25724e-10 -DEAL:SchurComplementOp:Post::Starting value 16.9566 -DEAL:SchurComplementOp:Post::Convergence step 105 value 1.46447e-05 -DEAL::Rel. norm of error in SchurOperator solve: 0.000296712 +DEAL:ManualSchur::Solver stopped within 10 - 12 iterations +DEAL::Relative difference of results less than 1.e-3 0.00000 0.566406 -1.76557 0.00000 0.00000 0.628906 -1.59010 0.00000 0.00000 0.691406 -1.44635 0.00000 @@ -37,15 +23,8 @@ DEAL::Rel. norm of error in SchurOperator solve: 0.000296712 Refinement cycle 2 Assembling... Solving... -DEAL:ManualSchur:cg::Starting value 6.10267e-06 -DEAL:ManualSchur:cg::Convergence step 12 value 0 -DEAL:SchurComplementOp:Pre::Starting value 21.9643 -DEAL:SchurComplementOp:Pre::Convergence step 96 value 2.04878e-05 -DEAL:SchurComplementOp:Main::Starting value 6.10267e-06 -DEAL:SchurComplementOp:Main::Convergence step 12 value 6.88788e-10 -DEAL:SchurComplementOp:Post::Starting value 21.9643 -DEAL:SchurComplementOp:Post::Convergence step 187 value 2.04878e-05 -DEAL::Rel. norm of error in SchurOperator solve: 0.000406470 +DEAL:ManualSchur::Solver stopped within 10 - 12 iterations +DEAL::Relative difference of results less than 1.e-3 0.00000 0.533203 -1.87543 0.00000 0.00000 0.564453 -1.77163 0.00000 0.00000 0.595703 -1.67869 0.00000 @@ -57,8 +36,8 @@ DEAL::Rel. norm of error in SchurOperator solve: 0.000406470 0.00000 0.783203 -1.27680 0.00000 0.00000 0.814453 -1.22782 0.00000 0.00000 0.845703 -1.18244 0.00000 -0.00000 0.876953 -1.14032 0.00000 -0.00000 0.908203 -1.10107 0.00000 -0.00000 0.939453 -1.06445 0.00000 -0.00000 0.970703 -1.03018 0.00000 +0.00000 0.876953 -1.14033 0.00000 +0.00000 0.908203 -1.10120 0.00000 +0.00000 0.939453 -1.06444 0.00000 +0.00000 0.970703 -1.03006 0.00000 diff --git a/tests/lac/schur_complement_05.with_cxx11=on.with_trilinos=true.with_mpi=true.mpirun=3.output b/tests/lac/schur_complement_05.with_cxx11=on.with_trilinos=true.with_mpi=true.mpirun=3.output index 6cf26c223c..10fd76b9e2 100644 --- a/tests/lac/schur_complement_05.with_cxx11=on.with_trilinos=true.with_mpi=true.mpirun=3.output +++ b/tests/lac/schur_complement_05.with_cxx11=on.with_trilinos=true.with_mpi=true.mpirun=3.output @@ -1,15 +1,8 @@ Refinement cycle 0 Assembling... Solving... -DEAL:ManualSchur:cg::Starting value 7.49608e-06 -DEAL:ManualSchur:cg::Convergence step 11 value 0 -DEAL:SchurComplementOp:Pre::Starting value 12.7149 -DEAL:SchurComplementOp:Pre::Convergence step 43 value 1.05660e-05 -DEAL:SchurComplementOp:Main::Starting value 7.49608e-06 -DEAL:SchurComplementOp:Main::Convergence step 12 value 4.00858e-10 -DEAL:SchurComplementOp:Post::Starting value 12.7149 -DEAL:SchurComplementOp:Post::Convergence step 74 value 1.05660e-05 -DEAL::Rel. norm of error in SchurOperator solve: 0.000618530 +DEAL:ManualSchur::Solver stopped within 10 - 12 iterations +DEAL::Relative difference of results less than 1.e-3 0.00000 0.632812 -1.58049 0.00000 0.00000 0.757812 -1.31971 0.00000 0.00000 0.882812 -1.13281 0.00000 @@ -17,15 +10,8 @@ DEAL::Rel. norm of error in SchurOperator solve: 0.000618530 Refinement cycle 1 Assembling... Solving... -DEAL:ManualSchur:cg::Starting value 5.38732e-06 -DEAL:ManualSchur:cg::Convergence step 11 value 0 -DEAL:SchurComplementOp:Pre::Starting value 16.9566 -DEAL:SchurComplementOp:Pre::Convergence step 59 value 1.30423e-05 -DEAL:SchurComplementOp:Main::Starting value 5.38732e-06 -DEAL:SchurComplementOp:Main::Convergence step 11 value 7.37537e-10 -DEAL:SchurComplementOp:Post::Starting value 16.9566 -DEAL:SchurComplementOp:Post::Convergence step 105 value 1.30423e-05 -DEAL::Rel. norm of error in SchurOperator solve: 0.000296380 +DEAL:ManualSchur::Solver stopped within 10 - 12 iterations +DEAL::Relative difference of results less than 1.e-3 0.00000 0.566406 -1.76557 0.00000 0.00000 0.628906 -1.59010 0.00000 0.00000 0.691406 -1.44635 0.00000 @@ -37,15 +23,8 @@ DEAL::Rel. norm of error in SchurOperator solve: 0.000296380 Refinement cycle 2 Assembling... Solving... -DEAL:ManualSchur:cg::Starting value 6.10237e-06 -DEAL:ManualSchur:cg::Convergence step 12 value 0 -DEAL:SchurComplementOp:Pre::Starting value 21.9643 -DEAL:SchurComplementOp:Pre::Convergence step 96 value 2.07585e-05 -DEAL:SchurComplementOp:Main::Starting value 6.10237e-06 -DEAL:SchurComplementOp:Main::Convergence step 12 value 6.88676e-10 -DEAL:SchurComplementOp:Post::Starting value 21.9643 -DEAL:SchurComplementOp:Post::Convergence step 187 value 2.07585e-05 -DEAL::Rel. norm of error in SchurOperator solve: 0.000406467 +DEAL:ManualSchur::Solver stopped within 10 - 12 iterations +DEAL::Relative difference of results less than 1.e-3 0.00000 0.533203 -1.87543 0.00000 0.00000 0.564453 -1.77163 0.00000 0.00000 0.595703 -1.67869 0.00000 @@ -57,8 +36,8 @@ DEAL::Rel. norm of error in SchurOperator solve: 0.000406467 0.00000 0.783203 -1.27680 0.00000 0.00000 0.814453 -1.22782 0.00000 0.00000 0.845703 -1.18244 0.00000 -0.00000 0.876953 -1.14032 0.00000 -0.00000 0.908203 -1.10107 0.00000 -0.00000 0.939453 -1.06445 0.00000 -0.00000 0.970703 -1.03018 0.00000 +0.00000 0.876953 -1.14033 0.00000 +0.00000 0.908203 -1.10120 0.00000 +0.00000 0.939453 -1.06444 0.00000 +0.00000 0.970703 -1.03006 0.00000 -- 2.39.5