<ol>
+ <li> <p>Changed: the file <tt>multigrid/mg_dof_tools.h</tt> was
+ renamed to <tt>multigrid/mg_tools.h</tt> in order to match the name
+ of the class contained.
+ <br>
+ (GK 2005/03/09)
+ </p>
+
<li> <p>Changed: <code class="class">DoFTools</code>::<code
class="member">make_flux_sparsity_pattern</code>, <code
class="class">MGTools</code>::<code
<ol>
<li> <p>
- Fixed: The <code>BlockSparseMatrix</code> class had no local
- typedef <code>value_type</code> like all other classes, which
+ New: The <code class="class">PreconditionRichardson</code>
+ implements a Richardson preconditioner.
+
+ <br>
+ (GK, 2005/03/10)
+ </p>
+
+ <li> <p> Fixed: The <code class="class">BlockSparseMatrix</code>
+ class had no local typedef <code
+ class="member">value_type</code> like all other classes, which
made it a little awkward to use in some places. This has now
been fixed.
+
<br>
(WB, 2005/03/03)
</p>
- <li> <p>
- Fixed: The <code>PETScWrappers::MatrixBase</code> class
- documented that adding or setting a value that hasn't been in
- the sparsity pattern before will lead to an exception being
- thrown. This is of course wrong: PETSc allocates matrix entries
- dynamically, as needed. The documentation is now fixed.
- <br>
- (WB, 2005/03/03)
+ <li> <p> Fixed: The <code class="class">PETScWrappers</code>::<code
+ class="member">MatrixBase</code> class documented that adding
+ or setting a value that hasn't been in the sparsity pattern
+ before will lead to an exception being thrown. This is of
+ course wrong: PETSc allocates matrix entries dynamically, as
+ needed. The documentation is now fixed.
+ <br> (WB, 2005/03/03)
</p>
- <li> <p>
- New: The <code>SparseMatrix</code> iterators had no <code>operator
- ></code>, only an <code>operator <</code>. The missing operator
- is now implemented. The same holds for the <code>FullMatrix</code>
- class.
- <br>
- (WB, 2005/03/01)
+ <li> <p> New: The <code class="class">SparseMatrix</code> iterators
+ had no <code class="member">operator ></code>, only an <code
+ class="member">operator <</code>. The missing operator is
+ now implemented. The same holds for the <code
+ class="class">FullMatrix</code> class.
+ <br> (WB, 2005/03/01)
</p>
- <li> <p>
- Fixed: The <code>SparseMatrix</code> iterators could not be compared
- using <code>operator <</code>: the compiler complained that a
- private member was accessed. This is now fixed.
- <br>
- (WB, 2005/03/01)
+ <li> <p> Fixed: The <code class="class">SparseMatrix</code>
+ iterators could not be compared using <code
+ class="member">operator <</code>: the compiler complained
+ that a private member was accessed. This is now fixed.
+ <br> (WB, 2005/03/01)
</p>
</ol>
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
+// Copyright (C) 1998 - 2005 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
+/**
+ * Preconditioning with Richardson's method. This preconditioner just
+ * scales the vector with a constant relaxation factor provided by the
+ * #AdditionalData object.
+ *
+ * In Krylov-space methods, this preconditioner should not have any
+ * effect. Using SolverRichardson, the two relaxation parameters will
+ * be just multiplied. Still, this class is usefull in multigrid
+ * smoother objects (MGSmootherRelaxation).
+ *
+ * @author Guido Kanschat, 2005
+ */
+class PreconditionRichardson : public Subscriptor
+{
+ public:
+ /**
+ * Parameters for Richardson
+ * preconditioner.
+ */
+ class AdditionalData
+ {
+ public:
+ /**
+ * Constructor. Block size
+ * must be given since there
+ * is no reasonable default
+ * parameter.
+ */
+ AdditionalData (const double relaxation = 1.);
+
+ /**
+ * Relaxation parameter.
+ */
+ double relaxation;
+ };
+
+ /**
+ * Constructor with optional
+ * setting of the relaxation
+ * parameter
+ */
+ PreconditionRichardson(const AdditionalData = AdditionalData());
+
+ /**
+ * Change the relaxaton parameter
+ * in a way consistent with other
+ * preconditioners.
+ */
+ void initialize (const AdditionalData parameters);
+
+ /**
+ * Apply preconditioner.
+ */
+ template<class VECTOR>
+ void vmult (VECTOR&, const VECTOR&) const;
+
+ /**
+ * Apply transpose
+ * preconditioner. Since this is
+ * the identity, this function is
+ * the same as
+ * vmult().
+ */
+ template<class VECTOR>
+ void Tvmult (VECTOR&, const VECTOR&) const;
+ /**
+ * Apply preconditioner, adding to the previous value.
+ */
+ template<class VECTOR>
+ void vmult_add (VECTOR&, const VECTOR&) const;
+
+ /**
+ * Apply transpose
+ * preconditioner, adding. Since this is
+ * the identity, this function is
+ * the same as
+ * vmult_add().
+ */
+ template<class VECTOR>
+ void Tvmult_add (VECTOR&, const VECTOR&) const;
+
+ private:
+ /**
+ * The relaxation parameter
+ * multiplied with the vectors.
+ */
+ double relaxation;
+};
+
+
+
/**
* Preconditioner using a matrix-builtin function.
* This class forms a preconditioner suitable for the LAC solver
//----------------------------------------------------------------------//
+inline
+PreconditionRichardson::AdditionalData::AdditionalData (
+ const double relaxation)
+ :
+ relaxation(relaxation)
+{}
+
+
+inline
+PreconditionRichardson::PreconditionRichardson (
+ const PreconditionRichardson::AdditionalData parameters)
+ :
+ relaxation(parameters.relaxation)
+{}
+
+
+
+inline void
+PreconditionRichardson::initialize (
+ const PreconditionRichardson::AdditionalData parameters)
+{
+ relaxation = parameters.relaxation;
+}
+
+
+
+template<class VECTOR>
+inline void
+PreconditionRichardson::vmult (VECTOR &dst, const VECTOR &src) const
+{
+ dst.equ(relaxation,src);
+}
+
+
+
+template<class VECTOR>
+inline void
+PreconditionRichardson::Tvmult (VECTOR &dst, const VECTOR &src) const
+{
+ dst.equ(relaxation,src);
+}
+
+template<class VECTOR>
+inline void
+PreconditionRichardson::vmult_add (VECTOR &dst, const VECTOR &src) const
+{
+ dst.add(relaxation,src);
+}
+
+
+
+template<class VECTOR>
+inline void
+PreconditionRichardson::Tvmult_add (VECTOR &dst, const VECTOR &src) const
+{
+ dst.add(relaxation,src);
+}
+
+//----------------------------------------------------------------------//
+
template <class MATRIX>
inline void
PreconditionRelaxation<MATRIX>::initialize (const MATRIX &rA,
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
+// Copyright (C) 1998 - 2005 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
testproblem.five_point(A);
PreconditionIdentity prec_no;
+ PreconditionRichardson prec_richardson(0.6);
PreconditionSOR<> prec_sor;
prec_sor.initialize(A, 1.2);
PreconditionSSOR<> prec_ssor;
deallog.pop();
deallog.push("no");
-
+
+ rich.set_omega(1./A.diag_element(0));
+ check_solve(rich,A,u,f,prec_no);
check_solve(cg,A,u,f,prec_no);
check_solve(bicgstab,A,u,f,prec_no);
check_solve(gmres,A,u,f,prec_no);
check_solve(gmresright,A,u,f,prec_no);
check_solve(qmrs,A,u,f,prec_no);
+ rich.set_omega(1.);
+
+ deallog.pop();
+
+ deallog.push("rich");
+
+ rich.set_omega(1./A.diag_element(0));
+ check_solve(rich,A,u,f,prec_richardson);
+ check_solve(cg,A,u,f,prec_richardson);
+ check_solve(bicgstab,A,u,f,prec_richardson);
+ check_solve(gmres,A,u,f,prec_richardson);
+ check_solve(gmresright,A,u,f,prec_richardson);
+ check_solve(qmrs,A,u,f,prec_richardson);
+ rich.set_omega(1.);
deallog.pop();
DEAL:no-fail:GMRES::Convergence step 3 value 2.266e-17
DEAL:no-fail:QMRS::Starting value 3.000
DEAL:no-fail:QMRS::Convergence step 3 value 1.183e-16
+DEAL:no:Richardson::Starting value 3.000
+DEAL:no:Richardson::Convergence step 24 value 0.0007118
DEAL:no:cg::Starting value 3.000
DEAL:no:cg::Convergence step 3 value 5.917e-17
DEAL:no:Bicgstab::Starting value 3.000
DEAL:no:GMRES::Convergence step 3 value 2.266e-17
DEAL:no:QMRS::Starting value 3.000
DEAL:no:QMRS::Convergence step 3 value 1.183e-16
+DEAL:rich:Richardson::Starting value 3.000
+DEAL:rich:Richardson::Convergence step 42 value 0.0008696
+DEAL:rich:cg::Starting value 3.000
+DEAL:rich:cg::Convergence step 3 value 2.424e-16
+DEAL:rich:Bicgstab::Starting value 3.000
+DEAL:rich:Bicgstab::Convergence step 3 value 1.422e-15
+DEAL:rich:GMRES::Starting value 1.800
+DEAL:rich:GMRES::Convergence step 3 value 1.602e-17
+DEAL:rich:GMRES::Starting value 1.800
+DEAL:rich:GMRES::Convergence step 3 value 1.602e-17
+DEAL:rich:QMRS::Starting value 3.000
+DEAL:rich:QMRS::Convergence step 3 value 6.915e-16
DEAL:ssor:RichardsonT::Starting value 3.000
DEAL:ssor:RichardsonT::Convergence step 10 value 0.0004418
DEAL:ssor:Richardson::Starting value 3.000
DEAL:no-fail:QMRS::Starting value 11.00
DEAL:no-fail:QMRS::Failure step 10 value 0.4215
DEAL:no-fail::Iterative method reported convergence failure in step 10 with residual 0.421504
+DEAL:no:Richardson::Starting value 11.00
+DEAL:no:Richardson::Failure step 100 value 0.3002
+DEAL:no::Iterative method reported convergence failure in step 100 with residual 0.300171
DEAL:no:cg::Starting value 11.00
DEAL:no:cg::Convergence step 15 value 0.0005794
DEAL:no:Bicgstab::Starting value 11.00
DEAL:no:GMRES::Convergence step 43 value 0.0009788
DEAL:no:QMRS::Starting value 11.00
DEAL:no:QMRS::Convergence step 16 value 0.0002583
+DEAL:rich:Richardson::Starting value 11.00
+DEAL:rich:Richardson::Failure step 100 value 1.219
+DEAL:rich::Iterative method reported convergence failure in step 100 with residual 1.2187
+DEAL:rich:cg::Starting value 11.00
+DEAL:rich:cg::Convergence step 15 value 0.0005794
+DEAL:rich:Bicgstab::Starting value 11.00
+DEAL:rich:Bicgstab::Convergence step 11 value 0.0003990
+DEAL:rich:GMRES::Starting value 6.600
+DEAL:rich:GMRES::Convergence step 42 value 0.0007803
+DEAL:rich:GMRES::Starting value 6.600
+DEAL:rich:GMRES::Convergence step 42 value 0.0007803
+DEAL:rich:QMRS::Starting value 11.00
+DEAL:rich:QMRS::Convergence step 16 value 0.0002583
DEAL:ssor:RichardsonT::Starting value 11.00
DEAL:ssor:RichardsonT::Convergence step 59 value 0.0008892
DEAL:ssor:Richardson::Starting value 11.00
DEAL:psor:GMRES::Convergence step 20 value 0.0008491
DEAL:psor:GMRES::Starting value 7.345
DEAL:psor:GMRES::Convergence step 20 value 0.0008491
-DEAL::GrowingVectorMemory:Overall allocated vectors: 312
+DEAL::GrowingVectorMemory:Overall allocated vectors: 380
DEAL::GrowingVectorMemory:Maximum allocated vectors: 8