From 396f1ec16a7a7d707a0765ee0ced4ae3fcd053e8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 28 Sep 2014 13:38:02 -0500 Subject: [PATCH] Rename a couple of variables and extend discussion. --- examples/step-36/step-36.cc | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/examples/step-36/step-36.cc b/examples/step-36/step-36.cc index 9e9eaf98a1..eb69652d2e 100644 --- a/examples/step-36/step-36.cc +++ b/examples/step-36/step-36.cc @@ -295,20 +295,27 @@ namespace Step36 // Before leaving the function, we calculate spurious eigenvalues, - // introduced to the system by zero Dirichlet constraints. - double min_ev = std::numeric_limits::max(), - max_ev = -std::numeric_limits::max(); - - for (unsigned int ind = 0; ind < dof_handler.n_dofs(); ind++) - if (constraints.is_constrained(ind)) + // introduced to the system by zero Dirichlet constraints. As + // discussed in the introduction, the use of Dirichlet boundary + // conditions coupled with the fact that the degrees of freedom + // located at the boundary of the domain remain part of the linear + // system we solve, introduces a number of spurious eigenvalues. + // Below, we output the interval within which they all lie to + // ensure that we can ignore them should they show up in our + // computations. + double min_spurious_eigenvalue = std::numeric_limits::max(), + max_spurious_eigenvalue = -std::numeric_limits::max(); + + for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i) + if (constraints.is_constrained(i)) { - const double ev = stiffness_matrix(ind,ind)/mass_matrix(ind,ind); - min_ev = std::min (min_ev, ev); - max_ev = std::max (max_ev, ev); + const double ev = stiffness_matrix(i,i)/mass_matrix(i,i); + min_spurious_eigenvalue = std::min (min_spurious_eigenvalue, ev); + max_spurious_eigenvalue = std::max (max_spurious_eigenvalue, ev); } - std::cout << " Spurious eigenvalues are in " - << "["<