SR1.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::SR1
31
32Description
33 The quasi-Newton Symmetric Rank One formula
34
35SourceFiles
36 SR1.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef SR1_H
41#define SR1_H
42
43#include "updateMethod.H"
44#include "scalarMatrices.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class SR1 Declaration
53\*---------------------------------------------------------------------------*/
55class SR1
56:
57 public updateMethod
58{
59protected:
60
61 // Protected data
62
63 //- Step for the Newton method
64 scalar etaHessian_;
65
66 //- Number of first steepest descent steps
68
69 //- For stability check
70 scalar ratioThreshold_;
71
72 //- Map to active design variables
74
75 //- The Hessian inverse. Should have the size of the active design
76 //- variables
78
79 //- The previous Hessian inverse
81
82 //- The previous derivatives
84
85 //- The previous correction
87
88 //- Optimisation counter
89 label counter_;
90
91
92 // Protected functions
93
94 //- Allocate matrices in the first optimisation cycle
95 void allocateMatrices();
96
97 //- Update approximation of the inverse Hessian
98 void updateHessian();
99
100 //- Update design variables
101 void update();
102
103 //- Read old info from dict
104 void readFromDict();
105
106
107private:
108
109 // Private Member Functions
110
111 //- No copy construct
112 SR1(const SR1&) = delete;
113
114 //- No copy assignment
115 void operator=(const SR1&) = delete;
116
117
118public:
119
120 //- Runtime type information
121 TypeName("SR1");
122
123
124 // Constructors
125
126 //- Construct from components
127 SR1(const fvMesh& mesh, const dictionary& dict);
128
129
130 //- Destructor
131 virtual ~SR1() = default;
132
133
134 // Member Functions
135
136 //- Compute design variables correction
137 void computeCorrection();
138
139 //- Update old correction. Useful for quasi-Newton methods coupled with
140 //- line search
141 virtual void updateOldCorrection(const scalarField& oldCorrection);
142
143 //- Write old info to dict
144 virtual void write();
145};
146
147
148// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150} // End namespace Foam
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154#endif
155
156// ************************************************************************* //
The quasi-Newton Symmetric Rank One formula.
Definition: SR1.H:57
TypeName("SR1")
Runtime type information.
void computeCorrection()
Compute design variables correction.
Definition: SR1.C:201
SquareMatrix< scalar > HessianInvOld_
The previous Hessian inverse.
Definition: SR1.H:79
void readFromDict()
Read old info from dict.
Definition: SR1.C:135
scalarField correctionOld_
The previous correction.
Definition: SR1.H:85
label nSteepestDescent_
Number of first steepest descent steps.
Definition: SR1.H:66
labelList activeDesignVars_
Map to active design variables.
Definition: SR1.H:72
scalar etaHessian_
Step for the Newton method.
Definition: SR1.H:63
label counter_
Optimisation counter.
Definition: SR1.H:88
void allocateMatrices()
Allocate matrices in the first optimisation cycle.
Definition: SR1.C:49
scalarField derivativesOld_
The previous derivatives.
Definition: SR1.H:82
virtual void write()
Write old info to dict.
Definition: SR1.C:224
SquareMatrix< scalar > HessianInv_
Definition: SR1.H:76
virtual void updateOldCorrection(const scalarField &oldCorrection)
Definition: SR1.C:217
void update()
Update design variables.
Definition: SR1.C:102
scalar ratioThreshold_
For stability check.
Definition: SR1.H:69
virtual ~SR1()=default
Destructor.
void updateHessian()
Update approximation of the inverse Hessian.
Definition: SR1.C:71
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Definition: SquareMatrix.H:66
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
Abstract base class for optimisation methods.
Definition: updateMethod.H:55
dynamicFvMesh & mesh
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73