Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
12License
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
29Class
30 Foam::SIMPLEControl
31
32Description
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
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class SIMPLEControl Declaration
51\*---------------------------------------------------------------------------*/
52
53class SIMPLEControl
54:
55 public solverControl,
56 public simpleControl
57{
58
59protected:
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_;
75
76private:
77
78 //- No copy construct
79 SIMPLEControl(const SIMPLEControl&) = delete;
80
81 //- No copy assignment
82 void operator=(const SIMPLEControl&) = delete;
83
84
85public:
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 (
99 SIMPLEControl,
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
113 SIMPLEControl
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
180#include "SIMPLEControlI.H"
181
182// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183
184#endif
185
186// ************************************************************************* //
label pRefCell_
Pressure reference cell.
virtual bool converged()
Is the solver converged.
declareRunTimeSelectionTable(autoPtr, SIMPLEControl, dictionary,(fvMesh &mesh, const word &managerType, const solver &solver),(mesh, managerType, solver))
static autoPtr< SIMPLEControl > New(fvMesh &mesh, const word &managerType, const solver &solver)
Return a reference to the selected turbulence model.
virtual void readIters()
virtual void incrementIter()
Increment iteration counter.
label nIters_
Number of SIMPLE iterations.
TypeName("SIMPLEControl")
Run-time type information.
label & pRefCell()
Return pressure reference cell.
scalar & pRefValue()
Return pressure reference value.
virtual bool write(const bool valid=true) const =0
Whether to call time.write() or not.
virtual const dictionary dict() const
Return the solution dictionary.
const word & managerType_
Optimisation type.
scalar pRefValue_
Pressure reference value.
void checkMeanSolution() const
virtual ~SIMPLEControl()=default
Destructor.
virtual bool loop()=0
Loop.
virtual bool performIter()
Perform this iteration?
virtual bool read()
Read controls from optimisationDict.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Base solver class.
Definition solver.H:48
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Namespace for OpenFOAM.
runTime write()
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68