============================ Running \step-36
Number of active cells: 1024
Number of degrees of freedom: 1089
+ Solver converged in 67 iterations.
- Eigenvalue 0 : 4.93877
- Eigenvalue 1 : 12.3707
- Eigenvalue 2 : 12.3707
- Eigenvalue 3 : 19.8027
- Eigenvalue 4 : 24.837
+ Eigenvalue 0 : 4.93877
+ Eigenvalue 1 : 12.3707
+ Eigenvalue 2 : 12.3707
+ Eigenvalue 3 : 19.8027
+ Eigenvalue 4 : 24.837
-Job done. @endcode These eigenvalues are exactly the ones that
+ Job done. @endcode These eigenvalues are exactly the ones that
correspond to pairs $(m,n)=(1,1)$, $(1,2)$ and $(2,1)$, $(2,2)$, and
$(3,1)$. A visualization of the corresponding eigenfunctions would
look like this:
private:
void make_grid_and_dofs ();
void assemble_system ();
- void solve ();
+ unsigned int solve ();
void output_results () const;
Triangulation<dim> triangulation;
fe (1),
dof_handler (triangulation)
{
+//TODO investigate why the minimum number of refinement steps required to obtain the correct eigenvalue degeneracies is 6
parameters.declare_entry ("Global mesh refinement steps", "5",
Patterns::Integer (0, 20),
"The number of times the 1-cell coarse mesh should "
// the kind of solver we want. Here we choose the Krylov-Schur solver of
// SLEPc, a pretty fast and robust choice for this kind of problem:
template <int dim>
- void EigenvalueProblem<dim>::solve ()
+ unsigned int EigenvalueProblem<dim>::solve ()
{
// We start here, as we normally do, by assigning convergence control we
// equality is usually nearly true).
for (unsigned int i=0; i<eigenfunctions.size(); ++i)
eigenfunctions[i] /= eigenfunctions[i].linfty_norm ();
+
+ // Finally return the number of iterations it took to converge:
+ return solver_control.last_step ();
}
<< std::endl
<< " Number of degrees of freedom: "
<< dof_handler.n_dofs ()
- << std::endl
<< std::endl;
assemble_system ();
- solve ();
+
+ const unsigned int n_iterations = solve ();
+ std::cout << " Solver converged in " << n_iterations
+ << " iterations." << std::endl;
+
output_results ();
+ std::cout << std::endl;
for (unsigned int i=0; i<eigenvalues.size(); ++i)
- std::cout << " Eigenvalue " << i
+ std::cout << " Eigenvalue " << i
<< " : " << eigenvalues[i]
<< std::endl;
}
// If no exceptions are thrown, then we tell the program to stop monkeying
// around and exit nicely:
std::cout << std::endl
- << "Job done."
+ << " Job done."
<< std::endl;
return 0;