pimpleControl.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2017-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::pimpleControl
29
30Description
31 PIMPLE control class to supply convergence information/checks for
32 the PIMPLE loop.
33
34 May also be used to for PISO-based algorithms as PISO controls are a
35 sub-set of PIMPLE controls.
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef pimpleControl_H
40#define pimpleControl_H
41
42#include "solutionControl.H"
43
44//- Declare that pimpleControl will be used
45#define PIMPLE_CONTROL
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class pimpleControl Declaration
54\*---------------------------------------------------------------------------*/
56class pimpleControl
57:
58 public solutionControl
59{
60 // Private member functions
61
62 //- No copy construct
63 pimpleControl(const pimpleControl&) = delete;
64
65 //- No copy assignment
66 void operator=(const pimpleControl&) = delete;
67
68
69protected:
70
71 // Protected data
72
73 // Solution controls
74
75 //- Flag to indicate whether to solve for the flow
76 bool solveFlow_;
77
78 //- Maximum number of PIMPLE correctors
79 label nCorrPIMPLE_;
80
81 //- Maximum number of PISO correctors
82 label nCorrPISO_;
83
84 //- Current PISO corrector
85 label corrPISO_;
86
87 //- Flag to indicate whether to update density in SIMPLE
88 //- rather than PISO mode
89 bool SIMPLErho_;
90
91 //- Flag to indicate whether to only solve turbulence on final iter
93
94 //- Flag to indicate wheter the final solver is used only on the
95 //- final pimple iter
97
98 //- Flag to indicate that ddtCorr should be applied; default = yes
99 bool ddtCorr_;
100
101 //- Converged flag
102 bool converged_;
103
104
105 // Protected Member Functions
106
107 //- Read controls from fvSolution dictionary
108 virtual bool read();
109
110 //- Return true if all convergence checks are satisfied
111 virtual bool criteriaSatisfied();
112
113 //- Set the firstIteration flag on the mesh data dictionary
114 virtual void setFirstIterFlag
115 (
116 const bool check = true,
117 const bool force = false
118 );
119
120
121public:
122
123 // Static Data Members
124
125 //- Run-time type information
126 TypeName("pimpleControl");
127
128
129 // Constructors
130
131 //- Construct from mesh and the name of control sub-dictionary
133 (
134 fvMesh& mesh,
135 const word& dictName = "PIMPLE",
136 const bool verbose = true
137 );
138
139
140 //- Destructor
141 virtual ~pimpleControl() = default;
142
143
144 // Member Functions
145
146 // Access
147
148 //- Maximum number of PIMPLE correctors
149 inline label nCorrPIMPLE() const;
150
151 //- Maximum number of PISO correctors
152 inline label nCorrPISO() const;
153
154 //- Current PISO corrector index
155 inline label corrPISO() const;
156
157 //- Flag to indicate whether to update density in SIMPLE
158 // rather than PISO mode
159 inline bool SIMPLErho() const;
160
161
162 // Solution control
163
164 //- PIMPLE loop
165 virtual bool loop();
166
167 //- Pressure corrector loop control
168 inline bool correct();
169
170 //- Return true to store the initial residuals
171 inline bool storeInitialResiduals() const;
172
173 //- Return true for first PIMPLE (outer) iteration
174 inline bool firstIter() const;
175
176 //- Return true for final PIMPLE (outer) iteration
177 inline bool finalIter() const;
178
179 //- Return true for final inner iteration
180 inline bool finalInnerIter() const;
181
182 //- Return true to solve for flow
183 inline bool solveFlow() const;
184
185 //- Return true to solve for turbulence
186 inline bool turbCorr();
187
188 //- Return true to apply ddtCorr
189 inline bool ddtCorr() const;
190};
191
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195} // End namespace Foam
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#include "pimpleControlI.H"
200
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202
203#endif
204
205// ************************************************************************* //
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
PIMPLE control class to supply convergence information/checks for the PIMPLE loop.
Definition: pimpleControl.H:58
bool SIMPLErho() const
Flag to indicate whether to update density in SIMPLE.
label corrPISO_
Current PISO corrector.
Definition: pimpleControl.H:84
virtual bool criteriaSatisfied()
Return true if all convergence checks are satisfied.
Definition: pimpleControl.C:61
bool finalIter() const
Return true for final PIMPLE (outer) iteration.
label corrPISO() const
Current PISO corrector index.
label nCorrPIMPLE() const
Maximum number of PIMPLE correctors.
bool turbCorr()
Return true to solve for turbulence.
label nCorrPISO_
Maximum number of PISO correctors.
Definition: pimpleControl.H:81
label nCorrPIMPLE_
Maximum number of PIMPLE correctors.
Definition: pimpleControl.H:78
bool finalInnerIter() const
Return true for final inner iteration.
bool storeInitialResiduals() const
Return true to store the initial residuals.
bool solveFlow_
Flag to indicate whether to solve for the flow.
Definition: pimpleControl.H:75
bool correct()
Pressure corrector loop control.
bool firstIter() const
Return true for first PIMPLE (outer) iteration.
bool turbOnFinalIterOnly_
Flag to indicate whether to only solve turbulence on final iter.
Definition: pimpleControl.H:91
bool ddtCorr() const
Return true to apply ddtCorr.
virtual ~pimpleControl()=default
Destructor.
virtual bool loop()
PIMPLE loop.
TypeName("pimpleControl")
Run-time type information.
bool ddtCorr_
Flag to indicate that ddtCorr should be applied; default = yes.
Definition: pimpleControl.H:98
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
label nCorrPISO() const
Maximum number of PISO correctors.
virtual bool read()
Read controls from fvSolution dictionary.
Definition: pimpleControl.C:41
bool solveFlow() const
Return true to solve for flow.
bool converged_
Converged flag.
Base class for solution control classes.
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
const word dictName("faMeshDefinition")
Namespace for OpenFOAM.
static void check(const int retVal, const char *what)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73