pimpleControl.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) 2018-2022 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 #include "pimpleControl.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(pimpleControl, 0);
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 :
40  pimpleNoLoopControl(mesh, algorithmName, *this),
41  pimpleLoop(static_cast<solutionControl&>(*this))
42 {
43  read();
44 
46 
47  if (nCorrPimple_ > 1)
48  {
50  }
51 
52  Info<< nl << algorithmName << ": Operating solver in "
53  << (mesh.schemes().steady()
54  ? "steady-state"
55  : mesh.schemes().transient() ? "transient" :
56  "mixed steady-state/transient") << " mode with " << nCorrPimple_
57  << " outer corrector" << (nCorrPimple_ == 1 ? "" : "s") << nl;
58 
59  if (nCorrPimple_ == 1)
60  {
61  Info<< algorithmName << ": Operating solver in "
62  << (mesh.schemes().steady() ? "SIMPLE" : "PISO") << " mode" << nl;
63  }
64 
65  Info<< nl << endl;
66 }
67 
68 
69 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
70 
72 {}
73 
74 
75 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
76 
78 {
80 }
81 
82 
84 {
85  read();
86 
87  if (!pimpleLoop::loop(*this))
88  {
89  updateFinal();
90 
91  return false;
92  }
93 
95 
96  updateFinal();
97 
98  return true;
99 }
100 
101 
103 {
104  read();
105 
106  if (!endIfConverged(time))
107  {
109  }
110 
111  return time.run();
112 }
113 
114 
116 {
117  read();
118 
119  if (!endIfConverged(time))
120  {
122  }
123 
124  return time.loop();
125 }
126 
127 
128 // ************************************************************************* //
bool loop(correctorConvergenceControl &convergence)
Pimple loop.
Definition: pimpleLoop.C:66
void printCorrResidualControls(const label n) const
Print the residual controls.
virtual bool read()
Read controls.
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1672
pimpleControl(fvMesh &mesh, const word &algorithmName="PIMPLE")
Construct from a mesh and the name of the algorithm.
Definition: pimpleControl.C:38
virtual bool read()
Read controls.
Definition: pimpleControl.C:77
bool run(Time &time)
Time run loop.
Solution control class.
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:922
Pimple loop class. Implements the logic which controls the pimple loop generically for a given correc...
Definition: pimpleLoop.H:51
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
fvMesh & mesh
bool transient() const
Return true if the default ddtScheme is not steadyState.
Definition: fvSchemes.H:140
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
virtual bool run() const
Return true if run should continue,.
Definition: Time.C:875
A class for handling words, derived from string.
Definition: word.H:59
bool loop()
Pimple loop.
Definition: pimpleControl.C:83
virtual bool read()
Read controls.
Definition: pimpleLoop.C:38
const Time & time() const
Return the time.
static const char nl
Definition: Ostream.H:260
void storePrevIterFields()
Store previous iteration for fields.
defineTypeNameAndDebug(combustionModel, 0)
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
bool steady() const
Return true if the default ddtScheme is steadyState.
Definition: fvSchemes.H:134
label nCorrPimple_
Maximum number of pimple correctors.
Definition: pimpleLoop.H:61
messageStream Info
bool endIfConverged(Time &time)
End the run if convergence has been reached.
void updateFinal() const
Update the mesh data for the final state.
virtual ~pimpleControl()
Destructor.
Definition: pimpleControl.C:71
void printResidualControls() const
Print the residual controls.
Namespace for OpenFOAM.