Loading...
Searching...
No Matches
adjointBoundaryCondition.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-2021 PCOpt/NTUA
9 Copyright (C) 2013-2021 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::adjointBoundaryCondition
31
32Description
33 Base class for solution control classes
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef adjointBoundaryCondition_H
38#define adjointBoundaryCondition_H
39
41#include "ATCModel.H"
42#include "Switch.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
48
49/*---------------------------------------------------------------------------*\
50 Class adjointBoundaryCondition Declaration
51\*---------------------------------------------------------------------------*/
52
53template<class Type>
55{
56protected:
57
58 // Protected data
59
60 //- Reference to patch
62
63 //- objectiveManager name corresponding to field
65
66 //- adjointSolver name corresponding to field
68
69 //- simulationType corresponding to field.
70 // A placeholder for now
72
73 //- Engine to manage contributions of the objective functions
74 //- to the adjoint boundary conditions
76
77 //- Whether to add the extra term from the UaGradU formulation.
78 // As a Switch with delayed evaluation since ATCModel
79 // has not been allocated at the time of construction
81
82
83 // Protected Member Functions
84
85 //- Get gradient of field on a specific boundary
86 template<class Type2>
88 <
91
92 //- Whether to add the extra term from the UaGradU formulation
93 bool addATCUaGradUTerm();
94
95
96public:
97
98 // Static Data Members
100 //- Run-time type information
101 TypeName("adjointBoundaryCondition");
102
103
104 // Constructors
105
106 //- Construct from field and base name
108 (
109 const fvPatch& p,
111 const word& solverName
112 );
113
114 //- Construct as copy
116
117
118 //- Destructor
119 virtual ~adjointBoundaryCondition() = default;
120
121
122 // Member Functions
123
124 // Access
125
126 //- Return objectiveManager name
127 const word& objectiveManagerName() const;
128
129 //- Return adjointSolverName
130 const word& adjointSolverName() const;
131
132 //- Return the simulationType
133 const word& simulationType() const;
134
135 //- Set the ptr to the correct boundaryAdjointContribution
137
138 //- Get boundaryContribution
140
141 //- ATC type might be useful for a number of BCs. Return here
142 const ATCModel& getATC() const;
143
144
145 // Contribution to sensitivity derivatives
146
147 //- Return contribution to sensitivity derivatives
148 // For adjoint boundary conditions corresponding to primal
149 // boundary conditions that include geometric components
150 // (e.g. rotatingWallVelocity)
151 virtual tmp
152 <
154 > dxdbMult() const;
155
156 //- Update the primal based quantities related to the adjoint boundary
157 //- conditions
159};
160
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164} // End namespace Foam
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168#ifdef NoRepository
170#endif
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174#endif
175
176#define makeAdjointBoundaryCondition(adjointTypeBoundaryCondition) \
177defineNamedTemplateTypeNameAndDebug(adjointTypeBoundaryCondition, 0);
178
179// ************************************************************************* //
Base class for selecting the adjoint transpose convection model. Inherits from regIOobject to add loo...
Definition ATCModel.H:59
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition Switch.H:81
const word & objectiveManagerName() const
Return objectiveManager name.
const ATCModel & getATC() const
ATC type might be useful for a number of BCs. Return here.
const word & adjointSolverName() const
Return adjointSolverName.
virtual ~adjointBoundaryCondition()=default
Destructor.
boundaryAdjointContribution & getBoundaryAdjContribution()
Get boundaryContribution.
TypeName("adjointBoundaryCondition")
Run-time type information.
adjointBoundaryCondition(const adjointBoundaryCondition< Type > &)
Construct as copy.
autoPtr< boundaryAdjointContribution > boundaryContrPtr_
const word & simulationType() const
Return the simulationType.
adjointBoundaryCondition(const fvPatch &p, const DimensionedField< Type, volMesh > &iF, const word &solverName)
Construct from field and base name.
virtual void updatePrimalBasedQuantities()
Update the primal based quantities related to the adjoint boundary conditions.
tmp< Field< typename Foam::outerProduct< Foam::vector, Type2 >::type > > computePatchGrad(word name)
Get gradient of field on a specific boundary.
virtual tmp< Field< typename Foam::outerProduct< Foam::vector, Type >::type > > dxdbMult() const
Return contribution to sensitivity derivatives.
void setBoundaryContributionPtr()
Set the ptr to the correct boundaryAdjointContribution.
bool addATCUaGradUTerm()
Whether to add the extra term from the UaGradU formulation.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Abstract base class for computing contributions of the objective functions to the adjoint boundary co...
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68