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 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),
41  pimpleLoop(static_cast<solutionControl&>(*this))
42 {
43  read();
44 
46 
47  if (nCorrPimple_ > 1)
48  {
50  }
51  else
52  {
53  Info<< nl << algorithmName << ": Operating solver in PISO mode" << nl
54  << endl;
55  }
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
62 {}
63 
64 
65 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
66 
68 {
70  {
71  return false;
72  }
73 
74  nCorrPimple_ = dict().lookupOrDefault<label>("nOuterCorrectors", 1);
75 
76  return true;
77 }
78 
79 
81 {
82  read();
83 
84  if (!pimpleLoop::loop(*this))
85  {
86  mesh().data::remove("finalIteration");
87 
88  return false;
89  }
90 
92 
93  if (finalIter())
94  {
95  mesh().data::add("finalIteration", true);
96  }
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.
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:67
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
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:80
const fvMesh & mesh() const
Return the mesh.
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...
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.
virtual ~pimpleControl()
Destructor.
Definition: pimpleControl.C:61
void printResidualControls() const
Print the residual controls.
bool finalIter() const
Flag to indicate the last iteration.
Definition: pimpleLoopI.H:52
Namespace for OpenFOAM.