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-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 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 
53 {
54 protected:
55 
56  // Protected data
57 
58  //- Reference to patch
59  const fvPatch& patch_;
60 
61  //- objectiveManager name corresponding to field
63 
64  //- adjointSolver name corresponding to field
66 
67  //- simulationType corresponding to field.
68  // A placeholder for now
70 
71  //- Engine to manage contributions of the objective functions
72  //- to the adjoint boundary conditions
74 
75 
76  //- Whether to add the extra term from the UaGradU formulation
77  // autoPtr since ATCModel has not been allocated at the time
78  // adjointBoundaryConditions are constructed
80 
81 
82  // Protected Member Functions
83 
84  //- Get gradient of field on a specific boundary
85  template<class Type>
86  tmp
87  <
90 
91  //- Whether to add the extra term from the UaGradU formulation
92  bool addATCUaGradUTerm();
93 
94 
95 public:
96 
97  // Static Data Members
98 
99  //- Run-time type information
100  TypeName("adjointBoundaryCondition");
101 
102 
103  // Constructors
104 
105  //- Construct from field and base name
106  template<class Type>
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 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #ifdef NoRepository
154 #endif
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
Foam::adjointBoundaryCondition::adjointBoundaryCondition
adjointBoundaryCondition(const fvPatch &p, const DimensionedField< Type, volMesh > &iF, const word &solverName)
Construct from field and base name.
Definition: adjointBoundaryConditionTemplates.C:145
Foam::adjointBoundaryCondition::getBoundaryAdjContribution
boundaryAdjointContribution & getBoundaryAdjContribution()
Get boundaryContribution.
Definition: adjointBoundaryCondition.C:132
p
volScalarField & p
Definition: createFieldRefs.H:8
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:58
Foam::adjointBoundaryCondition::simulationType
const word & simulationType() const
Return the simulationType.
Definition: adjointBoundaryCondition.C:94
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
boundaryAdjointContribution.H
Foam::adjointBoundaryCondition
Base class for solution control classes.
Definition: adjointBoundaryCondition.H:51
Foam::adjointBoundaryCondition::boundaryContrPtr_
autoPtr< boundaryAdjointContribution > boundaryContrPtr_
Definition: adjointBoundaryCondition.H:72
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:138
Foam::adjointBoundaryCondition::setBoundaryContributionPtr
void setBoundaryContributionPtr()
Set the ptr to the correct boundaryAdjointContribution.
Definition: adjointBoundaryCondition.C:100
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::computePatchGrad
tmp< Field< typename Foam::outerProduct< Foam::vector, Type >::type > > computePatchGrad(word name)
Get gradient of field on a specific boundary.
Foam::adjointBoundaryCondition::adjointSolverName_
word adjointSolverName_
adjointSolver name corresponding to field
Definition: adjointBoundaryCondition.H:64
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
adjointBoundaryConditionTemplates.C
Foam::adjointBoundaryCondition::simulationType_
word simulationType_
simulationType corresponding to field.
Definition: adjointBoundaryCondition.H:68
Foam::adjointBoundaryCondition::addATCUaGradUTerm
bool addATCUaGradUTerm()
Whether to add the extra term from the UaGradU formulation.
Definition: adjointBoundaryCondition.C:45
Foam::adjointBoundaryCondition::managerName_
word managerName_
objectiveManager name corresponding to field
Definition: adjointBoundaryCondition.H:61
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::objectiveManagerName
const word & objectiveManagerName() const
Return objectiveManager name.
Definition: adjointBoundaryCondition.C:82
Foam::adjointBoundaryCondition::adjointSolverName
const word & adjointSolverName() const
Return adjointSolverName.
Definition: adjointBoundaryCondition.C:88
Foam::adjointBoundaryCondition::~adjointBoundaryCondition
virtual ~adjointBoundaryCondition()=default
Destructor.
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:78