]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename a couple of variables and extend discussion.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 28 Sep 2014 18:38:02 +0000 (13:38 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 28 Sep 2014 18:39:45 +0000 (13:39 -0500)
examples/step-36/step-36.cc

index 9e9eaf98a1727388a181ec4154ce612109045394..eb69652d2e7cce954ab48cbc78e84cc261e6345a 100644 (file)
@@ -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<double>::max(),
-           max_ev = -std::numeric_limits<double>::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<double>::max(),
+           max_spurious_eigenvalue = -std::numeric_limits<double>::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 "
-              << "["<<min_ev<<":"<<max_ev<<"]"
+    std::cout << "   Spurious eigenvalues are all in the interval "
+              << "[" << min_spurious_eigenvalue << "," << max_spurious_eigenvalue << "]"
               << std::endl;
 
   }

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.