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-2019 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.steady() ? "steady-state" : mesh.transient() ? "transient" :
54  "mixed steady-state/transient") << " mode with " << nCorrPimple_
55  << " outer corrector" << (nCorrPimple_ == 1 ? "" : "s") << nl;
56 
57  if (nCorrPimple_ == 1)
58  {
59  Info<< algorithmName << ": Operating solver in "
60  << (mesh.steady() ? "SIMPLE" : "PISO") << " mode" << nl;
61  }
62 
63  Info<< nl << endl;
64 }
65 
66 
67 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
68 
70 {}
71 
72 
73 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
74 
76 {
78 }
79 
80 
82 {
83  read();
84 
85  if (!pimpleLoop::loop(*this))
86  {
87  updateFinal();
88 
89  return false;
90  }
91 
93 
94  updateFinal();
95 
96  return true;
97 }
98 
99 
101 {
102  read();
103 
104  if (!endIfConverged(time))
105  {
107  }
108 
109  return time.run();
110 }
111 
112 
114 {
115  read();
116 
117  if (!endIfConverged(time))
118  {
120  }
121 
122  return time.loop();
123 }
124 
125 
126 // ************************************************************************* //
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.
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:75
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:862
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
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:68
virtual bool run() const
Return true if run should continue,.
Definition: Time.C:815
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
bool loop()
Pimple loop.
Definition: pimpleControl.C:81
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:78
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:69
void printResidualControls() const
Print the residual controls.
Namespace for OpenFOAM.