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  return false;
80  }
81 
82  nCorrPimple_ = dict().lookupOrDefault<label>("nOuterCorrectors", 1);
83 
84  return true;
85 }
86 
87 
89 {
90  read();
91 
92  if (!pimpleLoop::loop(*this))
93  {
94  updateFinal();
95 
96  return false;
97  }
98 
100 
101  updateFinal();
102 
103  return true;
104 }
105 
106 
108 {
109  read();
110 
111  if (!endIfConverged(time))
112  {
114  }
115 
116  return time.run();
117 }
118 
119 
121 {
122  read();
123 
124  if (!endIfConverged(time))
125  {
127  }
128 
129  return time.loop();
130 }
131 
132 
133 // ************************************************************************* //
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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:836
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:256
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:799
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
virtual const dictionary & dict() const
Return the solution dictionary.
bool loop()
Pimple loop.
Definition: pimpleControl.C:88
virtual bool read()
Read controls.
Definition: pimpleLoop.C:38
const Time & time() const
Return the time.
static const char nl
Definition: Ostream.H:265
void storePrevIterFields()
Store previous iteration for fields.
defineTypeNameAndDebug(combustionModel, 0)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
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 convergance 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.