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