optMeshMovement.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::optMeshMovement
31
32Description
33 Abstract base class for translating an update of the design variables
34 into mesh movement
35
36SourceFiles
37 optMeshMovement.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef optMeshMovement_H
42#define optMeshMovement_H
43
44#include "displacementMethod.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class optMeshMovement Declaration
53\*---------------------------------------------------------------------------*/
56{
57private:
58
59 // Private Member Functions
60
61 //- Max allowed boundary displacement for the first optimisation cycle
62 autoPtr<scalar> maxAllowedDisplacement_;
63
64
65 // Private Member Functions
66
67 //- No copy construct
68 optMeshMovement(const optMeshMovement&) = delete;
69
70 //- No copy assignment
71 void operator=(const optMeshMovement&) = delete;
72
73
74protected:
75
76 // Protected data
79 const dictionary& dict_;
80
81 //- Correction of design variables
83
84 //- IDs of patches to be moved
86
87 //- Fall back points in case line-search is used
89
90 //- Mesh movement engine and interface for applying mesh movement
91 //- boundary conditions
93
94 //- Whether to write the mesh quality metrics to files each time the
95 //- mesh is updated
97
98
99 // Protected Member Functions
100
101 //- Get maxAllowedDisplacement, is set
102 scalar getMaxAllowedDisplacement() const;
103
104
105public:
106
107 //- Runtime type information
108 TypeName("optMeshMovement");
109
110
111 // Declare run-time constructor selection table
114 (
115 autoPtr,
118 (
119 fvMesh& mesh,
120 const dictionary& dict,
121 const labelList& patchIDs
122 ),
123 (
124 mesh,
125 dict,
126 patchIDs
127 )
128 );
129
130
131 // Constructors
132
133 //- Construct from components
135 (
136 fvMesh& mesh,
137 const dictionary& dict,
138 const labelList& patchIDs
139 );
140
141
142 // Selectors
143
145 (
146 fvMesh& mesh,
147 const dictionary& dict,
148 const labelList& patchIDs
149 );
150
151
152 //- Destructor
153 virtual ~optMeshMovement() = default;
154
155
156 // Member Functions
157
158 //- Set design variable correction
160
161 //- Calculates mesh movemnt based on the correction of the design
162 //- variables
163 virtual void moveMesh();
164
165 //- Return displacementMethod
167
168 //- Return patchIDs
169 const labelList& getPatchIDs();
170
171 //- Write mesh quality metrics
173
174 //- Store design variables and mesh, to act as the starting point of
175 //- line search
176 virtual void storeDesignVariables();
177
178 //- Reset to starting point of line search
179 virtual void resetDesignVariables();
180
181 //- Compute eta value based on max displacement
182 virtual scalar computeEta(const scalarField& correction) = 0;
183
184 //- Whether maxAllowedDisplacement has been set
185 bool maxAllowedDisplacementSet() const;
186
187 //- Return active design variables.
188 // Implemented only for certain parametetisations
189 virtual labelList getActiveDesignVariables() const;
190};
191
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195} // End namespace Foam
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#endif
200
201// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.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 translating an update of the design variables into mesh movement.
virtual ~optMeshMovement()=default
Destructor.
scalarField correction_
Correction of design variables.
virtual void resetDesignVariables()
Reset to starting point of line search.
void setCorrection(const scalarField &correction)
Set design variable correction.
virtual scalar computeEta(const scalarField &correction)=0
Compute eta value based on max displacement.
vectorField pointsInit_
Fall back points in case line-search is used.
virtual void moveMesh()
virtual labelList getActiveDesignVariables() const
Return active design variables.
const labelList & getPatchIDs()
Return patchIDs.
bool maxAllowedDisplacementSet() const
Whether maxAllowedDisplacement has been set.
autoPtr< displacementMethod > displMethodPtr_
const dictionary & dict_
static autoPtr< optMeshMovement > New(fvMesh &mesh, const dictionary &dict, const labelList &patchIDs)
declareRunTimeSelectionTable(autoPtr, optMeshMovement, dictionary,(fvMesh &mesh, const dictionary &dict, const labelList &patchIDs),(mesh, dict, patchIDs))
scalar getMaxAllowedDisplacement() const
Get maxAllowedDisplacement, is set.
void writeMeshQualityMetrics()
Write mesh quality metrics.
autoPtr< displacementMethod > & returnDisplacementMethod()
Return displacementMethod.
virtual void storeDesignVariables()
TypeName("optMeshMovement")
Runtime type information.
labelList patchIDs_
IDs of patches to be moved.
dynamicFvMesh & mesh
Namespace for OpenFOAM.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73