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
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class adjointBoundaryCondition Declaration
50\*---------------------------------------------------------------------------*/
51
52template<class Type>
54{
55protected:
56
57 // Protected data
58
59 //- Reference to patch
60 const fvPatch& patch_;
61
62 //- objectiveManager name corresponding to field
64
65 //- adjointSolver name corresponding to field
67
68 //- simulationType corresponding to field.
69 // A placeholder for now
71
72 //- Engine to manage contributions of the objective functions
73 //- to the adjoint boundary conditions
75
76
77 //- Whether to add the extra term from the UaGradU formulation
78 // autoPtr since ATCModel has not been allocated at the time
79 // adjointBoundaryConditions are constructed
81
82
83 // Protected Member Functions
84
85 //- Get gradient of field on a specific boundary
86 template<class Type2>
87 tmp
88 <
91
92 //- Whether to add the extra term from the UaGradU formulation
93 bool addATCUaGradUTerm();
94
95
96public:
97
98 // Static Data Members
99
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<Type>() = 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
158 virtual void updatePrimalBasedQuantities();
159};
160
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164} // End namespace Foam
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168#ifdef NoRepository
170#endif
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#endif
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:63
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
Base class for solution control classes.
const word & objectiveManagerName() const
Return objectiveManager name.
const ATCModel & getATC() const
ATC type might be useful for a number of BCs. Return here.
autoPtr< bool > addATCUaGradUTerm_
Whether to add the extra term from the UaGradU formulation.
const word & adjointSolverName() const
Return adjointSolverName.
boundaryAdjointContribution & getBoundaryAdjContribution()
Get boundaryContribution.
TypeName("adjointBoundaryCondition")
Run-time type information.
autoPtr< boundaryAdjointContribution > boundaryContrPtr_
const word & simulationType() const
Return the simulationType.
word adjointSolverName_
adjointSolver name corresponding to field
tmp< Field< typename Foam::outerProduct< Foam::vector, Type2 >::type > > computePatchGrad(word name)
Get gradient of field on a specific boundary.
const fvPatch & patch_
Reference to patch.
virtual tmp< Field< typename Foam::outerProduct< Foam::vector, Type >::type > > dxdbMult() const
Return contribution to sensitivity derivatives.
word simulationType_
simulationType corresponding to field.
word managerName_
objectiveManager name corresponding to field
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:66
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:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73