1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-6 H. Jasak All rights reserved
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 \*---------------------------------------------------------------------------*/
36 #ifndef BlockILUSmoother_H
37 #define BlockILUSmoother_H
39 #include "BlockLduSmoother.H"
40 #include "blockCholeskyPrecons.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class BlockILUSmoother Declaration
49 \*---------------------------------------------------------------------------*/
52 class BlockILUSmoother
54 public BlockLduSmoother<Type>
58 //- Cholesky preconditioner
59 BlockCholeskyPrecon<Type> precon_;
62 mutable Field<Type> xCorr_;
65 mutable Field<Type> residual_;
68 // Private Member Functions
70 //- Disallow default bitwise copy construct
71 BlockILUSmoother(const BlockILUSmoother&);
73 //- Disallow default bitwise assignment
74 void operator=(const BlockILUSmoother&);
79 //- Runtime type information
85 //- Construct from components
88 const BlockLduMatrix<Type>& matrix,
89 const dictionary& dict
92 BlockLduSmoother<Type>(matrix),
94 xCorr_(matrix.lduAddr().size()),
95 residual_(matrix.lduAddr().size())
101 virtual ~BlockILUSmoother()
107 //- Execute smoothing
111 const Field<Type>& b,
115 for (label sweep = 0; sweep < nSweeps; sweep++)
117 // Calculate residual
118 this-> matrix_.Amul(residual_, x);
123 residual_[i] = b[i] - residual_[i];
126 precon_.precondition(xCorr_, residual_);
128 // Add correction to x
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 } // End namespace Foam
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 // ************************************************************************* //