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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
31 {
32  return nCorrPIMPLE_;
33 }
34 
35 
37 {
38  return nCorrPISO_;
39 }
40 
41 
43 {
44  return corrPISO_;
45 }
46 
47 
48 inline bool Foam::pimpleControl::SIMPLErho() const
49 {
50  return SIMPLErho_;
51 }
52 
53 
55 {
56  setFirstIterFlag();
57 
58  ++corrPISO_;
59 
60  if (debug)
61  {
62  Info<< algorithmName_ << " correct: corrPISO = " << corrPISO_ << endl;
63  }
64 
65  if (corrPISO_ <= nCorrPISO_)
66  {
67  return true;
68  }
69 
70  corrPISO_ = 0;
71 
72  setFirstIterFlag();
73 
74  return false;
75 }
76 
77 
79 {
80  // Start from second PIMPLE iteration
81  return (corr_ == 2) && (corrPISO_ == 0) && (corrNonOrtho_ == 0);
82 }
83 
84 
85 inline bool Foam::pimpleControl::firstIter() const
86 {
87  return corr_ == 1;
88 }
89 
90 
91 inline bool Foam::pimpleControl::finalIter() const
92 {
93  return converged_ || (corr_ == nCorrPIMPLE_);
94 }
95 
96 
98 {
99  return
100  corrPISO_ == nCorrPISO_
101  && corrNonOrtho_ == nNonOrthCorr_ + 1;
102 }
103 
104 
106 {
107  return solveFlow_;
108 }
109 
110 
112 {
113  if (turbOnFinalIterOnly_)
114  {
115  if (finalIter())
116  {
117  setFirstIterFlag(true, true);
118  }
119  }
120  else
121  {
122  if (firstIter())
123  {
124  setFirstIterFlag(true, true);
125  }
126  else
127  {
128  setFirstIterFlag();
129  }
130  }
131 
132  return !turbOnFinalIterOnly_ || finalIter();
133 }
134 
135 
136 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::pimpleControl::corrPISO
label corrPISO() const
Current PISO corrector index.
Definition: pimpleControlI.H:42
Foam::pimpleControl::storeInitialResiduals
bool storeInitialResiduals() const
Return true to store the intial residuals.
Definition: pimpleControlI.H:78
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:337
Foam::label
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:62
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::pimpleControl::finalIter
bool finalIter() const
Return true for final PIMPLE (outer) iteration.
Definition: pimpleControlI.H:91
Foam::pimpleControl::solveFlow
bool solveFlow() const
Return true to solve for flow.
Definition: pimpleControlI.H:105
Foam::pimpleControl::nCorrPISO
label nCorrPISO() const
Maximum number of PISO correctors.
Definition: pimpleControlI.H:36
Foam::pimpleControl::turbCorr
bool turbCorr()
Return true to solve for turbulence.
Definition: pimpleControlI.H:111
Foam::pimpleControl::correct
bool correct()
Pressure corrector loop control.
Definition: pimpleControlI.H:54
Foam::pimpleControl::firstIter
bool firstIter() const
Return true for first PIMPLE (outer) iteration.
Definition: pimpleControlI.H:85
Foam::pimpleControl::SIMPLErho
bool SIMPLErho() const
Flag to indicate whether to update density in SIMPLE.
Definition: pimpleControlI.H:48
Foam::pimpleControl::finalInnerIter
bool finalInnerIter() const
Return true for final inner iteration.
Definition: pimpleControlI.H:97
Foam::pimpleControl::nCorrPIMPLE
label nCorrPIMPLE() const
Maximum number of PIMPLE correctors.
Definition: pimpleControlI.H:30