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 public:
74 
75  //- Runtime type information
76  TypeName("uniformityPatch");
77 
78 
79  // Constructors
80 
81  //- from components
83  (
84  const fvMesh& mesh,
85  const dictionary& dict,
86  const word& adjointSolverName,
87  const word& primalSolverName
88  );
89 
90 
91  //- Destructor
92  virtual ~objectiveUniformityPatch() = default;
93 
94 
95  // Member Functions
96 
97  //- Return the objectiveReportPatches
98  void initialize();
99 
100  //- Return the objective function value
101  scalar J();
102 
103  //- Update values to be added to the adjoint outlet velocity
104  void update_boundarydJdv();
105 
106  //- Update values to be added to the adjoint outlet pressure
107  void update_boundarydJdvn();
108 
109  //- Update values to be added to the adjoint outlet tangential velocity
110  void update_boundarydJdvt();
111 
112  // Helper write functions
113 
114  //- Write headers for additional columns
115  virtual void addHeaderColumns() const;
116 
117  //- Write information to additional columns
118  virtual void addColumnValues() const;
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace objectives
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
const dictionary & dict() const
Return objective dictionary.
Definition: objective.C:87
TypeName("uniformityPatch")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
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
void initialize()
Return the objectiveReportPatches.
void update_boundarydJdvt()
Update values to be added to the adjoint outlet tangential velocity.
void update_boundarydJdv()
Update values to be added to the adjoint outlet velocity.
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:79
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.