Merge /u/wyldckat/foam-extend32/ branch master into master
[foam-extend-3.2.git] / src / coupledMatrix / coupledLduSolver / iterativeSolver / coupledIterativeSolver.H
blob8146ec4a3eb53af722bdcd6d2190c63883826afa
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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/>.
24 Class
25     coupledIterativeSolver
27 Description
28     Virtual base class for coupled iterative solvers
30 Author
31     Hrvoje Jasak, Wikki Ltd.  All rights reserved.
33 SourceFiles
34     coupledIterativeSolver.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef coupledIterativeSolver_H
39 #define coupledIterativeSolver_H
41 #include "coupledLduSolver.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                     Class coupledIterativeSolver Declaration
50 \*---------------------------------------------------------------------------*/
52 class coupledIterativeSolver
54     public coupledLduSolver
56     // Private data
58         //- Control data dictionary
59         dictionary dict_;
62     // Private Member Functions
64         //- Disallow default bitwise copy construct
65         coupledIterativeSolver(const coupledIterativeSolver&);
67         //- Disallow default bitwise assignment
68         void operator=(const coupledIterativeSolver&);
71 protected:
73     // Protected data
75         //- Solver tolerance
76         scalar tolerance_;
78         //- Relative tolerance
79         scalar relTolerance_;
81         //- Minimum number of iterations
82         //  (forced irrespective of convergence)
83         label minIter_;
85         //- Maximum number of iterations
86         label maxIter_;
89     // Protected Member Functions
91         //- Return dictionary
92         const dictionary& dict() const;
95         //- Is the stop criterion reached
96         bool stop(coupledSolverPerformance& solverPerf) const;
98         //- Read the control parameters from the dictionary
99         virtual void readControls();
101         //- Return the matrix norm used to normalise the residual for the
102         //  stopping criterion
103         scalar normFactor
104         (
105             const FieldField<Field, scalar>& x,
106             const FieldField<Field, scalar>& b,
107             const FieldField<Field, scalar>& Ax,
108             FieldField<Field, scalar>& tmpField,
109             const direction cmpt
110         ) const;
112         scalar normFactor
113         (
114             const FieldField<Field, scalar>& x,
115             const FieldField<Field, scalar>& b,
116             const direction cmpt
117         ) const;
120 public:
122     // Constructors
124         //- Construct from matrix components and solver data stream
125         coupledIterativeSolver
126         (
127             const word& fieldName,
128             const coupledLduMatrix& matrix,
129             const PtrList<FieldField<Field, scalar> >& bouCoeffs,
130             const PtrList<FieldField<Field, scalar> >& intCoeffs,
131             const lduInterfaceFieldPtrsListList& interfaces,
132             const dictionary& solverData
133         );
136     // Destructor
138         virtual ~coupledIterativeSolver()
139         {}
142     // Member functions
144         // Access
146             scalar tolerance() const
147             {
148                 return tolerance_;
149             }
151             scalar relTolerance() const
152             {
153                 return relTolerance_;
154             }
156             label minIter() const
157             {
158                 return minIter_;
159             }
161             label maxIter() const
162             {
163                 return maxIter_;
164             }
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 } // End namespace Foam
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 #endif
176 // ************************************************************************* //