steadyOptimisation.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-2020 PCOpt/NTUA
9  Copyright (C) 2013-2020 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::steadyOptimisation
31 
32 Description
33  Iterate the optimisation cycles. For steady state opt, this coinsides
34  with evolving Time
35 
36 SourceFiles
37  steadyOptimisation.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef steadyOptimisation_H
42 #define steadyOptimisation_H
43 
44 #include "optimisationManager.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class steadyOptimisation Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public optimisationManager
58 {
59 private:
60 
61  // Private Member Functions
62 
63  //- Update optimisationType source for all primal and adjoint solvers
64  void updateOptTypeSource();
65 
66  //- No copy construct
67  steadyOptimisation(const steadyOptimisation&) = delete;
68 
69  //- No copy assignment
70  void operator=(const steadyOptimisation&) = delete;
71 
72 
73 protected:
74 
75  // Protected Member Functions
76 
77  //- Update design variables using a line-search
78  void lineSearchUpdate();
79 
80  //- Update design variables using a fixed step
81  void fixedStepUpdate();
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("steadyOptimisation");
88 
89 
90  // Constructors
91 
92  //- Construct from components
94 
95 
96  // Destructor
97  virtual ~steadyOptimisation() = default;
98 
99 
100  // Member Functions
101 
102  //- Prefix increment
103  virtual optimisationManager& operator++();
104 
105  //- Postfix increment, this is identical to the prefix increment
106  virtual optimisationManager& operator++(int);
107 
108  //- Return true if end of optimisation run
109  // Also, updates the design variables if needed
110  virtual bool checkEndOfLoopAndUpdate();
111 
112  //- Return true if end of optimisation run
113  virtual bool end();
114 
115  //- Whether to update the design variables
116  virtual bool update();
117 
118  //- Do a line search to find a correction satisfying the step
119  //- convergence criteria
120  virtual void updateDesignVariables();
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
virtual bool update()
Whether to update the design variables.
virtual bool checkEndOfLoopAndUpdate()
Return true if end of optimisation run.
Abstract base class for optimisation methods.
void lineSearchUpdate()
Update design variables using a line-search.
TypeName("steadyOptimisation")
Runtime type information.
virtual ~steadyOptimisation()=default
Iterate the optimisation cycles. For steady state opt, this coinsides with evolving Time...
dynamicFvMesh & mesh
virtual optimisationManager & operator++()
Prefix increment.
void fixedStepUpdate()
Update design variables using a fixed step.
virtual bool end()
Return true if end of optimisation run.
virtual void updateDesignVariables()
Do a line search to find a correction satisfying the step convergence criteria.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:79
Namespace for OpenFOAM.