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-2024 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  pimple_.printResidualControls();
49 
50  if (nCorr_ > 1)
51  {
53  }
54 
55  Info<< nl << pimple_.algorithmName() << ": Operating solver in "
56  << (pimple_.mesh().schemes().steady()
57  ? "steady-state"
58  : pimple_.mesh().schemes().transient() ? "transient" :
59  "mixed steady-state/transient") << " mode with " << nCorr_
60  << " outer corrector" << (nCorr_ == 1 ? "" : "s") << nl;
61 
62  if (nCorr_ == 1)
63  {
64  Info<< pimple_.algorithmName() << ": Operating solver in "
65  << (pimple_.mesh().schemes().steady() ? "SIMPLE" : "PISO")
66  << " mode" << nl;
67  }
68 
69  Info<< nl << endl;
70 }
71 
72 
73 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74 
76 {
77  pimple_.pimpleLoopPtr_ = nullptr;
78 }
79 
80 
81 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
82 
84 {
85  return pimpleLoop::read();
86 }
87 
88 
90 {
91  if (!pimpleLoop::loop(pimple_))
92  {
93  pimple_.updateFinal(pimple_.isFinal(finalIter()));
94 
95  return false;
96  }
97 
98  pimple_.storePrevIterFields();
99 
100  pimple_.updateFinal(pimple_.isFinal(finalIter()));
101 
102  return true;
103 }
104 
105 
107 {
108  if (!pimple_.endIfConverged(time))
109  {
110  pimple_.storePrevIterFields();
111  }
112 
113  return time.run();
114 }
115 
116 
118 {
119  if (!pimple_.endIfConverged(time))
120  {
121  pimple_.storePrevIterFields();
122  }
123 
124  return time.loop();
125 }
126 
127 
128 // ************************************************************************* //
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:890
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:937
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1799
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:258
messageStream Info
defineTypeNameAndDebug(combustionModel, 0)
static const char nl
Definition: Ostream.H:267