Loading...
Searching...
No Matches
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-2023 PCOpt/NTUA
9 Copyright (C) 2013-2023 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// Forward declaration
61class designVariables;
63/*---------------------------------------------------------------------------*\
64 Class sensitivity Declaration
65\*---------------------------------------------------------------------------*/
66
67class sensitivity
69protected:
71 // Protected data
72
73 const fvMesh& mesh_;
75 bool writeFieldSens_;
76
77 // Field sensitivities. Topology optimisation
78 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80
81
82private:
83
84 // Private Member Functions
85
86 //- No copy construct
87 sensitivity(const sensitivity&) = delete;
88
89 //- No copy assignment
90 void operator=(const sensitivity&) = delete;
91
92
93public:
94
95 //- Runtime type information
96 TypeName("sensitivity");
98 // Constructors
99
100 //- Construct from components
101 sensitivity
102 (
103 const fvMesh& mesh,
104 const dictionary& dict
105 );
106
107 //- Destructor
108 virtual ~sensitivity() = default;
109
110
111 // Member Functions
112
113 //- Return reference to mesh
114 inline const fvMesh& mesh() const
115 {
116 return mesh_;
117 }
118
119 //- Return the construction dictionary
120 inline const dictionary& dict() const
122 return
123 dict_.optionalSubDict(mesh_.name()).
124 optionalSubDict("sensitivities");
125 }
126
127 //- Read dictionary if changed
128 virtual bool readDict(const dictionary& dict);
130 //- Calculates and returns sensitivity field
132 (
133 autoPtr<designVariables>& designVars
134 ) = 0;
135
136 //- Get the fieldSensPtr
137 inline const autoPtr<volScalarField>& fieldSensPtr() const
138 {
139 return fieldSensPtr_;
140 }
141
142 //- Write sensitivity fields.
143 // If valid, copies boundaryFields to volFields and writes them.
144 // Virtual to be reimplemented by control points-based methods
145 // (Bezier, RBF) which do not need to write fields
146 virtual void write(const word& baseName = word::null);
147};
148
149
150// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151
152} // End namespace Foam
153
154// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155
156//#ifdef NoRepository
157// #include "sensitivityTemplates.C"
158//#endif
159
160// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161
162#endif
163
164// ************************************************************************* //
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:65
Abstract base class for defining design variables.
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
const autoPtr< volScalarField > & fieldSensPtr() const
Get the fieldSensPtr.
const fvMesh & mesh_
Definition sensitivity.H:68
dictionary dict_
Definition sensitivity.H:69
virtual bool readDict(const dictionary &dict)
Read dictionary if changed.
Definition sensitivity.C:51
TypeName("sensitivity")
Runtime type information.
const fvMesh & mesh() const
Return reference to mesh.
const dictionary & dict() const
Return the construction dictionary.
virtual ~sensitivity()=default
Destructor.
virtual const scalarField & calculateSensitivities(autoPtr< designVariables > &designVars)=0
Calculates and returns sensitivity field.
autoPtr< volScalarField > fieldSensPtr_
Definition sensitivity.H:74
A class for handling words, derived from Foam::string.
Definition word.H:66
static const word null
An empty word.
Definition word.H:84
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
runTime write()
dictionary dict
Foam::surfaceFields.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68