pimpleControlI.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) 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 \*---------------------------------------------------------------------------*/
28 
29 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
30 
31 inline Foam::label Foam::pimpleControl::nCorrPIMPLE() const
32 {
33  return nCorrPIMPLE_;
34 }
35 
36 
37 inline Foam::label Foam::pimpleControl::nCorrPISO() const
38 {
39  return nCorrPISO_;
40 }
41 
42 
43 inline Foam::label Foam::pimpleControl::corrPISO() const
44 {
45  return corrPISO_;
46 }
47 
48 
49 inline bool Foam::pimpleControl::SIMPLErho() const
50 {
51  return SIMPLErho_;
52 }
53 
54 
56 {
57  setFirstIterFlag();
58 
59  ++corrPISO_;
60 
61  if (debug)
62  {
63  Info<< algorithmName_ << " correct: corrPISO = " << corrPISO_ << endl;
64  }
65 
66  if (corrPISO_ <= nCorrPISO_)
67  {
68  return true;
69  }
70 
71  corrPISO_ = 0;
72 
73  setFirstIterFlag();
74 
75  return false;
76 }
77 
78 
80 {
81  // Start from second PIMPLE iteration
82  return (corr_ == 2) && (corrPISO_ == 0) && (corrNonOrtho_ == 0);
83 }
84 
85 
86 inline bool Foam::pimpleControl::firstIter() const
87 {
88  return corr_ == 1;
89 }
90 
91 
92 inline bool Foam::pimpleControl::finalIter() const
93 {
94  return converged_ || (corr_ == nCorrPIMPLE_);
95 }
96 
97 
99 {
100  bool finalInnerIter =
101  corrPISO_ == nCorrPISO_
102  && corrNonOrtho_ == nNonOrthCorr_ + 1;
103 
104  if (finalOnLastPimpleIterOnly_)
105  {
106  return finalInnerIter && finalIter();
107  }
108  else
109  {
110  return finalInnerIter;
111  }
112 }
113 
114 
116 {
117  return solveFlow_;
118 }
119 
120 
122 {
123  if (turbOnFinalIterOnly_)
124  {
125  if (finalIter())
126  {
127  setFirstIterFlag(true, true);
128  }
129  }
130  else
131  {
132  if (firstIter())
133  {
134  setFirstIterFlag(true, true);
135  }
136  else
137  {
138  setFirstIterFlag();
139  }
140  }
141 
142  return !turbOnFinalIterOnly_ || finalIter();
143 }
144 
145 
146 inline bool Foam::pimpleControl::ddtCorr() const
147 {
148  return ddtCorr_;
149 }
150 
151 
152 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::pimpleControl::corrPISO
label corrPISO() const
Current PISO corrector index.
Definition: pimpleControlI.H:43
Foam::pimpleControl::storeInitialResiduals
bool storeInitialResiduals() const
Return true to store the initial residuals.
Definition: pimpleControlI.H:79
Foam::pimpleControl::nCorrPIMPLE_
label nCorrPIMPLE_
Maximum number of PIMPLE correctors.
Definition: pimpleControl.H:78
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
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
Foam::pimpleControl::solveFlow
bool solveFlow() const
Return true to solve for flow.
Definition: pimpleControlI.H:115
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::finalInnerIter
bool finalInnerIter() const
Return true for final inner iteration.
Definition: pimpleControlI.H:98
Foam::pimpleControl::nCorrPIMPLE
label nCorrPIMPLE() const
Maximum number of PIMPLE correctors.
Definition: pimpleControlI.H:31