objectiveUniformityCellZone.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::objectiveUniformityCellZone
30 
31 Description
32  Computes and minimizes (half) the variance of the velocity distribution in
33  a given set of cellZones
34 
35 SourceFiles
36  objectiveUniformityCellZone.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef objectiveUniformityCellZone_H
41 #define objectiveUniformityCellZone_H
42 
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 namespace objectives
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class objectiveUniformityCellZone Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
60 {
61  // Private data
62 
63  //- Where to define the objective
64  labelList zones_;
65 
66  //- Mean velocity value per objective zone
67  vectorField UMean_;
68 
69  //- Velocity variance per objective zone
70  scalarField UVar_;
71 
72  //- Volume integral per objective zone
73  scalarField volZone_;
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("uniformityCellZone");
80 
81 
82  // Constructors
83 
84  //- from components
86  (
87  const fvMesh& mesh,
88  const dictionary& dict,
89  const word& adjointSolverName,
90  const word& primalSolverName
91  );
92 
93 
94  //- Destructor
95  virtual ~objectiveUniformityCellZone() = default;
96 
97 
98  // Member Functions
99 
100  //- Return the objectiveReportPatches
101  void initialize();
102 
103  //- Return the objective function value
104  scalar J();
105 
106  //- Update values to be added to the adjoint outlet velocity
107  void update_dJdv();
108 
109  //- Update div( dx/db multiplier). Volume-based sensitivity term
110  virtual void update_divDxDbMultiplier();
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 // ************************************************************************* //
TypeName("uniformityCellZone")
Runtime type information.
const dictionary & dict() const
Return objective dictionary.
Definition: objective.C:87
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
virtual void addColumnValues() const
Write information to additional columns.
virtual void update_divDxDbMultiplier()
Update div( dx/db multiplier). Volume-based sensitivity term.
objectiveUniformityCellZone(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
from components
virtual void addHeaderColumns() const
Write headers for additional columns.
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
void update_dJdv()
Update values to be added to the adjoint outlet velocity.
scalar J()
Return the objective function value.
Computes and minimizes (half) the variance of the velocity distribution in a given set of cellZones...
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:79
void initialize()
Return the objectiveReportPatches.
Abstract base class for objective functions in incompressible flows.
virtual ~objectiveUniformityCellZone()=default
Destructor.
Namespace for OpenFOAM.