objectiveUniformityPatch.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-2022 PCOpt/NTUA
9  Copyright (C) 2013-2022 FOSS GP
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 
28 Class
29  Foam::objectives::objectiveUniformityPatch
30 
31 Description
32  Computes and minimizes (half) the variance of the velocity distribution in
33  a given set of patches
34 
35 SourceFiles
36  objectiveUniformityPatch.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef objectiveUniformityPatch_H
41 #define objectiveUniformityPatch_H
42 
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 namespace objectives
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class objectiveUniformityPatch Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
60 {
61  // Private data
62 
63  //- Where to define the objective
64  labelList patches_;
65 
66  //- Mean velocity value per objective patch
67  vectorField UMean_;
68 
69  //- Velocity variance per objective patch
70  scalarField UVar_;
71 
72 
73  // Private Member Functions
74 
75  //- Return the objectiveReportPatches
76  void initialize();
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("uniformityPatch");
83 
84 
85  // Constructors
86 
87  //- from components
89  (
90  const fvMesh& mesh,
91  const dictionary& dict,
92  const word& adjointSolverName,
93  const word& primalSolverName
94  );
95 
96 
97  //- Destructor
98  virtual ~objectiveUniformityPatch() = default;
99 
100 
101  // Member Functions
102 
103  //- Return the objective function value
104  virtual scalar J();
105 
106  //- Update values to be added to the adjoint outlet velocity
107  virtual void update_boundarydJdv();
108 
109  //- Update values to be added to the adjoint outlet pressure
110  virtual void update_boundarydJdvn();
111 
112  //- Update values to be added to the adjoint outlet tangential velocity
113  virtual void update_boundarydJdvt();
114 
115  // Helper write functions
116 
117  //- Write headers for additional columns
118  virtual void addHeaderColumns() const;
119 
120  //- Write information to additional columns
121  virtual void addColumnValues() const;
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace objectives
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
const dictionary & dict() const
Return objective dictionary.
Definition: objective.C:91
TypeName("uniformityPatch")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual ~objectiveUniformityPatch()=default
Destructor.
Computes and minimizes (half) the variance of the velocity distribution in a given set of patches...
virtual void addHeaderColumns() const
Write headers for additional columns.
objectiveUniformityPatch(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
from components
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void update_boundarydJdvt()
Update values to be added to the adjoint outlet tangential velocity.
virtual void update_boundarydJdv()
Update values to be added to the adjoint outlet velocity.
virtual scalar J()
Return the objective function value.
virtual void addColumnValues() const
Write information to additional columns.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual void update_boundarydJdvn()
Update values to be added to the adjoint outlet pressure.
Abstract base class for objective functions in incompressible flows.
Namespace for OpenFOAM.