]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Exchange Richardson with GMRES, Fine tune GMRES params and adapt doc
authorNils Schween <nils.schween@mpi-hd.mpg.de>
Thu, 28 Sep 2023 14:05:26 +0000 (16:05 +0200)
committerNils Schween <nils.schween@mpi-hd.mpg.de>
Thu, 28 Sep 2023 14:05:26 +0000 (16:05 +0200)
examples/step-12/step-12.cc

index 453284723cc8e287ebc6e26c00e7e40a07001007..f7662a6cc65bd38220b55470cb63eed243492af7 100644 (file)
@@ -458,8 +458,9 @@ namespace Step12
 
   // @sect3{All the rest}
   //
-  // For this simple problem we use the simplest possible solver, called
-  // Richardson iteration, that represents a simple defect correction. This, in
+  // For this simple problem we use a standard iterative solver, called GMRES,
+  // that creates approximate solutions minimising the residual in each
+  // iterations by adding a new basis vector to the Krylov subspace. This, in
   // combination with a block SSOR preconditioner, that uses the special block
   // matrix structure of system matrices arising from DG discretizations. The
   // size of these blocks are the number of DoFs per cell. Here, we use a SSOR
@@ -470,8 +471,17 @@ namespace Step12
   template <int dim>
   void AdvectionProblem<dim>::solve()
   {
-    SolverControl                    solver_control(1000, 1e-12);
-    SolverRichardson<Vector<double>> solver(solver_control);
+    SolverControl solver_control(1000, 1e-12);
+    // We create an additional data object for the GMRES solver to increase the
+    // maximum number of basis vectors of the Krylov subspace. When this number
+    // is reached the GMRES algorithm is restarted using the solution of the
+    // previous iteration as the starting approximation. The choice of the
+    // number of basis vectors is a trade- off between memory consumption and
+    // convergence speed, since a longer basis means minimization over a larger
+    // space.
+    SolverGMRES<Vector<double>>::AdditionalData additional_data;
+    additional_data.max_n_tmp_vectors = 100;
+    SolverGMRES<Vector<double>> solver(solver_control, additional_data);
 
     // Here we create the preconditioner,
     PreconditionBlockSSOR<SparseMatrix<double>> preconditioner;

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.