]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
It is now possible to define the number of smoother sweeps in the AMG preconditioner...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Nov 2008 13:56:27 +0000 (13:56 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Nov 2008 13:56:27 +0000 (13:56 +0000)
git-svn-id: https://svn.dealii.org/trunk@17627 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-32/step-32.cc
deal.II/lac/include/lac/trilinos_precondition.h
deal.II/lac/source/trilinos_precondition.cc

index 61d9629c1150e61711b3683381140005f38e15d7..47dab02c45fd8c757e2af2a7a3ed83f65db5d23b 100644 (file)
@@ -801,7 +801,7 @@ BoussinesqFlowProblem<dim>::build_stokes_preconditioner ()
   
   Amg_preconditioner->initialize(stokes_preconditioner_matrix.block(0,0),
                                 TrilinosWrappers::PreconditionAMG::AdditionalData
-                                  (true, true, 5e-2, null_space, 0, false));
+                                (true, true, 5e-2, null_space, 3, 0, false));
 
   Mp_preconditioner = boost::shared_ptr<TrilinosWrappers::PreconditionIC>
                                    (new TrilinosWrappers::PreconditionIC());
@@ -1258,8 +1258,12 @@ void BoussinesqFlowProblem<dim>::solve ()
                                  1e-8*temperature_rhs.l2_norm());
     SolverCG<TrilinosWrappers::MPI::Vector>   cg (solver_control);
 
-    TrilinosWrappers::PreconditionSSOR preconditioner;
-    preconditioner.initialize (temperature_matrix, 1.2);
+    TrilinosWrappers::PreconditionChebyshev preconditioner;
+    TrilinosWrappers::PreconditionChebyshev::AdditionalData data;
+    data.degree=3;
+    data.eigenvalue_ratio = 3;
+    data.max_eigenvalue = 2;
+    preconditioner.initialize (temperature_matrix, 3);
 
     cg.solve (temperature_matrix, temperature_solution,
              temperature_rhs, preconditioner);
index db81826c6a708db7dfb3b3bff9a744175dc14d93..04101161ad0e187843273480f440c99851667940 100755 (executable)
@@ -1088,13 +1088,14 @@ namespace TrilinosWrappers
  * fact that some of the entries in the preconditioner matrix are zero
  * and hence can be neglected.
  *
- * The implementation is able to distinguish between matrices from
- * elliptic problems and convection dominated problems. We use the
- * standard options provided by Trilinos ML for elliptic problems,
- * except that we use a Chebyshev smoother instead of a symmetric
- * Gauss-Seidel smoother.  For most elliptic problems, Chebyshev
- * provides a better damping of high frequencies (in the algebraic
- * sense) than Gauss-Seidel (SSOR).
+ * The implementation is able to distinguish between matrices from elliptic
+ * problems and convection dominated problems. We use the standard options
+ * provided by Trilinos ML for elliptic problems, except that we use a
+ * Chebyshev smoother instead of a symmetric Gauss-Seidel smoother.  For
+ * most elliptic problems, Chebyshev provides a better damping of high
+ * frequencies (in the algebraic sense) than Gauss-Seidel (SSOR), and is
+ * faster (Chebyshev requires only some matrix-vector products, whereas SSOR
+ * requires substitutions which are more expensive).
  *
  * @ingroup TrilinosWrappers
  * @ingroup Preconditioners
@@ -1117,6 +1118,7 @@ namespace TrilinosWrappers
                        const bool                             higher_order_elements = false,
                        const double                           aggregation_threshold = 1e-4,
                        const std::vector<std::vector<bool> > &constant_modes = std::vector<std::vector<bool> > (1),
+                       const unsigned int                     smoother_sweeps = 3,
                        const unsigned int                     smoother_overlap = 0,
                        const bool                             output_details = false);
 
@@ -1176,6 +1178,23 @@ namespace TrilinosWrappers
                                        */
        std::vector<std::vector<bool> > constant_modes;
 
+                                      /**
+                                       * Determines how many sweeps of the
+                                       * smoother should be performed. When
+                                       * the flag <tt>elliptic</tt> is set
+                                       * to <tt>true</tt>, i.e., for
+                                       * elliptic or almost elliptic
+                                       * problems, the polynomial degree of
+                                       * the Chebyshev smoother is set to
+                                       * <tt>smoother_sweeps</tt>. In the
+                                       * non-elliptic case,
+                                       * <tt>smoother_sweeps</tt> sets the
+                                       * number of SSOR relaxation sweeps
+                                       * for post-smoothing to be
+                                       * performed.
+                                       */
+       unsigned int smoother_sweeps;
+
                                       /**
                                        * Determines the overlap in
                                        * the SSOR/Chebyshev error
index 6c4a54a4d12f57789b7ffbbfff064cb3475c4c84..ffc68d79b2eb9091749ad4413308fbbbe3f96560 100755 (executable)
@@ -480,6 +480,7 @@ namespace TrilinosWrappers
                  const bool                             higher_order_elements,
                  const double                           aggregation_threshold,
                  const std::vector<std::vector<bool> > &constant_modes,
+                 const unsigned int                     smoother_sweeps,
                  const unsigned int                     smoother_overlap,
                  const bool                             output_details)
                   :
@@ -487,6 +488,7 @@ namespace TrilinosWrappers
                  higher_order_elements (higher_order_elements),
                  aggregation_threshold (aggregation_threshold),
                  constant_modes (constant_modes),
+                 smoother_sweeps (smoother_sweeps),
                  smoother_overlap (smoother_overlap),
                  output_details (output_details)
   {}
@@ -511,13 +513,16 @@ namespace TrilinosWrappers
       {
        ML_Epetra::SetDefaults("SA",parameter_list);
        parameter_list.set("smoother: type", "Chebyshev");
-       parameter_list.set("smoother: sweeps", 4);
+       parameter_list.set("smoother: sweeps", 
+                          (int)additional_data.smoother_sweeps);
       }
     else
       {
        ML_Epetra::SetDefaults("NSSA",parameter_list);
        parameter_list.set("aggregation: type", "Uncoupled");
        parameter_list.set("aggregation: block scaling", true);
+       parameter_list.set("smoother: sweeps",
+                          (int)additional_data.smoother_sweeps);
       }
   
     parameter_list.set("smoother: ifpack overlap", 

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.