]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Cleaned the code. Added output of the sparsity pattern.
authorToby D. Young <tyoung@ippt.pan.pl>
Mon, 6 Jul 2009 10:35:32 +0000 (10:35 +0000)
committerToby D. Young <tyoung@ippt.pan.pl>
Mon, 6 Jul 2009 10:35:32 +0000 (10:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@19015 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-36/doc/results.dox
deal.II/examples/step-36/step-36.cc

index b5eaba9377b60dbcba45ee1cbac9ff5dcef3138d..2bfa782bbd80607567abb786c820538bc950dbbc 100644 (file)
@@ -1,2 +1,22 @@
 <h1>Results</h1>
 
+<h1>Possibilities for extensions</h1>
+
+It is always worth playing a few games in the playground! So here goes
+with a few suggestions:
+
+<ul> 
+
+<li><u> What happens to the world of the particle in a box if the box
+is bigger than we have considered in this application?</u></li>
+
+<li><u> What happens if we investigate the simple harmonic oscillator
+problem?</u> This is a hyper-ballic symmetric function and as such it
+may be worth trying to change the geometry of the mesh to reflect the
+underlying potential which governs quantum mechanical problems.</li>
+
+<li><u> What happens if the particle in the box has <i>internal</i>
+degrees of freedom? For example, if the particle were a spin-$1/2$
+particle?</u></li>
+
+</ul>
\ No newline at end of file
index ba24fd7c452abaad854ab2b1deb1e7e13a815b40..d4581ba5b7c99ccefeb3af348d7e7543dbf6d8a2 100644 (file)
@@ -35,7 +35,7 @@
 #include <numerics/data_out.h>
 
                                 // PETSc appears here because SLEPc
-                                // depends on him:
+                                // depends on this library:
 #include <lac/petsc_sparse_matrix.h>
 #include <lac/petsc_vector.h>
 
@@ -114,7 +114,7 @@ EigenvalueProblem<dim>::EigenvalueProblem (const std::string &prm_file)
 }
 
 
-                                // @sect4{EigenvalueProblem::make_grid_and_dofs}
+                                // @sect3{EigenvalueProblem::make_grid_and_dofs}
 template <int dim>
 void EigenvalueProblem<dim>::make_grid_and_dofs ()
 {
@@ -122,19 +122,34 @@ void EigenvalueProblem<dim>::make_grid_and_dofs ()
   triangulation.refine_global (5);
   dof_handler.distribute_dofs (fe);
 
-  //   CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(),
-  //                                  dof_handler.n_dofs());
-  //   DoFTools::make_sparsity_pattern (dof_handler, csp);
+  CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(),
+                                              dof_handler.n_dofs());
+  DoFTools::make_sparsity_pattern (dof_handler, csp);
+  csp.compress ();
+
+  // What is going on here?
+
+  // This does not work!
   //   stiffness_matrix.reinit (csp);
   //   mass_matrix.reinit (csp);
-
+  
+  // But this does... TODO: Fix it!
   stiffness_matrix.reinit (dof_handler.n_dofs(), dof_handler.n_dofs(),
-                          dof_handler.max_couplings_between_dofs());
+                          dof_handler.max_couplings_between_dofs());
   mass_matrix.reinit (dof_handler.n_dofs(), dof_handler.n_dofs(),
-                     dof_handler.max_couplings_between_dofs());
+                     dof_handler.max_couplings_between_dofs());
+
+                                // with this done we stream-out the
+                                // sparsity pattern
+  std::ofstream out ("constrained_sparsity_pattern.gpl");
+  csp.print_gnuplot (out);
   
-                                // Set the collective eigenfunction
-                                // block to be as big as we wanted!
+                                // The next step is to take care of
+                                // the eigenspectrum. In this case,
+                                // the outputs are eigenfunctions and
+                                // eigenvalues. Set the collective
+                                // eigenfunction block to be as big as
+                                // we wanted!
   eigenfunctions
     .resize (parameters.get_integer ("Number of eigenvalues/eigenfunctions"));
   for (unsigned int i=0; i<eigenfunctions.size (); ++i)
@@ -146,10 +161,11 @@ void EigenvalueProblem<dim>::make_grid_and_dofs ()
                                 // block
   eigenvalues
     .resize (eigenfunctions.size ());
+
 }
 
 
-                                // @sect5{EigenvalueProblem::assemble_system}
+                                // @sect3{EigenvalueProblem::assemble_system}
 template <int dim>
 void EigenvalueProblem<dim>::assemble_system () 
 {  
@@ -263,7 +279,7 @@ void EigenvalueProblem<dim>::assemble_system ()
 }
 
 
-                                // @sect6{EigenvalueProblem::solve}
+                                // @sect3{EigenvalueProblem::solve}
                                 // Now that the system is set up, here
                                 // is a good time to actually solve
                                 // the problem: As with other examples
@@ -295,7 +311,7 @@ void EigenvalueProblem<dim>::solve ()
 }
 
 
-                                // @sect7{EigenvalueProblem::output_results}
+                                // @sect3{EigenvalueProblem::output_results}
 template <int dim>
 void EigenvalueProblem<dim>::output_results () const
 {
@@ -332,7 +348,7 @@ void EigenvalueProblem<dim>::output_results () const
 }
 
 
-                                 // @sect8{EigenvalueProblem::run}
+                                 // @sect3{EigenvalueProblem::run}
 
                                  // This is the function which has the
                                 // top-level control over
@@ -360,7 +376,7 @@ void EigenvalueProblem<dim>::run ()
 }
 
 
-                                 // @sect9{The <code>main</code> function}
+                                 // @sect3{The <code>main</code> function}
 int main (int argc, char **argv) 
 {
   try

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.