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-2021 PCOpt/NTUA
9  Copyright (C) 2013-2021 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  ) = delete;
65 
66  //- No copy assignment
67  void operator=(const incompressibleAdjointMeanFlowVars&) = delete;
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  inline const volScalarField& paInst() const;
162 
163  //- Return reference to pressure
164  inline volScalarField& paInst();
165 
166  //- Return const reference to velocity
167  inline const volVectorField& UaInst() const;
168 
169  //- Return reference to velocity
170  inline volVectorField& UaInst();
171 
172  //- Return const reference to volume flux
173  inline const surfaceScalarField& phiaInst() const;
174 
175  //- Return reference to volume flux
176  inline surfaceScalarField& phiaInst();
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 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
void setMeanFields()
Read mean fields, if necessary.
virtual void nullify()
Nullify all adjoint fields.
const volScalarField & paInst() const
Return const reference to pressure.
virtual ~incompressibleAdjointMeanFlowVars()=default
Destructor.
autoPtr< volScalarField > paPtr_
Fields involved in the solution of the incompressible adjoint NS equations.
Base class for solution control classes.
incompressibleVars & primalVars_
Reference to primal variables.
dynamicFvMesh & mesh
const volScalarField & pa() const
Return const reference to pressure.
const volVectorField & Ua() const
Return const reference to velocity.
Base class for solver control classes.
Definition: solverControl.H:45
autoPtr< volScalarField > paMeanPtr_
Mean Adjoint Fields. Actual averaging is done in the incompressibleAdjointVars class to take care of ...
bool computeMeanFields() const
Return computeMeanFields bool.
const solverControl & getSolverControl() const
Return const reference to solverControl.
Manages the adjoint mean flow fields and their mean values.
const volVectorField & UaInst() const
Return const reference to velocity.
Base class for creating a set of variables.
Definition: variablesSet.H:43
solverControl & solverControl_
Reference to the solverControl of the solver allocating the fields.
const surfaceScalarField & phiaInst() const
Return const reference to volume flux.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
TypeName("incompressibleAdjointMeanFlowVars")
Run-time type information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
const surfaceScalarField & phia() const
Return const reference to volume flux.
void setFields()
Read fields and set turbulence.
Namespace for OpenFOAM.