pimpleControlDF.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
5 
6  Description:
7  A modified version of pimpleControl
8  Basically, we disable the output to the screen
9 
10  This file is modified from OpenFOAM's source code
11  src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.H
12 
13  OpenFOAM: The Open Source CFD Toolbox
14 
15  Copyright (C): 2011-2016 OpenFOAM Foundation
16 
17  OpenFOAM License:
18 
19  OpenFOAM is free software: you can redistribute it and/or modify it
20  under the terms of the GNU General Public License as published by
21  the Free Software Foundation, either version 3 of the License, or
22  (at your option) any later version.
23 
24  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
25  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27  for more details.
28 
29  You should have received a copy of the GNU General Public License
30  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef pimpleControlDF_H
35 #define pimpleControlDF_H
36 
37 #include "solutionControl.H"
38 
39 //- Declare that pimpleControlDF will be used
40 #define PIMPLE_CONTROL
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class pimpleControlDF Declaration
49 \*---------------------------------------------------------------------------*/
50 
52  : public solutionControl
53 {
54  // Private member functions
55 
56  //- No copy construct
57  pimpleControlDF(const pimpleControlDF&) = delete;
58 
59  //- No copy assignment
60  void operator=(const pimpleControlDF&) = delete;
61 
62 protected:
63  // Protected data
64 
65  // Solution controls
66 
67  //- Flag to indicate whether to solve for the flow
68  bool solveFlow_;
69 
70  //- Maximum number of PIMPLE correctors
71  label nCorrPIMPLE_;
72 
73  //- Maximum number of PISO correctors
74  label nCorrPISO_;
75 
76  //- Current PISO corrector
77  label corrPISO_;
78 
79  //- Flag to indicate whether to update density in SIMPLE
80  // rather than PISO mode
81  bool SIMPLErho_;
82 
83  //- Flag to indicate whether to only solve turbulence on final iter
85 
86  //- Converged flag
87  bool converged_;
88 
89  // Protected Member Functions
90 
91  //- Read controls from fvSolution dictionary
92  virtual void read();
93 
94  //- Return true if all convergence checks are satisfied
95  virtual bool criteriaSatisfied();
96 
97  //- Set the firstIteration flag on the mesh data dictionary
98  virtual void setFirstIterFlag(
99  const bool check = true,
100  const bool force = false);
101 
102 public:
103  // Static Data Members
104 
105  //- Run-time type information
106  TypeName("pimpleControlDF");
107 
108  // Constructors
109 
110  //- Construct from mesh and the name of control sub-dictionary
111  pimpleControlDF(fvMesh& mesh, const word& dictName = "PIMPLE");
112 
113  //- Destructor
114  virtual ~pimpleControlDF() = default;
115 
116  // Member Functions
117 
118  // Access
119 
120  //- Maximum number of PIMPLE correctors
121  inline label nCorrPIMPLE() const;
122 
123  //- Maximum number of PISO correctors
124  inline label nCorrPISO() const;
125 
126  //- Current PISO corrector index
127  inline label corrPISO() const;
128 
129  //- Flag to indicate whether to update density in SIMPLE
130  // rather than PISO mode
131  inline bool SIMPLErho() const;
132 
133  // Solution control
134 
135  //- PIMPLE loop
136  virtual bool loop();
137 
138  //- Pressure corrector loop control
139  inline bool correct();
140 
141  //- Return true to store the intial residuals
142  inline bool storeInitialResiduals() const;
143 
144  //- Return true for first PIMPLE (outer) iteration
145  inline bool firstIter() const;
146 
147  //- Return true for final PIMPLE (outer) iteration
148  inline bool finalIter() const;
149 
150  //- Return true for final inner iteration
151  inline bool finalInnerIter() const;
152 
153  //- Return true to solve for flow
154  inline bool solveFlow() const;
155 
156  //- Return true to solve for turbulence
157  inline bool turbCorr();
158 };
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #include "pimpleControlIDF.H"
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
Foam::pimpleControlDF::loop
virtual bool loop()
Definition: pimpleControlDF.C:182
Foam::pimpleControlDF::solveFlow_
bool solveFlow_
Definition: pimpleControlDF.H:68
Foam::pimpleControlDF::firstIter
bool firstIter() const
Definition: pimpleControlIDF.H:81
Foam::pimpleControlDF::TypeName
TypeName("pimpleControlDF")
Foam::pimpleControlDF
Definition: pimpleControlDF.H:51
Foam::pimpleControlDF::corrPISO_
label corrPISO_
Definition: pimpleControlDF.H:77
Foam::pimpleControlDF::setFirstIterFlag
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Definition: pimpleControlDF.C:123
Foam::pimpleControlDF::nCorrPIMPLE
label nCorrPIMPLE() const
Definition: pimpleControlIDF.H:32
Foam::pimpleControlDF::~pimpleControlDF
virtual ~pimpleControlDF()=default
Foam::pimpleControlDF::nCorrPISO_
label nCorrPISO_
Definition: pimpleControlDF.H:74
Foam::pimpleControlDF::nCorrPIMPLE_
label nCorrPIMPLE_
Definition: pimpleControlDF.H:71
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::pimpleControlDF::finalIter
bool finalIter() const
Definition: pimpleControlIDF.H:86
pimpleControlIDF.H
Foam::pimpleControlDF::SIMPLErho_
bool SIMPLErho_
Definition: pimpleControlDF.H:81
Foam::pimpleControlDF::SIMPLErho
bool SIMPLErho() const
Definition: pimpleControlIDF.H:47
Foam::pimpleControlDF::nCorrPISO
label nCorrPISO() const
Definition: pimpleControlIDF.H:37
Foam::pimpleControlDF::read
virtual void read()
Definition: pimpleControlDF.C:41
Foam
Definition: multiFreqScalarFvPatchField.C:144
Foam::pimpleControlDF::criteriaSatisfied
virtual bool criteriaSatisfied()
Definition: pimpleControlDF.C:55
Foam::pimpleControlDF::converged_
bool converged_
Definition: pimpleControlDF.H:87
Foam::pimpleControlDF::storeInitialResiduals
bool storeInitialResiduals() const
Definition: pimpleControlIDF.H:75
Foam::pimpleControlDF::turbOnFinalIterOnly_
bool turbOnFinalIterOnly_
Definition: pimpleControlDF.H:84
Foam::pimpleControlDF::corrPISO
label corrPISO() const
Definition: pimpleControlIDF.H:42
Foam::pimpleControlDF::solveFlow
bool solveFlow() const
Definition: pimpleControlIDF.H:97
Foam::pimpleControlDF::correct
bool correct()
Definition: pimpleControlIDF.H:52
Foam::pimpleControlDF::finalInnerIter
bool finalInnerIter() const
Definition: pimpleControlIDF.H:91
Foam::pimpleControlDF::turbCorr
bool turbCorr()
Definition: pimpleControlIDF.H:102