objectiveFlowRate.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::objectiveFlowRate
30 
31 Description
32  Minimize/maximize flow rate through a given set of patches
33 
34 SourceFiles
35  objectiveFlowRate.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef objectiveFlowRate_H
40 #define objectiveFlowRate_H
41 
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 namespace objectives
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class objectiveFlowRate Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
59 {
60  // Private data
61 
62  //- Patches used to define the objective function
63  labelList patches_;
64 
65  //- Flow rate in each patch
66  scalarList flowRates_;
67 
68 
69 public:
70 
71  //- Runtime type information
72  TypeName("flowRate");
73 
74 
75  // Constructors
76 
77  //- from components
79  (
80  const fvMesh& mesh,
81  const dictionary& dict,
82  const word& adjointSolverName,
83  const word& primalSolverName
84  );
85 
86 
87  //- Destructor
88  virtual ~objectiveFlowRate() = default;
89 
90 
91  // Member Functions
92 
93  //- Return the objective function value
94  virtual scalar J();
95 
96  //- Update values to be added to the adjoint outlet velocity
97  virtual void update_boundarydJdv();
98 
99  //- Update values to be added to the adjoint outlet pressure
100  virtual void update_boundarydJdvn();
101 
102  // Helper write functions
103 
104  //- Write headers for additional columns
105  virtual void addHeaderColumns() const;
106 
107  //- Write information to additional columns
108  virtual void addColumnValues() const;
109 };
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 } // End namespace objectives
115 } // End namespace Foam
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 #endif
120 
121 // ************************************************************************* //
objectiveFlowRate(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
from components
const dictionary & dict() const
Return objective dictionary.
Definition: objective.C:91
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Minimize/maximize flow rate through a given set of patches.
TypeName("flowRate")
Runtime type information.
virtual ~objectiveFlowRate()=default
Destructor.
virtual void addHeaderColumns() const
Write headers for additional columns.
dynamicFvMesh & mesh
virtual scalar J()
Return the objective function value.
virtual void update_boundarydJdvn()
Update values to be added to the adjoint outlet pressure.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void addColumnValues() const
Write information to additional columns.
virtual void update_boundarydJdv()
Update values to be added to the adjoint outlet velocity.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Abstract base class for objective functions in incompressible flows.
Namespace for OpenFOAM.