Loading...
Searching...
No Matches
SQPBase.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-2021 PCOpt/NTUA
9 Copyright (C) 2013-2021 FOSS GP
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27
28Class
29 Foam::SQPBase
30
31Description
32 Base class for Sequantial Quadratic Programming (SQP) methods
33
34SourceFiles
35 SQPBase.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef SQPBase_H
40#define SQPBase_H
41
43#include "quasiNewton.H"
44#include "OFstream.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
51/*---------------------------------------------------------------------------*\
52 Class SQPBase Declaration
53\*---------------------------------------------------------------------------*/
54
55class SQPBase
56:
57 public constrainedOptimisationMethod
58{
59protected:
60
61 // Protected data
62
63 //- Derivatives of the Lagrangian function
65
66 //- The previous constraint derivatives
68
69 //- Lagrange multipliers
72 //- Name of the objective folder
74
75 //- File including the l1 merit function
77
78 //- Penalty value for the merit function
79 scalar mu_;
80
81 //- Safety factor
82 scalar delta_;
83
84
85 // Protected Member Functions
87 //- Get the part the merit function that depends on the constraints
88 virtual scalar meritFunctionConstraintPart() const = 0;
89
90
91private:
92
93 // Private Member Functions
94
95 //- No copy construct
96 SQPBase(const SQPBase&) = delete;
97
98 //- No copy assignment
99 void operator=(const SQPBase&) = delete;
100
101 //- Make folder holding the Lagrangian file
102 void makeFolder();
103
104
105public:
106
107 //- Runtime type information
108 TypeName("SQPBase");
109
110
111 // Constructors
112
113 //- Construct from components
114 SQPBase
115 (
116 const fvMesh& mesh,
117 const dictionary& dict,
118 autoPtr<designVariables>& designVars,
119 const updateMethod& UpdateMethod,
120 const word& type
121 );
122
123
124 //- Destructor
125 virtual ~SQPBase() = default;
126
128 // Member Functions
129
130 //- Write continuation info
131 virtual bool addToFile(Ostream& os) const;
132
133 //- Write info about the merit function
134 virtual bool writeMeritFunction(const updateMethod& UpdateMethod);
135};
136
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140} // End namespace Foam
141
142// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144#endif
145
146// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
scalarField lamdas_
Lagrange multipliers.
Definition SQPBase.H:71
virtual bool addToFile(Ostream &os) const
Write continuation info.
Definition SQPBase.C:102
scalar mu_
Penalty value for the merit function.
Definition SQPBase.H:86
TypeName("SQPBase")
Runtime type information.
virtual bool writeMeritFunction(const updateMethod &UpdateMethod)
Write info about the merit function.
Definition SQPBase.C:115
virtual ~SQPBase()=default
Destructor.
List< scalarField > constraintDerivativesOld_
The previous constraint derivatives.
Definition SQPBase.H:66
autoPtr< OFstream > meritFunctionFile_
File including the l1 merit function.
Definition SQPBase.H:81
scalar delta_
Safety factor.
Definition SQPBase.H:91
virtual scalar meritFunctionConstraintPart() const =0
Get the part the merit function that depends on the constraints.
fileName objFunctionFolder_
Name of the objective folder.
Definition SQPBase.H:76
scalarField LagrangianDerivatives_
Derivatives of the Lagrangian function.
Definition SQPBase.H:61
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Abstract base class for optimisation methods.
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68