pimpleSingleRegionControl.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022-2023 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 
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 (
41 )
42 :
44  pimple_(pimple)
45 {
46  pimple_.pimpleLoopPtr_ = this;
47 
48  read();
49 
50  pimple_.printResidualControls();
51 
52  if (nCorr_ > 1)
53  {
55  }
56 
57  Info<< nl << pimple_.algorithmName() << ": Operating solver in "
58  << (pimple_.mesh().schemes().steady()
59  ? "steady-state"
60  : pimple_.mesh().schemes().transient() ? "transient" :
61  "mixed steady-state/transient") << " mode with " << nCorr_
62  << " outer corrector" << (nCorr_ == 1 ? "" : "s") << nl;
63 
64  if (nCorr_ == 1)
65  {
66  Info<< pimple_.algorithmName() << ": Operating solver in "
67  << (pimple_.mesh().schemes().steady() ? "SIMPLE" : "PISO")
68  << " mode" << nl;
69  }
70 
71  Info<< nl << endl;
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
76 
78 {
79  pimple_.pimpleLoopPtr_ = nullptr;
80 }
81 
82 
83 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
84 
86 {
87  return pimple_.read() && pimpleLoop::read();
88 }
89 
90 
92 {
93  if (!pimpleLoop::loop(pimple_))
94  {
95  pimple_.updateFinal(pimple_.isFinal(finalIter()));
96 
97  return false;
98  }
99 
100  pimple_.storePrevIterFields();
101 
102  pimple_.updateFinal(pimple_.isFinal(finalIter()));
103 
104  return true;
105 }
106 
107 
109 {
110  if (!pimple_.endIfConverged(time))
111  {
112  pimple_.storePrevIterFields();
113  }
114 
115  return time.run();
116 }
117 
118 
120 {
121  if (!pimple_.endIfConverged(time))
122  {
123  pimple_.storePrevIterFields();
124  }
125 
126  return time.loop();
127 }
128 
129 
130 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
virtual bool run() const
Return true if run should continue,.
Definition: Time.C:901
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:948
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1751
bool transient() const
Return true if the default ddtScheme is not steadyState.
Definition: fvSchemes.H:153
bool steady() const
Return true if the default ddtScheme is steadyState.
Definition: fvSchemes.H:147
Pimple loop class. Implements the logic which controls the pimple loop generically for a given correc...
Definition: pimpleLoop.H:52
bool loop(correctorConvergenceControl &convergence)
Pimple loop.
Definition: pimpleLoop.C:67
label nCorr_
Maximum number of correctors.
Definition: pimpleLoop.H:61
virtual bool read()
Read controls.
Definition: pimpleLoop.C:38
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
Pimple single region control class. Provides time-loop control methods which exit the simulation once...
bool run(Time &time)
Time run loop.
pimpleSingleRegionControl(pimpleNoLoopControl &pimple)
Construct from single region pimple.
virtual bool read()
Read controls.
void printResidualControls() const
Print the residual controls.
void printCorrResidualControls(const label n) const
Print the residual controls.
const fvMesh & mesh() const
Return the mesh.
const word & algorithmName() const
Return the name of the algorithm.
pimpleControl pimple(mesh)
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
defineTypeNameAndDebug(combustionModel, 0)
static const char nl
Definition: Ostream.H:266