optimisationManager.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::optimisationManager
31 
32 Description
33  Abstract base class for optimisation methods
34 
35 SourceFiles
36  optimisationManager.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef optimisationManager_H
41 #define optimisationManager_H
42 
43 #include "runTimeSelectionTables.H"
44 #include "IOdictionary.H"
46 #include "primalSolver.H"
47 #include "adjointSolverManager.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class optimisationManager Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public IOdictionary
61 {
62 protected:
63 
64  // Protected data
65 
72 
73 
74 private:
75 
76  // Private Member Functions
77 
78  //- No copy construct
80 
81  //- No copy assignment
82  void operator=(const optimisationManager&) = delete;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("optimisationManager");
89 
90 
91  // Declare run-time constructor selection table
92 
94  (
95  autoPtr,
97  dictionary,
98  (
99  fvMesh& mesh
100  ),
101  (mesh)
102  );
103 
104 
105  // Constructors
106 
107  //- Construct from components
109 
110 
111  // Selectors
112 
113  //- Return a reference to the selected turbulence model
115 
116 
117  //- Destructor
118  virtual ~optimisationManager() = default;
119 
120 
121  // Member Functions
122 
124 
126 
127  virtual bool read();
128 
129  //- Prefix increment,
130  virtual optimisationManager& operator++() = 0;
131 
132  //- Postfix increment, this is identical to the prefix increment
133  virtual optimisationManager& operator++(int) = 0;
134 
135  //- Return true if end of optimisation run.
136  // Also, updates the design variables if needed
137  virtual bool checkEndOfLoopAndUpdate() = 0;
138 
139  //- Return true if end of optimisation run
140  virtual bool end() = 0;
141 
142  //- Whether to update the design variables
143  virtual bool update() = 0;
144 
145  //- Update design variables.
146  // Might employ a line search to find a correction satisfying the step
147  // convergence criteria
148  virtual void updateDesignVariables() = 0;
149 
150  //- Solve all primal equations
151  virtual void solvePrimalEquations();
152 
153  //- Solve all adjoint equations
154  virtual void solveAdjointEquations();
155 
156  //- Compute all adjoint sensitivities
157  virtual void computeSensitivities();
158 
159  //- Solve all primal equations
160  virtual void updatePrimalBasedQuantities();
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::optimisationManager::mesh_
fvMesh & mesh_
Definition: optimisationManager.H:65
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::optimisationManager::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, optimisationManager, dictionary,(fvMesh &mesh),(mesh))
Foam::optimisationManager::adjointSolverManagers_
PtrList< adjointSolverManager > adjointSolverManagers_
Definition: optimisationManager.H:68
Foam::optimisationManager::updatePrimalBasedQuantities
virtual void updatePrimalBasedQuantities()
Solve all primal equations.
Definition: optimisationManager.C:253
Foam::optimisationManager::operator++
virtual optimisationManager & operator++()=0
Prefix increment,.
Foam::optimisationManager::end
virtual bool end()=0
Return true if end of optimisation run.
Foam::optimisationManager::optType_
autoPtr< incompressible::optimisationType > optType_
Definition: optimisationManager.H:70
adjointSolverManager.H
primalSolver.H
Foam::optimisationManager::read
virtual bool read()
Read object.
Definition: optimisationManager.C:186
Foam::optimisationManager::primalSolvers_
PtrList< primalSolver > primalSolvers_
Definition: optimisationManager.H:67
Foam::optimisationManager::solvePrimalEquations
virtual void solvePrimalEquations()
Solve all primal equations.
Definition: optimisationManager.C:223
Foam::optimisationManager::primalSolvers
virtual PtrList< primalSolver > & primalSolvers()
Definition: optimisationManager.C:210
Foam::optimisationManager::New
static autoPtr< optimisationManager > New(fvMesh &mesh)
Return a reference to the selected turbulence model.
Definition: optimisationManager.C:146
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::optimisationManager::~optimisationManager
virtual ~optimisationManager()=default
Destructor.
Foam::optimisationManager::solveAdjointEquations
virtual void solveAdjointEquations()
Solve all adjoint equations.
Definition: optimisationManager.C:233
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
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::optimisationManager::TypeName
TypeName("optimisationManager")
Runtime type information.
Foam::optimisationManager::computeSensitivities
virtual void computeSensitivities()
Compute all adjoint sensitivities.
Definition: optimisationManager.C:243
IOdictionary.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::optimisationManager::checkEndOfLoopAndUpdate
virtual bool checkEndOfLoopAndUpdate()=0
Return true if end of optimisation run.
Foam::optimisationManager::managerType_
const word managerType_
Definition: optimisationManager.H:69
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
optimisationTypeIncompressible.H
Foam::optimisationManager::updateDesignVariables
virtual void updateDesignVariables()=0
Update design variables.
Foam::optimisationManager::adjointSolverManagers
virtual PtrList< adjointSolverManager > & adjointSolverManagers()
Definition: optimisationManager.C:217
Foam::optimisationManager::time_
Time & time_
Definition: optimisationManager.H:66
Foam::optimisationManager
Abstract base class for optimisation methods.
Definition: optimisationManager.H:57
Foam::optimisationManager::update
virtual bool update()=0
Whether to update the design variables.