incompressibleAdjointMeanFlowVars.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::incompressibleAdjointMeanFlowVars
31 
32 Description
33  Manages the adjoint mean flow fields and their mean values
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef incompressibleAdjointMeanFlowVars_H
38 #define incompressibleAdjointMeanFlowVars_H
39 
40 #include "variablesSet.H"
41 #include "incompressibleVars.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class incompressibleAdjointMeanFlowVars Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 :
54  public variablesSet
55 {
56 private:
57 
58  // Private Member Functions
59 
60  //- No copy construct
62  (
64  );
65 
66  //- No copy assignment
67  void operator=(const incompressibleAdjointMeanFlowVars&);
68 
69 
70 protected:
71 
72  // Protected data
73 
74  //- Reference to the solverControl of the solver allocating the fields
76 
77  //- Reference to primal variables
79 
80  //- Fields involved in the solution of the incompressible adjoint NS
81  //- equations
85 
86  //- Mean Adjoint Fields. Actual averaging is done in the
87  //- incompressibleAdjointVars class to take care of the mean adjoint
88  //- turbulence variables
92 
93  // Protected Member Functions
94 
95  //- Read fields and set turbulence
96  void setFields();
97 
98  //- Read mean fields, if necessary
99  void setMeanFields();
100 
101 
102 public:
103 
104 
105  // Static Data Members
106 
107  //- Run-time type information
108  TypeName("incompressibleAdjointMeanFlowVars");
109 
110 
111  // Constructors
112 
113  //- Construct from mesh
115  (
116  fvMesh& mesh,
117  solverControl& SolverControl,
119  );
120 
121 
122  //- Destructor
123  virtual ~incompressibleAdjointMeanFlowVars() = default;
124 
125 
126  // Member Functions
127 
128 
129  // Access
130 
131  // Const access to the primal vars related to the adjoint vars
132  const incompressibleVars& primalVars() const;
133 
134  // Access to adjoint fields. Might be averaged or not depending on
135  // the correspondign switch. Averaged fields are used to compute
136  // an "average" sensitivity field
137 
138  //- Return const reference to pressure
139  const volScalarField& pa() const;
140 
141  //- Return reference to pressure
142  volScalarField& pa();
143 
144  //- Return const reference to velocity
145  const volVectorField& Ua() const;
146 
147  //- Return reference to velocity
148  volVectorField& Ua();
149 
150  //- Return const reference to volume flux
151  const surfaceScalarField& phia() const;
152 
153  //- Return reference to volume flux
155 
156 
157  // Access to instantaneous fields. Solvers and adjoint boundary
158  // conditions should use these fields to execute a solver iteration
159 
160  //- Return const reference to pressure
161  const volScalarField& paInst() const;
162 
163  //- Return reference to pressure
165 
166  //- Return const reference to velocity
167  const volVectorField& UaInst() const;
168 
169  //- Return reference to velocity
171 
172  //- Return const reference to volume flux
173  const surfaceScalarField& phiaInst() const;
174 
175  //- Return reference to volume flux
177 
178  //- Return computeMeanFields bool
179  bool computeMeanFields() const;
180 
181  //- Return const reference to solverControl
182  const solverControl& getSolverControl() const;
183 
184  //- Nullify all adjoint fields
185  virtual void nullify();
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
Foam::incompressibleAdjointMeanFlowVars::setFields
void setFields()
Read fields and set turbulence.
Definition: incompressibleAdjointMeanFlowVars.C:43
Foam::incompressibleAdjointMeanFlowVars
Manages the adjoint mean flow fields and their mean values.
Definition: incompressibleAdjointMeanFlowVars.H:51
Foam::incompressibleAdjointMeanFlowVars::~incompressibleAdjointMeanFlowVars
virtual ~incompressibleAdjointMeanFlowVars()=default
Destructor.
Foam::incompressibleAdjointMeanFlowVars::setMeanFields
void setMeanFields()
Read mean fields, if necessary.
Definition: incompressibleAdjointMeanFlowVars.C:60
Foam::incompressibleAdjointMeanFlowVars::nullify
virtual void nullify()
Nullify all adjoint fields.
Definition: incompressibleAdjointMeanFlowVars.C:273
incompressibleVars.H
Foam::incompressibleAdjointMeanFlowVars::phiaMeanPtr_
autoPtr< surfaceScalarField > phiaMeanPtr_
Definition: incompressibleAdjointMeanFlowVars.H:90
Foam::incompressibleAdjointMeanFlowVars::phiaInst
const surfaceScalarField & phiaInst() const
Return const reference to volume flux.
Definition: incompressibleAdjointMeanFlowVars.C:249
Foam::solverControl
Base class for solver control classes.
Definition: solverControl.H:51
Foam::incompressibleAdjointMeanFlowVars::UaPtr_
autoPtr< volVectorField > UaPtr_
Definition: incompressibleAdjointMeanFlowVars.H:82
Foam::incompressibleAdjointMeanFlowVars::paPtr_
autoPtr< volScalarField > paPtr_
Definition: incompressibleAdjointMeanFlowVars.H:81
Foam::incompressibleAdjointMeanFlowVars::primalVars
const incompressibleVars & primalVars() const
Definition: incompressibleAdjointMeanFlowVars.C:142
Foam::variablesSet
Base class for creating a set of variables.
Definition: variablesSet.H:49
Foam::incompressibleAdjointMeanFlowVars::primalVars_
incompressibleVars & primalVars_
Reference to primal variables.
Definition: incompressibleAdjointMeanFlowVars.H:77
Foam::incompressibleAdjointMeanFlowVars::paInst
const volScalarField & paInst() const
Return const reference to pressure.
Definition: incompressibleAdjointMeanFlowVars.C:225
Foam::incompressibleAdjointMeanFlowVars::pa
const volScalarField & pa() const
Return const reference to pressure.
Definition: incompressibleAdjointMeanFlowVars.C:147
Foam::incompressibleAdjointMeanFlowVars::Ua
const volVectorField & Ua() const
Return const reference to velocity.
Definition: incompressibleAdjointMeanFlowVars.C:173
Foam::incompressibleAdjointMeanFlowVars::UaMeanPtr_
autoPtr< volVectorField > UaMeanPtr_
Definition: incompressibleAdjointMeanFlowVars.H:89
Foam::incompressibleAdjointMeanFlowVars::paMeanPtr_
autoPtr< volScalarField > paMeanPtr_
Definition: incompressibleAdjointMeanFlowVars.H:88
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::incompressibleAdjointMeanFlowVars::getSolverControl
const solverControl & getSolverControl() const
Return const reference to solverControl.
Definition: incompressibleAdjointMeanFlowVars.C:267
Foam::incompressibleAdjointMeanFlowVars::computeMeanFields
bool computeMeanFields() const
Return computeMeanFields bool.
Definition: incompressibleAdjointMeanFlowVars.C:261
Foam::incompressibleAdjointMeanFlowVars::solverControl_
solverControl & solverControl_
Reference to the solverControl of the solver allocating the fields.
Definition: incompressibleAdjointMeanFlowVars.H:74
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::incompressibleAdjointMeanFlowVars::TypeName
TypeName("incompressibleAdjointMeanFlowVars")
Run-time type information.
Foam::incompressibleAdjointMeanFlowVars::phiaPtr_
autoPtr< surfaceScalarField > phiaPtr_
Definition: incompressibleAdjointMeanFlowVars.H:83
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::incompressibleAdjointMeanFlowVars::phia
const surfaceScalarField & phia() const
Return const reference to volume flux.
Definition: incompressibleAdjointMeanFlowVars.C:199
Foam::incompressibleAdjointMeanFlowVars::UaInst
const volVectorField & UaInst() const
Return const reference to velocity.
Definition: incompressibleAdjointMeanFlowVars.C:237
variablesSet.H
Foam::incompressibleVars
Base class for solution control classes.
Definition: incompressibleVars.H:54