Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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 * * * * * * * * * * * * * //
31inline Foam::label Foam::pimpleControl::nCorrPIMPLE() const
32{
33 return nCorrPIMPLE_;
34}
35
37inline Foam::label Foam::pimpleControl::nCorrPISO() const
38{
39 return nCorrPISO_;
40}
41
43inline Foam::label Foam::pimpleControl::corrPISO() const
44{
45 return corrPISO_;
46}
47
49inline 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;
74
75 return false;
76}
77
78
80{
81 // Start from second PIMPLE iteration
82 return (corr_ == 2) && (corrPISO_ == 0) && (corrNonOrtho_ == 0);
83}
84
86inline bool Foam::pimpleControl::firstIter() const
87{
88 return corr_ == 1;
89}
90
92inline 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
115inline bool Foam::pimpleControl::solveFlow() const
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();
140 }
141
142 return !turbOnFinalIterOnly_ || finalIter();
143}
144
145
146inline bool Foam::pimpleControl::ddtCorr() const
147{
148 return ddtCorr_;
149}
150
151
152// ************************************************************************* //
bool SIMPLErho() const
Flag to indicate whether to update density in SIMPLE.
bool SIMPLErho_
Flag to indicate whether to update density in SIMPLE rather than PISO mode.
label corrPISO_
Current PISO corrector.
bool finalIter() const
Return true for final PIMPLE (outer) iteration.
label corrPISO() const
Current PISO corrector index.
label nCorrPIMPLE() const
Maximum number of PIMPLE correctors.
bool turbCorr()
Return true to solve for turbulence.
bool finalOnLastPimpleIterOnly_
Flag to indicate wheter the final solver is used only on the final pimple iter.
label nCorrPISO_
Maximum number of PISO correctors.
label nCorrPIMPLE_
Maximum number of PIMPLE correctors.
bool finalInnerIter() const
Return true for final inner iteration.
bool storeInitialResiduals() const
Return true to store the initial residuals.
bool solveFlow_
Flag to indicate whether to solve for the flow.
bool correct()
Pressure corrector loop control.
bool firstIter() const
Return true for first PIMPLE (outer) iteration.
bool turbOnFinalIterOnly_
Flag to indicate whether to only solve turbulence on final iter.
bool ddtCorr() const
Return true to apply ddtCorr.
bool ddtCorr_
Flag to indicate that ddtCorr should be applied; default = yes.
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
label nCorrPISO() const
Maximum number of PISO correctors.
bool solveFlow() const
Return true to solve for flow.
bool converged_
Converged flag.
const word algorithmName_
The dictionary name, e.g. SIMPLE, PIMPLE.
label corrNonOrtho_
Current non-orthogonal corrector loop index.
label corr_
Current corrector loop index.
label nNonOrthCorr_
Maximum number of non-orthogonal correctors.
Namespace for handling debugging switches.
Definition debug.C:45
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519