SIMPLEControlOpt.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::SIMPLEControlOpt
31 
32 Description
33  SIMPLE control class for optimisation runs. Each time is sub-cycled and
34  corresponds to one optimisation cycle
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef SIMPLEControlOpt_H
39 #define SIMPLEControlOpt_H
40 
41 #include "SIMPLEControl.H"
42 #include "subCycleTime.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class SIMPLEControlOpt Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class SIMPLEControlOpt
54 :
55  public SIMPLEControl
56 {
57 protected:
58 
59  // Protected Data
60 
61  //- Number of iterations for the first optimisation cycle
62  label nInitialIters_;
63 
64  //- Subcycled time
66 
67  //- deltaT of the sub-cycled time
68  scalar deltaTSubSycle_;
69 
70 
71  // Protected Member Functions
72 
73  //- Read controls from optimisationDict
74  virtual bool read();
75 
76  //- Return true if all convergence checks are satisfied
77  virtual bool criteriaSatisfied();
78 
79  //- Maximum number of solver iterations
80  const label& nIters() const;
81 
82  //- Reset deltaT in case controlDict has been re-written at run-time
83  void resetDeltaT();
84 
85 
86 private:
87 
88  //- No copy construct
89  SIMPLEControlOpt(const SIMPLEControlOpt&) = delete;
90 
91  //- No copy assignment
92  void operator=(const SIMPLEControlOpt&) = delete;
93 
94 
95 public:
96 
97 
98  // Static Data Members
99 
100  //- Run-time type information
101  TypeName("steadyOptimisation");
102 
103 
104  // Constructors
105 
106  //- Construct from mesh
108  (
109  fvMesh& mesh,
110  const word& managerType,
111  const solver& solver
112  );
113 
114 
115  //- Destructor
116  virtual ~SIMPLEControlOpt() = default;
117 
118 
119  // Member Functions
120 
121  // Solution control
122 
123  //- Whether to call time.write() or not
124  virtual bool write(const bool valid = true) const;
125 
126  // Evolution
127 
128  //- Loop
129  virtual bool loop();
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
Foam::SIMPLEControlOpt::loop
virtual bool loop()
Loop.
Definition: SIMPLEControlOpt.C:122
Foam::SIMPLEControlOpt::deltaTSubSycle_
scalar deltaTSubSycle_
deltaT of the sub-cycled time
Definition: SIMPLEControlOpt.H:67
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::SIMPLEControlOpt::read
virtual bool read()
Read controls from optimisationDict.
Definition: SIMPLEControlOpt.C:44
Foam::SIMPLEControlOpt::subCycledTimePtr_
autoPtr< subCycleTime > subCycledTimePtr_
Subcycled time.
Definition: SIMPLEControlOpt.H:64
Foam::SIMPLEControlOpt::TypeName
TypeName("steadyOptimisation")
Run-time type information.
Foam::solver
Base class for solution control classes.
Definition: solver.H:51
SIMPLEControl.H
subCycleTime.H
Foam::SIMPLEControlOpt::nIters
const label & nIters() const
Maximum number of solver iterations.
Definition: SIMPLEControlOpt.C:71
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::SIMPLEControlOpt::~SIMPLEControlOpt
virtual ~SIMPLEControlOpt()=default
Destructor.
Foam::SIMPLEControlOpt
SIMPLE control class for optimisation runs. Each time is sub-cycled and corresponds to one optimisati...
Definition: SIMPLEControlOpt.H:52
Foam::SIMPLEControlOpt::write
virtual bool write(const bool valid=true) const
Whether to call time.write() or not.
Definition: SIMPLEControlOpt.C:114
Foam::SIMPLEControlOpt::criteriaSatisfied
virtual bool criteriaSatisfied()
Return true if all convergence checks are satisfied.
Definition: SIMPLEControlOpt.C:51
Foam::SIMPLEControlOpt::nInitialIters_
label nInitialIters_
Number of iterations for the first optimisation cycle.
Definition: SIMPLEControlOpt.H:61
Foam::SIMPLEControl
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
Definition: SIMPLEControl.H:52
Foam::SIMPLEControlOpt::resetDeltaT
void resetDeltaT()
Reset deltaT in case controlDict has been re-written at run-time.
Definition: SIMPLEControlOpt.C:84