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);
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,
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;
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 <int dim>
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
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
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
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
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
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
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
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