1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Coarse AMG level stores matrix, x and b locally, for BlockLduMatrix
31 Klas Jareteg, 2012-12-13
36 \*---------------------------------------------------------------------------*/
38 #ifndef coarseBlockAmgLevel_H
39 #define coarseBlockAmgLevel_H
41 #include "BlockAmgLevel.H"
42 #include "BlockLduSmoother.H"
43 #include "BlockLduMatrix.H"
44 #include "lduPrimitiveMesh.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 /*---------------------------------------------------------------------------*\
52 Class coarseBlockAmgLevel Declaration
53 \*---------------------------------------------------------------------------*/
56 class coarseBlockAmgLevel
58 public BlockAmgLevel<Type>
62 //- Matrix addressing object. This also contains coupling interfaces
63 autoPtr<lduPrimitiveMesh> addrPtr_;
66 autoPtr<BlockLduMatrix<Type> > matrixPtr_;
75 const dictionary& dict_;
78 autoPtr<BlockMatrixCoarsening<Type> > coarseningPtr_;
81 autoPtr<BlockLduSmoother<Type> > smootherPtr_;
84 mutable Field<Type> Ax_;
87 // Private Member Functions
89 //- Disallow default bitwise copy construct
90 coarseBlockAmgLevel(const coarseBlockAmgLevel<Type>&);
92 //- Disallow default bitwise assignment
93 void operator=(const coarseBlockAmgLevel<Type>&);
98 //- Runtime type information
99 TypeName("coarseBlockAmgLevel");
104 //- Construct from components
107 autoPtr<lduPrimitiveMesh> addrPtr,
108 autoPtr<BlockLduMatrix<Type> > matrixPtr,
109 const dictionary& dict,
110 const word& coarseningType,
111 const label groupSize,
112 const label minCoarseEqns
118 virtual ~coarseBlockAmgLevel();
123 //- Return reference to x
124 virtual Field<Type>& x();
126 //- Return reference to b
127 virtual Field<Type>& b();
129 //- Return reference to dictionary
130 const dictionary& dict() const
135 //- Calculate residual
136 virtual void residual
138 const Field<Type>& x,
139 const Field<Type>& b,
143 //- Restrict residual
144 virtual void restrictResidual
146 const Field<Type>& x,
147 const Field<Type>& b,
148 Field<Type>& xBuffer,
149 Field<Type>& coarseRes,
153 //- Prolongate correction
154 virtual void prolongateCorrection
157 const Field<Type>& coarseX
164 const Field<Type>& b,
172 const Field<Type>& b,
173 const scalar tolerance,
181 const Field<Type>& b,
186 //- Create next level from current level
187 virtual autoPtr<BlockAmgLevel<Type> > makeNextLevel() const;
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 } // End namespace Foam
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 # include "coarseBlockAmgLevel.C"
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 // ************************************************************************* //