SIMPLEControl.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2007-2023 PCOpt/NTUA
9  Copyright (C) 2013-2023 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 
29 Class
30  Foam::SIMPLEControl
31 
32 Description
33  SIMPLE control class to supply convergence information/checks for
34  the SIMPLE loop.
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef SIMPLEControl_H
39 #define SIMPLEControl_H
40 
41 #include "solverControl.H"
42 #include "simpleControl.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class SIMPLEControl Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class SIMPLEControl
54 :
55  public solverControl,
56  public simpleControl
57 {
58 
59 protected:
60 
61  // Protected Data
62 
63  //- Optimisation type
65 
66  //- Number of SIMPLE iterations
67  label nIters_;
68 
69  //- Pressure reference cell
70  label pRefCell_;
71  //
72  //- Pressure reference value
73  scalar pRefValue_;
74 
75 
76 private:
77 
78  //- No copy construct
79  SIMPLEControl(const SIMPLEControl&) = delete;
80 
81  //- No copy assignment
82  void operator=(const SIMPLEControl&) = delete;
83 
84 
85 public:
86 
87 
88  // Static Data Members
89 
90  //- Run-time type information
91  TypeName("SIMPLEControl");
92 
93 
94  // Declare run-time constructor selection table
95 
97  (
98  autoPtr,
100  dictionary,
101  (
102  fvMesh& mesh,
103  const word& managerType,
104  const solver& solver
105  ),
106  (mesh, managerType, solver)
107  );
108 
109 
110  // Constructors
111 
112  //- Construct from mesh
114  (
115  fvMesh& mesh,
116  const word& managerType,
117  const solver& solver
118  );
119 
120 
121  //- Destructor
122  virtual ~SIMPLEControl() = default;
123 
124 
125  // Selectors
126 
127  //- Return a reference to the selected turbulence model
129  (
130  fvMesh& mesh,
131  const word& managerType,
132  const solver& solver
133  );
134 
135 
136  // Member Functions
137 
138  virtual bool read();
139 
140  virtual void readIters();
141 
142  void checkMeanSolution() const;
143 
144  // Access
145 
146  //- Return the solution dictionary
147  inline virtual const dictionary dict() const;
148 
149  //- Return pressure reference cell
150  inline label& pRefCell();
151 
152  //- Return pressure reference value
153  inline scalar& pRefValue();
154 
155  // Solution control
156 
157  //- Whether to call time.write() or not
158  virtual bool write(const bool valid = true) const = 0;
159 
160  // Evolution
161 
162  //- Loop
163  virtual bool loop() = 0;
164 
165  //- Is the solver converged
166  virtual bool converged();
167 
168  //- Perform this iteration?
169  virtual bool performIter();
170 
171  //- Increment iteration counter
172  virtual void incrementIter();
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 #include "SIMPLEControlI.H"
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
virtual bool performIter()
Perform this iteration?
Base solver class.
Definition: solver.H:45
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
scalar pRefValue_
Pressure reference value.
Definition: SIMPLEControl.H:74
virtual ~SIMPLEControl()=default
Destructor.
scalar & pRefValue()
Return pressure reference value.
virtual void incrementIter()
Increment iteration counter.
declareRunTimeSelectionTable(autoPtr, SIMPLEControl, dictionary,(fvMesh &mesh, const word &managerType, const solver &solver),(mesh, managerType, solver))
virtual void readIters()
Definition: SIMPLEControl.C:99
virtual bool converged()
Is the solver converged.
virtual bool write(const bool valid=true) const =0
Whether to call time.write() or not.
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
Base class for solver control classes.
Definition: solverControl.H:45
virtual bool read()
Read controls from fvSolution dictionary.
Definition: SIMPLEControl.C:79
virtual bool loop()=0
Loop.
virtual const dictionary dict() const
Return the solution dictionary.
static autoPtr< SIMPLEControl > New(fvMesh &mesh, const word &managerType, const solver &solver)
Return a reference to the selected turbulence model.
Definition: SIMPLEControl.C:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
label & pRefCell()
Return pressure reference cell.
label pRefCell_
Pressure reference cell.
Definition: SIMPLEControl.H:69
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
Definition: SIMPLEControl.H:46
label nIters_
Number of SIMPLE iterations.
Definition: SIMPLEControl.H:64
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
TypeName("SIMPLEControl")
Run-time type information.
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
Definition: simpleControl.H:48
void checkMeanSolution() const
Namespace for OpenFOAM.
const word & managerType_
Optimisation type.
Definition: SIMPLEControl.H:59