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_;
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 
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 // ************************************************************************* //
Foam::pimpleControl::corrPISO
label corrPISO() const
Current PISO corrector index.
Definition: pimpleControlI.H:43
Foam::pimpleControl
PIMPLE control class to supply convergence information/checks for the PIMPLE loop.
Definition: pimpleControl.H:55
Foam::pimpleControl::read
virtual bool read()
Read controls from fvSolution dictionary.
Definition: pimpleControl.C:41
Foam::pimpleControl::storeInitialResiduals
bool storeInitialResiduals() const
Return true to store the initial residuals.
Definition: pimpleControlI.H:79
Foam::pimpleControl::setFirstIterFlag
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
Definition: pimpleControl.C:129
Foam::pimpleControl::nCorrPIMPLE_
label nCorrPIMPLE_
Maximum number of PIMPLE correctors.
Definition: pimpleControl.H:78
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::solutionControl
Base class for solution control classes.
Definition: solutionControl.H:49
Foam::pimpleControl::turbOnFinalIterOnly_
bool turbOnFinalIterOnly_
Flag to indicate whether to only solve turbulence on final iter.
Definition: pimpleControl.H:91
Foam::pimpleControl::converged_
bool converged_
Converged flag.
Definition: pimpleControl.H:101
dictName
const word dictName("faMeshDefinition")
Foam::pimpleControl::TypeName
TypeName("pimpleControl")
Run-time type information.
solutionControl.H
Foam::pimpleControl::finalOnLastPimpleIterOnly_
bool finalOnLastPimpleIterOnly_
Definition: pimpleControl.H:95
Foam::pimpleControl::criteriaSatisfied
virtual bool criteriaSatisfied()
Return true if all convergence checks are satisfied.
Definition: pimpleControl.C:61
Foam::check
static void check(const int retVal, const char *what)
Definition: ptscotchDecomp.C:80
Foam::pimpleControl::corrPISO_
label corrPISO_
Current PISO corrector.
Definition: pimpleControl.H:84
Foam::pimpleControl::solveFlow_
bool solveFlow_
Flag to indicate whether to solve for the flow.
Definition: pimpleControl.H:75
Foam::pimpleControl::finalIter
bool finalIter() const
Return true for final PIMPLE (outer) iteration.
Definition: pimpleControlI.H:92
Foam::pimpleControl::ddtCorr
bool ddtCorr() const
Return true to apply ddtCorr.
Definition: pimpleControlI.H:146
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::pimpleControl::solveFlow
bool solveFlow() const
Return true to solve for flow.
Definition: pimpleControlI.H:115
Foam::pimpleControl::loop
virtual bool loop()
PIMPLE loop.
Definition: pimpleControl.C:200
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::pimpleControl::ddtCorr_
bool ddtCorr_
Flag to indicate that ddtCorr should be applied; default = yes.
Definition: pimpleControl.H:98
Foam::pimpleControl::nCorrPISO
label nCorrPISO() const
Maximum number of PISO correctors.
Definition: pimpleControlI.H:37
Foam::pimpleControl::turbCorr
bool turbCorr()
Return true to solve for turbulence.
Definition: pimpleControlI.H:121
Foam::pimpleControl::correct
bool correct()
Pressure corrector loop control.
Definition: pimpleControlI.H:55
Foam::pimpleControl::firstIter
bool firstIter() const
Return true for first PIMPLE (outer) iteration.
Definition: pimpleControlI.H:86
Foam::pimpleControl::SIMPLErho
bool SIMPLErho() const
Flag to indicate whether to update density in SIMPLE.
Definition: pimpleControlI.H:49
Foam::pimpleControl::SIMPLErho_
bool SIMPLErho_
Definition: pimpleControl.H:88
Foam::pimpleControl::finalInnerIter
bool finalInnerIter() const
Return true for final inner iteration.
Definition: pimpleControlI.H:98
Foam::pimpleControl::~pimpleControl
virtual ~pimpleControl()=default
Destructor.
pimpleControlI.H
Foam::pimpleControl::nCorrPIMPLE
label nCorrPIMPLE() const
Maximum number of PIMPLE correctors.
Definition: pimpleControlI.H:31
Foam::pimpleControl::nCorrPISO_
label nCorrPISO_
Maximum number of PISO correctors.
Definition: pimpleControl.H:81