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 | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
27 
29 {
30  return nCorrPIMPLE_;
31 }
32 
33 
35 {
36  return nCorrPISO_;
37 }
38 
39 
41 {
42  return corrPISO_;
43 }
44 
45 
47 {
48  corrPISO_++;
49 
50  if (debug)
51  {
52  Info<< algorithmName_ << " correct: corrPISO = " << corrPISO_ << endl;
53  }
54 
55  if (corrPISO_ <= nCorrPISO_)
56  {
57  return true;
58  }
59  else
60  {
61  corrPISO_ = 0;
62  return false;
63  }
64 }
65 
66 
68 {
69  // Start from second PIMPLE iteration
70  return (corr_ == 2) && (corrPISO_ == 0) && (corrNonOrtho_ == 0);
71 }
72 
73 
74 inline bool Foam::pimpleControl::firstIter() const
75 {
76  return corr_ == 1;
77 }
78 
79 
80 inline bool Foam::pimpleControl::finalIter() const
81 {
82  return converged_ || (corr_ == nCorrPIMPLE_);
83 }
84 
85 
87 {
88  return
89  finalIter()
90  && corrPISO_ == nCorrPISO_
91  && corrNonOrtho_ == nNonOrthCorr_ + 1;
92 }
93 
94 
95 inline bool Foam::pimpleControl::turbCorr() const
96 {
97  return !turbOnFinalIterOnly_ || finalIter();
98 }
99 
100 
101 // ************************************************************************* //
bool correct()
Pressure corrector loop.
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:59
label nCorrPISO_
Maximum number of PISO correctors.
Definition: pimpleControl.H:75
bool storeInitialResiduals() const
Helper function to identify when to store the intial residuals.
label nNonOrthCorr_
Maximum number of non-orthogonal correctors.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
bool finalInnerIter() const
Helper function to identify final inner iteration.
label nCorrPISO() const
Maximum number of PISO correctors.
bool turbCorr() const
Helper function to identify whether to solve for turbulence.
label corrPISO_
Current PISO corrector.
Definition: pimpleControl.H:78
label corrPISO() const
Current PISO corrector index.
const word algorithmName_
The dictionary name, e.g. SIMPLE, PIMPLE.
label nCorrPIMPLE_
Maximum number of PIMPLE correctors.
Definition: pimpleControl.H:72
bool turbOnFinalIterOnly_
Flag to indicate whether to only solve turbulence on final iter.
Definition: pimpleControl.H:81
label corr_
Current corrector loop index.
bool firstIter() const
Helper function to identify first PIMPLE (outer) iteration.
label corrNonOrtho_
Current non-orthogonal corrector loop index.
label nCorrPIMPLE() const
Maximum number of PIMPLE correctors.
messageStream Info
bool converged_
Converged flag.
Definition: pimpleControl.H:84
bool finalIter() const
Helper function to identify final PIMPLE (outer) iteration.