Loading...
Searching...
No Matches
sensitivityTopO.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-------------------------------------------------------------------------------
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
27
28Description
29 Calculation of adjoint based sensitivities for topology optimisation.
30 This returns just the field part, with contributions from regularisation
31 and projection added by topODesignVariables.
32
33Class
34 Foam::sensitivityTopO
35
36SourceFiles
37 sensitivityTopO.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef sensitivityTopO_H
42#define sensitivityTopO_H
43
44#include "adjointSensitivity.H"
45#include "fvOptions.H"
46#include "topOZones.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
54/*---------------------------------------------------------------------------*\
55 Class sensitivityTopO Declaration
56\*---------------------------------------------------------------------------*/
57
58class sensitivityTopO
59:
60 public adjointSensitivity
61{
62
63protected:
64
65 // Protected data
66
67 //- Zones related to topology optimisation
69
70 //- Name used as the argument for the post-processing of the
71 //- sensitivities through fvOptions
73
74
75 // Protected Member Functions
76
77 //- Zero sensitivities in fixed porous zones
79
80
81private:
82
83 // Private Member Functions
84
85 //- No copy construct
86 sensitivityTopO(const sensitivityTopO&);
87
88 //- No copy assignment
89 void operator=(const sensitivityTopO&);
90
91
92public:
93
94 //- Runtime type information
95 TypeName("topO");
96
97
98 // Constructors
99
100 //- Construct from components
101 sensitivityTopO
103 const fvMesh& mesh,
104 const dictionary& dict,
106 );
107
108
109 //- Destructor
110 virtual ~sensitivityTopO() = default;
111
112
113 // Member Functions
114
115 //- Read dictionary if changed
116 virtual bool readDict(const dictionary& dict);
117
118 //- Accumulate sensitivity integrands
119 virtual void accumulateIntegrand(const scalar dt);
120
121 //- Assemble sensitivities
122 virtual void assembleSensitivities
123 (
124 autoPtr<designVariables>& designVars
125 );
126
127 //- Add part of the sensitivities coming from fvOptions
128 static void postProcessSens
129 (
130 scalarField& sens,
131 scalarField& auxSens,
133 const word& fieldName,
134 const word& designVariablesName
135 );
136
137 //- Add part of the sensitivities coming from fvOptions
138 void postProcessSens
139 (
140 scalarField& sens,
141 scalarField& auxSens,
142 const word& fieldName
143 );
144
145 //- Potentially manipulate auxSens within the fvOption before adding
146 //- the part related to the design variables
147 template<class Type, template<class> class PatchField, class GeoMesh>
148 static void postProcessAuxSens
149 (
153 const word& fieldName,
154 scalarField& auxSens
155 );
156};
157
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161} // End namespace Foam
162
163// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164
165#ifdef NoRepository
167#endif
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171#endif
172
173// ************************************************************************* //
fv::options & fvOptions
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition GeoMesh.H:46
Generic GeometricField class.
Base class for adjoint solvers.
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
Finite-volume options, which is an IOdictionary of values and a fv::optionList.
Definition fvOptions.H:69
TypeName("topO")
Runtime type information.
static void postProcessAuxSens(const GeometricField< Type, PatchField, GeoMesh > &primal, const GeometricField< Type, PatchField, GeoMesh > &adjoint, fv::options &fvOptions, const word &fieldName, scalarField &auxSens)
Potentially manipulate auxSens within the fvOption before adding the part related to the design varia...
topOZones zones_
Zones related to topology optimisation.
virtual bool readDict(const dictionary &dict)
Read dictionary if changed.
word designVariablesName_
Name used as the argument for the post-processing of the sensitivities through fvOptions.
void zeroSensInFixedPorousZones(scalarField &sens)
Zero sensitivities in fixed porous zones.
virtual ~sensitivityTopO()=default
Destructor.
virtual void accumulateIntegrand(const scalar dt)
Accumulate sensitivity integrands.
static void postProcessSens(scalarField &sens, scalarField &auxSens, fv::options &fvOptions, const word &fieldName, const word &designVariablesName)
Add part of the sensitivities coming from fvOptions.
virtual void assembleSensitivities(autoPtr< designVariables > &designVars)
Assemble sensitivities.
const fvMesh & mesh() const
Return reference to mesh.
const dictionary & dict() const
Return the construction dictionary.
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68