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-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 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
64  const word& managerType_;
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 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 #include "SIMPLEControlI.H"
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Foam::SIMPLEControl::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, SIMPLEControl, dictionary,(fvMesh &mesh, const word &managerType, const solver &solver),(mesh, managerType, solver))
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::simpleControl
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
Definition: simpleControl.H:52
Foam::SIMPLEControl::pRefValue
scalar & pRefValue()
Return pressure reference value.
Definition: SIMPLEControlI.H:45
Foam::SIMPLEControl::pRefCell
label & pRefCell()
Return pressure reference cell.
Definition: SIMPLEControlI.H:39
Foam::solverControl
Base class for solver control classes.
Definition: solverControl.H:51
Foam::SIMPLEControl::~SIMPLEControl
virtual ~SIMPLEControl()=default
Destructor.
Foam::SIMPLEControl::managerType_
const word & managerType_
Optimisation type.
Definition: SIMPLEControl.H:63
Foam::SIMPLEControl::TypeName
TypeName("SIMPLEControl")
Run-time type information.
SIMPLEControlI.H
Foam::solver
Base class for solution control classes.
Definition: solver.H:51
Foam::SIMPLEControl::dict
virtual const dictionary dict() const
Return the solution dictionary.
Definition: SIMPLEControlI.H:33
Foam::SIMPLEControl::read
virtual bool read()
Read controls from fvSolution dictionary.
Definition: SIMPLEControl.C:86
simpleControl.H
Foam::SIMPLEControl::checkMeanSolution
void checkMeanSolution() const
Definition: SIMPLEControl.C:112
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::SIMPLEControl::write
virtual bool write(const bool valid=true) const =0
Whether to call time.write() or not.
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::SIMPLEControl::loop
virtual bool loop()=0
Loop.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SIMPLEControl::New
static autoPtr< SIMPLEControl > New(fvMesh &mesh, const word &managerType, const solver &solver)
Return a reference to the selected turbulence model.
Definition: SIMPLEControl.C:64
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::SIMPLEControl::pRefValue_
scalar pRefValue_
Pressure reference value.
Definition: SIMPLEControl.H:72
Foam::SIMPLEControl::pRefCell_
label pRefCell_
Pressure reference cell.
Definition: SIMPLEControl.H:69
Foam::SIMPLEControl::nIters_
label nIters_
Number of SIMPLE iterations.
Definition: SIMPLEControl.H:66
Foam::SIMPLEControl::readIters
virtual void readIters()
Definition: SIMPLEControl.C:106
solverControl.H
Foam::SIMPLEControl
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
Definition: SIMPLEControl.H:52