sensitivitySurfacePoints.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-2020 PCOpt/NTUA
9  Copyright (C) 2013-2020 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
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 Class
29  Foam::sensitivitySurfacePoints
30 
31 Description
32  Calculation of adjoint-based sensitivities at wall points using the
33  E-SI formulation
34 
35 SourceFiles
36  sensitivitySurfacePoints.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef sensitivitySurfacePoints_H
41 #define sensitivitySurfacePoints_H
42 
43 #include "sensitivityShapeESI.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class sensitivitySurfacePoints Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public sensitivityShapeESI
57 {
58 protected:
59 
60  // Protected data
61 
62  //- Write geometric info for use by external programs
64 
65  //- Include surface area in sens computation
67 
68  //- Is point belonging to a symmetry{Plane}
70 
71  //- Local point normal per symmetry point
73 
74  //- Extended patchIDs
75  // Sensitivities from patches adjacent to the sensitivityPatchIDs_
76  // should also be taken into consideration in order to compute the
77  // correct values at points in their interfaces
79 
80 
81  // Protected Member Functions
82 
83  //- Set suffix name for sensitivity fields
85 
86  //- Converts face sensitivities to point sensitivities and adds the
87  //- ones directly computed in points (i.e. dSf/db and dnf/db).
89 
90  //- Construct globally correct point normals and point areas
92  (
93  vectorField& pointNormals,
94  scalarField& pointMagSf
95  );
96 
97  //- Set suffix name for sensitivity fields
98  void setSuffixName();
99 
100  //- Allocate the proper size for the point-based sensitivities
102 
103 
104 private:
105 
106  // Private Member Functions
107 
108  //- No copy construct
110 
111  //- No copy assignment
112  void operator=(const sensitivitySurfacePoints&) = delete;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("surfacePoints");
119 
120 
121  // Constructors
122 
123  //- Construct from components
125  (
126  const fvMesh& mesh,
127  const dictionary& dict,
129  );
130 
131 
132  //- Destructor
133  virtual ~sensitivitySurfacePoints() = default;
134 
135 
136  // Member Functions
137 
138  //- Read controls and update solver pointers if necessary
139  void read();
140 
141  //- Read dict if changed
142  virtual bool readDict(const dictionary& dict);
143 
144  //- Return set of patches on which to compute direct sensitivities
145  virtual const labelHashSet& geometryVariationIntegrationPatches() const;
146 
147  //- Assemble sensitivities
148  virtual void assembleSensitivities
149  (
150  autoPtr<designVariables>& designVars
151  );
152 
153  //- Write sensitivity fields.
154  // If valid, copies boundaryFields to pointFields and writes them.
155  virtual void write(const word& baseName = word::null);
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
bool includeSurfaceArea_
Include surface area in sens computation.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
void constructGlobalPointNormalsAndAreas(vectorField &pointNormals, scalarField &pointMagSf)
Construct globally correct point normals and point areas.
Base class for adjoint solvers.
Definition: adjointSolver.H:53
TypeName("surfacePoints")
Runtime type information.
virtual bool readDict(const dictionary &dict)
Read dict if changed.
const fvMesh & mesh() const
Return reference to mesh.
Definition: sensitivity.H:121
void finalisePointSensitivities()
Converts face sensitivities to point sensitivities and adds the ones directly computed in points (i...
boolList isSymmetryPoint_
Is point belonging to a symmetry{Plane}.
labelHashSet populateExtendedIDs() const
Set suffix name for sensitivity fields.
void setSuffixName()
Set suffix name for sensitivity fields.
A class for handling words, derived from Foam::string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:84
vectorField symmPointNormal_
Local point normal per symmetry point.
virtual ~sensitivitySurfacePoints()=default
Destructor.
const dictionary & dict() const
Return the construction dictionary.
Definition: sensitivity.H:129
bool writeGeometricInfo_
Write geometric info for use by external programs.
virtual void write(const word &baseName=word::null)
Write sensitivity fields.
virtual void assembleSensitivities(autoPtr< designVariables > &designVars)
Assemble sensitivities.
labelHashSet extendedPatchIDs_
Extended patchIDs.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
void read()
Read controls and update solver pointers if necessary.
void computePointDerivativesSize()
Allocate the proper size for the point-based sensitivities.
virtual const labelHashSet & geometryVariationIntegrationPatches() const
Return set of patches on which to compute direct sensitivities.
Calculation of adjoint-based sensitivities at wall points using the E-SI formulation.
Namespace for OpenFOAM.
Class for computing sensitivity derivatives using the Enhanced Surface Integral (E-SI) formulation...