boundaryAdjointContribution.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::boundaryAdjointContribution
31 
32 Description
33  Abstract base class for computing contributions of the objective functions
34  to the adjoint boundary conditions
35 
36 SourceFiles
37  boundaryAdjointContribution.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef boundaryAdjointContribution_H
42 #define boundaryAdjointContribution_H
43 
44 #include "IOdictionary.H"
45 #include "autoPtr.H"
46 #include "runTimeSelectionTables.H"
47 #include "fvPatchFields.H"
48 #include "fvsPatchFields.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class boundaryAdjointContribution Declaration
57 \*---------------------------------------------------------------------------*/
58 
60 {
61 private:
62 
63  // Private Member Functions
64 
65  //- No copy construct
67  (
69  ) = delete;
70 
71  //- No copy assignment
72  void operator=(const boundaryAdjointContribution&) = delete;
73 
74 
75 protected:
76 
77  // Protected data
78 
79  const fvPatch& patch_;
80 
81 
82 public:
83 
84  //- Runtime type information
85  TypeName("boundaryAdjointContribution");
86 
87 
88  // Declare run-time constructor selection table
89 
91  (
92  autoPtr,
94  dictionary,
95  (
96  const word& managerName,
97  const word& adjointSolverName,
98  const word& simulationType,
99  const fvPatch& patch
100  ),
101  (managerName, adjointSolverName, simulationType, patch)
102  );
103 
104  // Constructors
105 
106  //- Construct from components
108  (
109  const word& managerName,
110  const word& adjointSolverName,
111  const word& simulationType,
112  const fvPatch& patch
113  );
114 
115 
116  // Selectors
117 
118  //- Return a reference to the selected turbulence model
120  (
121  const word& managerName,
122  const word& adjointSolverName,
123  const word& simulationType,
124  const fvPatch& patch
125  );
126 
127 
128  //- Destructor
129  virtual ~boundaryAdjointContribution() = default;
130 
131 
132  // Member Functions
133 
134  // Contribution to surface sensitivities for a specific patch
135  virtual tmp<scalarField> pressureSource() = 0;
136  virtual tmp<vectorField> velocitySource() = 0;
141  virtual tmp<scalarField> energySource() = 0;
142 
143  virtual tmp<scalarField> momentumDiffusion() = 0;
144  virtual tmp<scalarField> laminarDiffusivity() = 0;
145  virtual tmp<scalarField> thermalDiffusion() = 0;
146  virtual tmp<scalarField> wallDistance() = 0;
147 
150  virtual tmp<scalarField> TMVariable1();
151  virtual tmp<scalarField> TMVariable2();
152 
153  // References to primal and adjoint fields for the specific patch
154  virtual const fvPatchVectorField& Ub() const = 0;
155  virtual const fvPatchScalarField& pb() const = 0;
156  virtual const fvsPatchScalarField& phib() const = 0;
157  virtual const fvPatchScalarField& turbulentDiffusivity() const = 0;
158  virtual const fvPatchVectorField& Uab() const = 0;
159  virtual const fvPatchScalarField& pab() const = 0;
160  virtual const fvsPatchScalarField& phiab() const = 0;
161 
162  // Field suffixes for primal and adjoint fields
163  virtual const word primalSolverName() const = 0;
164  virtual const word adjointSolverName() const = 0;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
Foam::fvPatchField< vector >
Foam::boundaryAdjointContribution::TypeName
TypeName("boundaryAdjointContribution")
Runtime type information.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::boundaryAdjointContribution::velocitySource
virtual tmp< vectorField > velocitySource()=0
Foam::boundaryAdjointContribution::TMVariable1Diffusion
virtual tmp< scalarField > TMVariable1Diffusion()
Definition: boundaryAdjointContribution.C:106
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::boundaryAdjointContribution::TMVariable1
virtual tmp< scalarField > TMVariable1()
Definition: boundaryAdjointContribution.C:118
Foam::boundaryAdjointContribution::momentumDiffusion
virtual tmp< scalarField > momentumDiffusion()=0
Foam::fvsPatchField
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:68
Foam::boundaryAdjointContribution::pb
virtual const fvPatchScalarField & pb() const =0
Foam::boundaryAdjointContribution::phiab
virtual const fvsPatchScalarField & phiab() const =0
Foam::boundaryAdjointContribution::Uab
virtual const fvPatchVectorField & Uab() const =0
Foam::boundaryAdjointContribution::energySource
virtual tmp< scalarField > energySource()=0
Foam::boundaryAdjointContribution::adjointSolverName
virtual const word adjointSolverName() const =0
Foam::boundaryAdjointContribution::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, boundaryAdjointContribution, dictionary,(const word &managerName, const word &adjointSolverName, const word &simulationType, const fvPatch &patch),(managerName, adjointSolverName, simulationType, patch))
Foam::boundaryAdjointContribution::pab
virtual const fvPatchScalarField & pab() const =0
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::boundaryAdjointContribution::TMVariable2
virtual tmp< scalarField > TMVariable2()
Definition: boundaryAdjointContribution.C:124
Foam::boundaryAdjointContribution::turbulentDiffusivity
virtual const fvPatchScalarField & turbulentDiffusivity() const =0
Foam::boundaryAdjointContribution::primalSolverName
virtual const word primalSolverName() const =0
Foam::boundaryAdjointContribution::Ub
virtual const fvPatchVectorField & Ub() const =0
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::boundaryAdjointContribution::laminarDiffusivity
virtual tmp< scalarField > laminarDiffusivity()=0
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::boundaryAdjointContribution::wallDistance
virtual tmp< scalarField > wallDistance()=0
fvsPatchFields.H
IOdictionary.H
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::boundaryAdjointContribution::tangentVelocitySource
virtual tmp< vectorField > tangentVelocitySource()=0
Foam::boundaryAdjointContribution::patch_
const fvPatch & patch_
Definition: boundaryAdjointContribution.H:78
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
fvPatchFields.H
Foam::boundaryAdjointContribution::adjointTMVariable1Source
virtual tmp< scalarField > adjointTMVariable1Source()
Definition: boundaryAdjointContribution.C:94
Foam::boundaryAdjointContribution::normalVelocitySource
virtual tmp< vectorField > normalVelocitySource()=0
Foam::boundaryAdjointContribution::adjointTMVariable2Source
virtual tmp< scalarField > adjointTMVariable2Source()
Definition: boundaryAdjointContribution.C:100
Foam::boundaryAdjointContribution::pressureSource
virtual tmp< scalarField > pressureSource()=0
Foam::boundaryAdjointContribution::thermalDiffusion
virtual tmp< scalarField > thermalDiffusion()=0
Foam::boundaryAdjointContribution::TMVariable2Diffusion
virtual tmp< scalarField > TMVariable2Diffusion()
Definition: boundaryAdjointContribution.C:112
Foam::boundaryAdjointContribution::phib
virtual const fvsPatchScalarField & phib() const =0
Foam::boundaryAdjointContribution::~boundaryAdjointContribution
virtual ~boundaryAdjointContribution()=default
Destructor.
Foam::boundaryAdjointContribution::New
static autoPtr< boundaryAdjointContribution > New(const word &managerName, const word &adjointSolverName, const word &simulationType, const fvPatch &patch)
Return a reference to the selected turbulence model.
Definition: boundaryAdjointContribution.C:59
autoPtr.H