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-2020 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;
63  };
64 
65 
66 private:
67 
68  // Private Member Functions
69 
70  //- Disallow default bitwise copy construction
72  (
74  ) = delete;
75 
76  //- Disallow default bitwise assignment
77  void operator=(const correctorConvergenceControl&) = delete;
78 
79 
80 protected:
81 
82  // Protected data
83 
84  //- Reference to the solution control
86 
87  //- Name of the corrector loop
88  const word loopName_;
89 
90 
91  // Protected Member Functions
92 
93  //- Get the number of solves that have happened for this variable in
94  // this time-step
95  static void getNSolves
96  (
97  const fvMesh& mesh,
98  const word& fieldName,
99  label& n
100  );
101 
102 
103  // Protected Static Template Functions
104 
105  //- Get the number of solves that have happened for this variable in
106  // this time-step
107  template<class Type>
108  static void getNTypeSolves
109  (
110  const fvMesh& mesh,
111  const word& fieldName,
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, 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
static void getNSolves(const fvMesh &mesh, const word &fieldName, label &n)
Get the number of solves that have happened for this variable in.
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
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
Namespace for OpenFOAM.