adjointSolverManager.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-------------------------------------------------------------------------------
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::adjointSolverManager
31
32Description
33 Class for managing adjoint solvers, which may be more than one per
34 operating point
35
36SourceFiles
37 adjointSolverManager.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef adjointSolverManager_H
42#define adjointSolverManager_H
43
44#include "adjointSolver.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class adjointSolverManager Declaration
53\*---------------------------------------------------------------------------*/
56:
57 public regIOobject
58{
59private:
60
61 // Private Member Functions
62
63 //- No copy construct
65
66 //- No copy assignment
67 void operator=(const adjointSolverManager&) = delete;
68
69
70protected:
71
72 // Protected Data
78 const word managerName_;
89
90
91public:
93 TypeName("adjointSolverManager");
94
95
96 // Constructors
97
98 //- Construct from components
100 (
101 fvMesh& mesh,
102 const word& managerType,
103 const dictionary& dict,
104 bool overrideUseSolverName
105 );
106
107
108 //- Destructor
109 virtual ~adjointSolverManager() = default;
110
111
112 // Member Functions
113
114 virtual bool readDict(const dictionary& dict);
115
116
117 // Access
118
119 //- Const access to the manager name
120 const word& managerName() const;
121
122 //- Const access to the primal solver name
123 const word& primalSolverName() const;
124
125 //- Const access to the construction dictionary
126 const dictionary& dict() const;
127
128 //- Const access to adjoint solvers
130
131 //- Non-const access to adjoint solvers
133
134 //- Const access to adjoint solvers
135 scalar operatingPointWeight() const;
136
137 //- Number of adjoint solvers corresponding to constraints
138 label nConstraints() const;
139
140 //- Number of adjoint solvers corresponding to objectives
141 label nObjectives() const;
142
143 //- Total number of adjoint solvers
144 label nAdjointSolvers() const;
145
146
147 // Evolution
148
149 //- Update objective function-related values and solve adjoint
150 //- equations
151 virtual void solveAdjointEquations();
152
153 //- Aggregate sensitivities from various adjoint solvers
155
156 //- Get constraint sensitivities. One scalarField per constraint
158
159 //- Compute sensitivities for all adjoint solvers
160 //- (both objective- and constraint-related ones)
162
163 //- Clear sensitivity fields from all adjoint solvers
164 void clearSensitivities();
165
166 //- Get objective value
167 scalar objectiveValue();
168
169 //- Get constraint values
171
172 //- Update fields related to primal solution.
173 // For instance, primal fields of adjoint turbulence models
175
176
177 // IO
179 virtual bool writeData(Ostream&) const
180 {
181 return true;
182 }
183};
184
185
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188} // End namespace Foam
189
190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191
192#endif
193
194// ************************************************************************* //
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
Class for managing adjoint solvers, which may be more than one per operating point.
void clearSensitivities()
Clear sensitivity fields from all adjoint solvers.
TypeName("adjointSolverManager")
scalar objectiveValue()
Get objective value.
virtual PtrList< scalarField > constraintSensitivities()
Get constraint sensitivities. One scalarField per constraint.
label nAdjointSolvers() const
Total number of adjoint solvers.
virtual tmp< scalarField > constraintValues()
Get constraint values.
virtual bool readDict(const dictionary &dict)
virtual tmp< scalarField > aggregateSensitivities()
Aggregate sensitivities from various adjoint solvers.
const word & primalSolverName() const
Const access to the primal solver name.
void updatePrimalBasedQuantities(const word &name)
Update fields related to primal solution.
PtrList< adjointSolver > adjointSolvers_
label nConstraints() const
Number of adjoint solvers corresponding to constraints.
virtual bool writeData(Ostream &) const
Pure virtual writeData function.
const dictionary & dict() const
Const access to the construction dictionary.
scalar operatingPointWeight() const
Const access to adjoint solvers.
virtual ~adjointSolverManager()=default
Destructor.
const PtrList< adjointSolver > & adjointSolvers() const
Const access to adjoint solvers.
label nObjectives() const
Number of adjoint solvers corresponding to objectives.
const word & managerName() const
Const access to the manager name.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73