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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::pimpleControl
29 
30 Description
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 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class pimpleControl Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class 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 
69 protected:
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_;
104 
105  // Protected Member Functions
106 
107  //- Read controls from fvSolution dictionary
108  virtual bool read();
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  );
120 
121 public:
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 // ************************************************************************* //
bool correct()
Pressure corrector loop control.
label nCorrPISO_
Maximum number of PISO correctors.
Definition: pimpleControl.H:87
bool ddtCorr() const
Return true to apply ddtCorr.
virtual bool read()
Read controls from fvSolution dictionary.
Definition: pimpleControl.C:34
label nCorrPISO() const
Maximum number of PISO correctors.
Base class for solution control classes.
bool solveFlow_
Flag to indicate whether to solve for the flow.
Definition: pimpleControl.H:77
const word dictName("faMeshDefinition")
bool finalInnerIter() const
Return true for final inner iteration.
bool finalOnLastPimpleIterOnly_
Flag to indicate wheter the final solver is used only on the final pimple iter.
bool SIMPLErho() const
Flag to indicate whether to update density in SIMPLE.
bool solveFlow() const
Return true to solve for flow.
label corrPISO_
Current PISO corrector.
Definition: pimpleControl.H:92
dynamicFvMesh & mesh
bool storeInitialResiduals() const
Return true to store the initial residuals.
A class for handling words, derived from Foam::string.
Definition: word.H:63
bool SIMPLErho_
Flag to indicate whether to update density in SIMPLE rather than PISO mode.
Definition: pimpleControl.H:98
virtual bool loop()
PIMPLE loop.
bool turbCorr()
Return true to solve for turbulence.
virtual ~pimpleControl()=default
Destructor.
label nCorrPIMPLE_
Maximum number of PIMPLE correctors.
Definition: pimpleControl.H:82
bool turbOnFinalIterOnly_
Flag to indicate whether to only solve turbulence on final iter.
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
TypeName("pimpleControl")
Run-time type information.
bool ddtCorr_
Flag to indicate that ddtCorr should be applied; default = yes.
static void check(const int retVal, const char *what)
label nCorrPIMPLE() const
Maximum number of PIMPLE correctors.
bool firstIter() const
Return true for first PIMPLE (outer) iteration.
PIMPLE control class to supply convergence information/checks for the PIMPLE loop.
Definition: pimpleControl.H:51
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
label corrPISO() const
Current PISO corrector index.
virtual bool criteriaSatisfied()
Return true if all convergence checks are satisfied.
Definition: pimpleControl.C:54
bool finalIter() const
Return true for final PIMPLE (outer) iteration.
Namespace for OpenFOAM.
bool converged_
Converged flag.