correctorConvergenceControl.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::correctorConvergenceControl
26 
27 Description
28  Corrector convergence control class. Provides methods to check the
29  convergence of an inner iteration loop (e.g., pimple) against both absolute
30  and relative residual tolerances.
31 
32 SourceFiles
33  correctorConvergenceControl.C
34  correctorConvergenceControlTemplates.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef correctorConvergenceControl_H
39 #define correctorConvergenceControl_H
40 
41 #include "fvMesh.H"
42 #include "solutionControl.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class correctorConvergenceControl Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 {
55 public:
56 
57  //- Residual correction data structure
58  struct corrResidualData
59  {
61  scalar absTol;
62  scalar relTol;
64  };
65 
66 
67 private:
68 
69  // Private Member Functions
70 
71  //- Disallow default bitwise copy construct
73 
74  //- Disallow default bitwise assignment
75  void operator=(const correctorConvergenceControl&);
76 
77 
78 protected:
79 
80  // Protected data
81 
82  //- Reference to the solution control
84 
85  //- Name of the corrector loop
86  const word loopName_;
87 
88 
89  // Protected Member Functions
90 
91  //- Get the number of solves that have happened for this variable in
92  // this time-step
93  static void getNSolves
94  (
95  const fvMesh& mesh,
96  const word& fieldName,
97  ITstream& data,
98  label& n
99  );
100 
101 
102  // Protected Static Template Functions
103 
104  //- Get the number of solves that have happened for this variable in
105  // this time-step
106  template<class Type>
107  static void getNTypeSolves
108  (
109  const fvMesh& mesh,
110  const word& fieldName,
111  ITstream& data,
112  label& n
113  );
114 
115 
116 public:
117 
118  // Static Data Members
119 
120  //- Run-time type information
121  TypeName("correctorConvergenceControl");
122 
123 
124  // Constructors
125 
126  //- Construct from a solution control and the loop name
128  (
129  const solutionControl& control,
130  const word& loopName
131  );
132 
133 
134  //- Destructor
136 
137 
138  // Member Functions
139 
140  // Evolution
141 
142  //- Return true if corrector residual controls are present
143  virtual bool hasCorrResidualControls() const = 0;
144 
145  //- Return true if all correction convergence checks are satisfied
146  virtual bool corrCriteriaSatisfied() const = 0;
147 
148  //- Reset the solve index in the correction residual control data
149  virtual void resetCorrSolveIndex() = 0;
150 
151  //- Update the solve index in the correction residual control data
152  virtual void updateCorrSolveIndex() = 0;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #ifdef NoRepository
164 #endif
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
const word loopName_
Name of the corrector loop.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual void updateCorrSolveIndex()=0
Update the solve index in the correction residual control data.
virtual bool hasCorrResidualControls() const =0
Return true if corrector residual controls are present.
Solution control class.
static void getNTypeSolves(const fvMesh &mesh, const word &fieldName, ITstream &data, label &n)
Get the number of solves that have happened for this variable in.
const solutionControl & control_
Reference to the solution control.
Corrector convergence control class. Provides methods to check the convergence of an inner iteration ...
TypeName("correctorConvergenceControl")
Run-time type information.
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
virtual bool corrCriteriaSatisfied() const =0
Return true if all correction convergence checks are satisfied.
A wordRe is a word, but can also have a regular expression for matching words.
Definition: wordRe.H:74
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
virtual void resetCorrSolveIndex()=0
Reset the solve index in the correction residual control data.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
label n
static void getNSolves(const fvMesh &mesh, const word &fieldName, ITstream &data, label &n)
Get the number of solves that have happened for this variable in.
Input token stream.
Definition: ITstream.H:49
Namespace for OpenFOAM.