SIBaseIncompressible.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 
29 Class
30  Foam::incompressible::SIBase
31 
32 Description
33  Base class for Surface Integral-based sensitivity derivatives
34 
35 SourceFiles
36  SIBase.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef SIBaseIncompressible_H
41 #define SIBaseIncompressible_H
42 
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 namespace incompressible
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class SIBase Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class SIBase
59 :
60  public shapeSensitivities
61 {
62 protected:
63 
64  // Protected data
65 
66  //- Surface sensitivities
68 
69  //- Whether to include direct sensitivities or not.
70  // Used to avoid double contributions from both here and the
71  // sensitivitySurface object which might have already accounted for
72  // them
73  bool includeObjective_;
74 
75  //- Write sensitivity map upon write
77 
78 
79  // Protected Member Functions
80 
81  //- Read options from dict
82  void read();
83 
84 
85 private:
86 
87  // Private Member Functions
88 
89  //- No copy construct
90  SIBase(const SIBase&) = delete;
91 
92  //- No copy assignment
93  void operator=(const SIBase&) = delete;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("volumetricBSplinesFI");
100 
101 
102  // Constructors
103 
104  //- Construct from components
105  SIBase
106  (
107  const fvMesh& mesh,
108  const dictionary& dict,
109  incompressibleVars& primalVars,
110  incompressibleAdjointVars& adjointVars,
112  );
113 
114 
115  //- Destructor
116  virtual ~SIBase() = default;
117 
118 
119  // Member Functions
120 
121  //- Read dict if changed
122  virtual bool readDict(const dictionary& dict);
123 
124  //- Accumulate sensitivity integrands
125  virtual void accumulateIntegrand(const scalar dt);
126 
127  //- Assemble sensitivities
128  virtual void assembleSensitivities() = 0;
129 
130  //- Zero sensitivity fields and their constituents
131  virtual void clearSensitivities();
132 
133  //- Return reference to underlaying surface sensitivities
135 
136  //- Write sensitivity map
137  virtual void write(const word& baseName = word::null);
138 };
139 
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 } // End namespace incompressible
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
Foam::sensitivity::dict
const dictionary & dict() const
Return the construction dictionary.
Definition: sensitivity.C:57
Foam::objectiveManager
class for managing incompressible objective functions.
Definition: objectiveManager.H:54
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::incompressible::SIBase::readDict
virtual bool readDict(const dictionary &dict)
Read dict if changed.
Definition: SIBaseIncompressible.C:116
Foam::incompressible::SIBase::accumulateIntegrand
virtual void accumulateIntegrand(const scalar dt)
Accumulate sensitivity integrands.
Definition: SIBaseIncompressible.C:132
Foam::incompressible::SIBase
Base class for Surface Integral-based sensitivity derivatives.
Definition: SIBaseIncompressible.H:57
Foam::incompressible::SIBase::surfaceSensitivity_
sensitivitySurface surfaceSensitivity_
Surface sensitivities.
Definition: SIBaseIncompressible.H:66
Foam::incompressibleAdjointVars
Class including all adjoint fields for incompressible flows.
Definition: incompressibleAdjointVars.H:52
Foam::incompressible::SIBase::assembleSensitivities
virtual void assembleSensitivities()=0
Assemble sensitivities.
Foam::incompressible::SIBase::TypeName
TypeName("volumetricBSplinesFI")
Runtime type information.
Foam::incompressible::shapeSensitivities
Definition: shapeSensitivitiesIncompressible.H:55
Foam::incompressible::SIBase::clearSensitivities
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
Definition: SIBaseIncompressible.C:148
Foam::incompressible::SIBase::write
virtual void write(const word &baseName=word::null)
Write sensitivity map.
Definition: SIBaseIncompressible.C:161
Foam::incompressible::SIBase::~SIBase
virtual ~SIBase()=default
Destructor.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::incompressible::SIBase::getSurfaceSensitivities
const sensitivitySurface & getSurfaceSensitivities() const
Return reference to underlaying surface sensitivities.
Definition: SIBaseIncompressible.C:155
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::incompressible::SIBase::read
void read()
Read options from dict.
Definition: SIBaseIncompressible.C:48
Foam::incompressible::SIBase::includeObjective_
bool includeObjective_
Whether to include direct sensitivities or not.
Definition: SIBaseIncompressible.H:72
shapeSensitivitiesIncompressible.H
sensitivitySurfaceIncompressible.H
Foam::incompressible::SIBase::writeSensitivityMap_
bool writeSensitivityMap_
Write sensitivity map upon write.
Definition: SIBaseIncompressible.H:75
Foam::word::null
static const word null
An empty word.
Definition: word.H:80
Foam::incompressible::sensitivitySurface
Calculation of adjoint based sensitivities at wall faces.
Definition: sensitivitySurfaceIncompressible.H:81
Foam::incompressibleVars
Base class for solution control classes.
Definition: incompressibleVars.H:54