pisoControl.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 "pisoControl.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
38 Foam::pisoControl::pisoControl(fvMesh& mesh, const word& algorithmName)
39 :
40  fluidSolutionControl(mesh, algorithmName),
41  nCorrPiso_(-1),
42  corrPiso_(0)
43 {
44  read();
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
49 
51 {}
52 
53 
54 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
55 
57 {
59  {
60  return false;
61  }
62 
63  const dictionary& solutionDict = dict();
64 
65  nCorrPiso_ = solutionDict.lookupOrDefault<label>("nCorrectors", 1);
66 
67  return true;
68 }
69 
70 
71 bool Foam::pisoControl::isFinal(const bool finalIter) const
72 {
73  return (finalIter && !anyPisoIter()) || finalPisoIter();
74 }
75 
76 
77 bool Foam::pisoControl::correct(const bool finalIter)
78 {
79  read();
80 
81  if (finalPisoIter())
82  {
83  corrPiso_ = 0;
84 
85  updateFinal(isFinal(finalIter));
86 
87  return false;
88  }
89 
90  corrPiso_++;
91 
92  updateFinal(isFinal(finalIter));
93 
94  return true;
95 }
96 
97 
98 bool Foam::pisoControl::correctNonOrthogonal(const bool finalIter)
99 {
101  (
102  isFinal(finalIter)
103  );
104 }
105 
106 
108 {
109  return time.run();
110 }
111 
112 
114 {
115  return time.loop();
116 }
117 
118 
119 // ************************************************************************* //
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:855
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:902
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Fluid solution control class. Holds flags specific to the solution of fluids.
virtual bool read()
Read controls.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
bool correctNonOrthogonal(const bool finalIter=false)
Non-orthogonal corrector loop.
Piso control class. Provides time-loop and piso-loop control methods. No convergence checking is done...
Definition: pisoControl.H:55
virtual ~pisoControl()
Destructor.
Definition: pisoControl.C:50
pisoControl(fvMesh &mesh, const word &algorithmName="PISO")
Construct from a mesh and the name of the algorithm.
Definition: pisoControl.C:38
bool isFinal(const bool finalIter) const
Flag to indicate whether in final state.
Definition: pisoControl.C:71
bool run(Time &time)
Time run loop.
Definition: pisoControl.C:107
bool correct(const bool finalIter=false)
Piso loop within outer loop.
Definition: pisoControl.C:77
bool correctNonOrthogonal(const bool finalIter=true)
Non-orthogonal corrector loop.
Definition: pisoControl.C:98
bool loop(Time &time)
Time loop loop.
Definition: pisoControl.C:113
virtual bool read()
Read controls.
Definition: pisoControl.C:56
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
bool read(const char *, int32_t &)
Definition: int32IO.C:85
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
defineTypeNameAndDebug(combustionModel, 0)
dictionary dict