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-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 "pisoControl.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(pisoControl, 0);
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
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 
72 {
73  return
77 }
78 
79 
81 {
82  read();
83 
84  if (finalPisoIter())
85  {
86  corrPiso_ = 0;
87 
88  updateFinal();
89 
90  return false;
91  }
92 
93  ++ corrPiso_;
94 
95  updateFinal();
96 
97  return true;
98 }
99 
100 
102 {
103  return time.run();
104 }
105 
106 
108 {
109  return time.loop();
110 }
111 
112 
113 // ************************************************************************* //
bool finalNonOrthogonalIter() const
Flag to indicate the last non-orthogonal iteration.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
bool anyPisoIter() const
Flag to indicate any piso iteration.
Definition: pisoControlI.H:34
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:922
pisoControl(fvMesh &mesh, const word &algorithmName="PISO")
Construct from a mesh and the name of the algorithm.
Definition: pisoControl.C:38
fvMesh & mesh
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
virtual const dictionary & dict() const
Return the solution dictionary.
virtual bool read()
Read controls.
Definition: pisoControl.C:56
bool correct()
Piso loop.
Definition: pisoControl.C:80
const Time & time() const
Return the time.
virtual bool isFinal() const
Flag to indicate whether in final state.
Definition: pisoControl.C:71
defineTypeNameAndDebug(combustionModel, 0)
bool finalPisoIter() const
Flag to indicate the last piso iteration.
Definition: pisoControlI.H:46
virtual bool read()
Read controls.
label corrPiso_
Current piso corrector.
Definition: pisoControl.H:64
virtual ~pisoControl()
Destructor.
Definition: pisoControl.C:50
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:95
bool loop(Time &time)
Time loop loop.
Definition: pisoControl.C:107
bool run(Time &time)
Time run loop.
Definition: pisoControl.C:101
bool anyNonOrthogonalIter() const
Flag to indicate any non-orthogonal iteration.
Fluid solution control class. Holds flags specific to the solution of fluids.
void updateFinal() const
Update the mesh data for the final state.
label nCorrPiso_
Maximum number of piso correctors.
Definition: pisoControl.H:61
Namespace for OpenFOAM.