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 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  read();
74 
75  if (finalPISOIter())
76  {
77  corrPISO_ = 0;
78  return false;
79  }
80 
81  ++ corrPISO_;
82 
83  return true;
84 }
85 
86 
88 {
89  return time.run();
90 }
91 
92 
94 {
95  return time.loop();
96 }
97 
98 
99 // ************************************************************************* //
label nCorrPISO_
Maximum number of PISO correctors.
Definition: pisoControl.H:61
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:836
pisoControl(fvMesh &mesh, const word &algorithmName="PISO")
Construct from a mesh and the name of the algorithm.
Definition: pisoControl.C:38
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
bool finalPISOIter() const
Flag to indicate the last PISO iteration.
Definition: pisoControlI.H:40
virtual const dictionary & dict() const
Return the solution dictionary.
virtual bool read()
Read controls.
Definition: pisoControl.C:56
label corrPISO_
Current PISO corrector.
Definition: pisoControl.H:64
bool correct()
PISO loop.
Definition: pisoControl.C:71
const Time & time() const
Return the time.
defineTypeNameAndDebug(combustionModel, 0)
virtual bool read()
Read controls.
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:78
bool loop(Time &time)
Time loop loop.
Definition: pisoControl.C:93
bool run(Time &time)
Time run loop.
Definition: pisoControl.C:87
Fluid solution control class. Holds flags specific to the solution of fluids.
Namespace for OpenFOAM.