Loading...
Searching...
No Matches
BezierDesignVariables.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-2023 PCOpt/NTUA
9 Copyright (C) 2013-2023 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
27Class
28 Foam::BezierDesignVariables
29
30Description
31 Bezier design variables for shape optimisation
32
33SourceFiles
34 BezierDesignVariables.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef BezierDesignVariables_H
39#define BezierDesignVariables_H
40
42#include "Bezier.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
49/*---------------------------------------------------------------------------*\
50 Class BezierDesignVariables Decleration
51\*---------------------------------------------------------------------------*/
52
53class BezierDesignVariables
54:
55 public shapeDesignVariables
56{
57protected:
58
59 // Protected Data Members
60
61 //- The Bezier control points and auxiliary functions
63
64 //- Boundary movement due to the change in Bezier control points
66
67
68 // Protected Member Functions
69
70 //- Read bounds for design variables, if present
71 void readBounds
72 (
73 autoPtr<scalar> lowerBoundPtr = nullptr,
74 autoPtr<scalar> upperBoundPtr = nullptr
75 );
76
77 //- Set uniform bounds for all control points
78 void setBounds(autoPtr<scalarField>& bounds, const vector& cpBounds);
79
80 //- Transform the correction of design variables to control points'
81 //- movement
83 (
85 );
86
87 //- Decompose varID to cpID and direction
88 void decomposeVarID(label& cpI, label& dir, const label varID) const;
89
90
91private:
92
93 // Private Member Functions
94
95 //- No copy construct
96 BezierDesignVariables(const BezierDesignVariables&) = delete;
97
98 //- No copy assignment
99 void operator=(const BezierDesignVariables&) = delete;
100
101
102public:
103
104 //- Runtime type information
105 TypeName("Bezier");
106
107
108 // Constructors
109
110 //- Construct from components
111 BezierDesignVariables
112 (
113 fvMesh& mesh,
114 const dictionary& dict
115 );
116
117
118 //- Destructor
119 virtual ~BezierDesignVariables() = default;
120
121
122 // Member Functions
123
124 //- Update design variables based on a given correction
125 virtual void update(scalarField& correction);
126
127 //- Compute eta if not set in the first step
128 virtual scalar computeEta(scalarField& correction);
129
130 //- Whether to use global sum when computing matrix-vector products
131 // in update methods
132 virtual bool globalSum() const;
133
134
135 // Fields related to sensitivity computations
137 //- Get dxdb for given design variable and patch
139 (
140 const label patchI,
141 const label varID
142 ) const;
143
144 //- Get dndb for given design variable and patch
145 virtual tmp<vectorField> dndb
146 (
147 const label patchI,
148 const label varID
149 ) const;
150
151 //- Get dSdb for given design variable and patch
152 virtual tmp<vectorField> dSdb
153 (
154 const label patchI,
155 const label varID
156 ) const;
157
158 //- Get dCdb for given design variable.
159 // Used for FI-based sensitivities
160 virtual tmp<volVectorField> dCdb(const label varID) const;
161};
162
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166} // End namespace Foam
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170#endif
171
172// ************************************************************************* //
virtual tmp< vectorField > dSdb(const label patchI, const label varID) const
Get dSdb for given design variable and patch.
virtual scalar computeEta(scalarField &correction)
Compute eta if not set in the first step.
Bezier bezier_
The Bezier control points and auxiliary functions.
virtual ~BezierDesignVariables()=default
Destructor.
void decomposeVarID(label &cpI, label &dir, const label varID) const
Decompose varID to cpID and direction.
void readBounds(autoPtr< scalar > lowerBoundPtr=nullptr, autoPtr< scalar > upperBoundPtr=nullptr)
Read bounds for design variables, if present.
TypeName("Bezier")
Runtime type information.
virtual bool globalSum() const
Whether to use global sum when computing matrix-vector products.
pointVectorField dx_
Boundary movement due to the change in Bezier control points.
tmp< vectorField > computeBoundaryDisplacement(const scalarField &correction)
Transform the correction of design variables to control points' movement.
void setBounds(autoPtr< scalarField > &bounds, const vector &cpBounds)
Set uniform bounds for all control points.
virtual tmp< vectorField > dxdbFace(const label patchI, const label varID) const
Get dxdb for given design variable and patch.
virtual tmp< vectorField > dndb(const label patchI, const label varID) const
Get dndb for given design variable and patch.
virtual tmp< volVectorField > dCdb(const label varID) const
Get dCdb for given design variable.
Calculation of adjoint based sensitivities for Bezier control points.
Definition Bezier.H:55
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
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A class for managing temporary objects.
Definition tmp.H:75
mesh update()
dynamicFvMesh & mesh
Namespace for bounding specifications. At the moment, mostly for tables.
Namespace for OpenFOAM.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
Vector< scalar > vector
Definition vector.H:57
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68