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-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::adjointBoundaryCondition
31 
32 Description
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 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class adjointBoundaryCondition Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
54 {
55 protected:
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 
96 public:
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 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #ifdef NoRepository
165  #include "adjointBoundaryCondition.C"
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 #define makeAdjointBoundaryCondition(adjointTypeBoundaryCondition) \
173 defineNamedTemplateTypeNameAndDebug(adjointTypeBoundaryCondition, 0);
174 
175 // ************************************************************************* //
Foam::adjointBoundaryCondition::getBoundaryAdjContribution
boundaryAdjointContribution & getBoundaryAdjContribution()
Get boundaryContribution.
Definition: adjointBoundaryCondition.C:259
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::adjointBoundaryCondition::adjointBoundaryCondition
adjointBoundaryCondition(const fvPatch &p, const DimensionedField< Type, volMesh > &iF, const word &solverName)
Construct from field and base name.
Definition: adjointBoundaryCondition.C:184
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
ATCModel.H
Foam::adjointBoundaryCondition::patch_
const fvPatch & patch_
Reference to patch.
Definition: adjointBoundaryCondition.H:59
Foam::adjointBoundaryCondition::simulationType
const word & simulationType() const
Return the simulationType.
Definition: adjointBoundaryCondition.C:219
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
adjointBoundaryCondition.C
boundaryAdjointContribution.H
Foam::adjointBoundaryCondition
Base class for solution control classes.
Definition: adjointBoundaryCondition.H:52
Foam::adjointBoundaryCondition::boundaryContrPtr_
autoPtr< boundaryAdjointContribution > boundaryContrPtr_
Definition: adjointBoundaryCondition.H:73
Foam::ATCModel
Base class for selecting the adjoint transpose convection model. Inherits from regIOobject to add loo...
Definition: ATCModel.H:60
Foam::adjointBoundaryCondition::getATC
const ATCModel & getATC() const
ATC type might be useful for a number of BCs. Return here.
Definition: adjointBoundaryCondition.C:266
Foam::adjointBoundaryCondition::setBoundaryContributionPtr
void setBoundaryContributionPtr()
Set the ptr to the correct boundaryAdjointContribution.
Definition: adjointBoundaryCondition.C:226
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::adjointBoundaryCondition::adjointSolverName_
word adjointSolverName_
adjointSolver name corresponding to field
Definition: adjointBoundaryCondition.H:65
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::adjointBoundaryCondition::simulationType_
word simulationType_
simulationType corresponding to field.
Definition: adjointBoundaryCondition.H:69
Foam::adjointBoundaryCondition::addATCUaGradUTerm
bool addATCUaGradUTerm()
Whether to add the extra term from the UaGradU formulation.
Definition: adjointBoundaryCondition.C:144
Foam::adjointBoundaryCondition::computePatchGrad
tmp< Field< typename Foam::outerProduct< Foam::vector, Type2 >::type > > computePatchGrad(word name)
Get gradient of field on a specific boundary.
Foam::adjointBoundaryCondition::managerName_
word managerName_
objectiveManager name corresponding to field
Definition: adjointBoundaryCondition.H:62
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::boundaryAdjointContribution
Abstract base class for computing contributions of the objective functions to the adjoint boundary co...
Definition: boundaryAdjointContribution.H:58
Foam::adjointBoundaryCondition::dxdbMult
virtual tmp< Field< typename Foam::outerProduct< Foam::vector, Type >::type > > dxdbMult() const
Return contribution to sensitivity derivatives.
Foam::adjointBoundaryCondition::objectiveManagerName
const word & objectiveManagerName() const
Return objectiveManager name.
Definition: adjointBoundaryCondition.C:205
Foam::adjointBoundaryCondition::adjointSolverName
const word & adjointSolverName() const
Return adjointSolverName.
Definition: adjointBoundaryCondition.C:212
Foam::adjointBoundaryCondition::TypeName
TypeName("adjointBoundaryCondition")
Run-time type information.
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::adjointBoundaryCondition::addATCUaGradUTerm_
autoPtr< bool > addATCUaGradUTerm_
Whether to add the extra term from the UaGradU formulation.
Definition: adjointBoundaryCondition.H:79