sensitivity.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::sensitivity
31
32Description
33 Abstract base class for adjoint sensitivities
34
35SourceFiles
36 sensitivity.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef sensitivity_H
41#define sensitivity_H
42
43#include "volFields.H"
44#include "surfaceFields.H"
45#include "dictionary.H"
47
48#include "pointMesh.H"
49#include "pointPatchField.H"
50#include "pointPatchFieldsFwd.H"
52#include "boundaryFieldsFwd.H"
53#include "createZeroField.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59
60/*---------------------------------------------------------------------------*\
61 Class sensitivity Declaration
62\*---------------------------------------------------------------------------*/
64class sensitivity
65{
66protected:
67
68 // Protected data
70 const fvMesh& mesh_;
72
73 // Field sensitivities. Topology optimisation
74 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76
77
78 // Protected Member Functions
79
80private:
81
82 // Private Member Functions
83
84 //- No copy construct
85 sensitivity(const sensitivity&) = delete;
86
87 //- No copy assignment
88 void operator=(const sensitivity&) = delete;
89
90
91public:
92
93 //- Runtime type information
94 TypeName("sensitivity");
95
96 // Constructors
97
98 //- Construct from components
100 (
101 const fvMesh& mesh,
102 const dictionary& dict
103 );
104
105 //- Destructor
106 virtual ~sensitivity() = default;
107
108
109 // Member Functions
110
111 //- Return the construction dictionary
112 const dictionary& dict() const;
113
114 //- Read dictionary if changed
115 virtual bool readDict(const dictionary& dict);
116
117 //- Compute design variables number. Does nothing in the base
118 // Used to get the correct design variables number when
119 // setSensitivityPatchIDs are not set in the constructor
120 virtual void computeDerivativesSize();
121
122 //- Calculates and returns sensitivity fields.
123 // Used with optimisation libraries
124 virtual const scalarField& calculateSensitivities() = 0;
125
126 //- Write sensitivity fields.
127 // If valid, copies boundaryFields to volFields and writes them.
128 // Virtual to be reimplemented by control points-based methods
129 // (Bezier, RBF) which do not need to write fields
130 virtual void write(const word& baseName = word::null);
131
132};
133
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137} // End namespace Foam
138
139// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140
141//#ifdef NoRepository
142// #include "sensitivityTemplates.C"
143//#endif
144
145// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
147#endif
148
149// ************************************************************************* //
Useful typenames for fields defined only at the boundaries.
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 adjoint sensitivities.
Definition: sensitivity.H:64
const fvMesh & mesh_
Definition: sensitivity.H:69
virtual void computeDerivativesSize()
Compute design variables number. Does nothing in the base.
Definition: sensitivity.C:71
dictionary dict_
Definition: sensitivity.H:70
virtual bool readDict(const dictionary &dict)
Read dictionary if changed.
Definition: sensitivity.C:63
TypeName("sensitivity")
Runtime type information.
virtual const scalarField & calculateSensitivities()=0
Calculates and returns sensitivity fields.
const dictionary & dict() const
Return the construction dictionary.
Definition: sensitivity.C:57
virtual ~sensitivity()=default
Destructor.
autoPtr< volScalarField > fieldSensPtr_
Definition: sensitivity.H:74
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
Namespace for OpenFOAM.
runTime write()
Foam::surfaceFields.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73