Loading...
Searching...
No Matches
topOZones.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-2023 PCOpt/NTUA
9 Copyright (C) 2013-2023 FOSS GP
10-------------------------------------------------------------------------------
11License
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
27Class
28 topOZones
29
30Description
31 Class holding cells zones used in topology optimisation
32
33SourceFiles
34 topOZones.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef topOZones_H
39#define topOZones_H
40
41#include "fvMesh.H"
42#include "betaMax.H"
43
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
50/*---------------------------------------------------------------------------*\
51 Class topOZones Declaration
52\*---------------------------------------------------------------------------*/
53
54class topOZones
55{
56
57protected:
58
59 // Protected data
60
61 //- Mesh reference
62 const fvMesh& mesh_;
63
64 //- TopO design variables dictionary
65 const dictionary dict_;
66
67 //- IDs of cellZones holding cells with constant alpha values
70 //- The constant alpha values of fixedPorousIDs_
72
73 //- IDs of cellZones holding cells with zero alpha values
75
76 //- IDs of cellZones with cells that can change their alpha value
77 //- throughout the optimisation
80 //- ID of the cellZone holding the cells next to inlets & outlets
81 label IOcellsID_;
82
83 //- The multiplier of the Brinkman penalisation term
86
87 // Protected Member Functions
88
89 //- Get zone IDs corresponding to a wordList, read from a dict.
90 // Avoid going through ZoneMesh.indices() since this practically sorts
91 // the IDs from smallest to largest while we need to keep them in the
92 // same order as that prescribed in the wordList
93 labelList getZoneIDs(const dictionary& dict, const word& zoneGroup);
94
95 //- Add a cellZone containing the cells next to IO patches
96 void addIOcellsZone();
97
98
99private:
100
101 // Private Member Functions
102
103 //- No copy construct
104 topOZones(const topOZones&);
105
106 //- No copy assignment
107 void operator=(const topOZones&);
108
109
110public:
111
112 //- Runtime type information
113 TypeName("topOZones");
114
115
116 // Constructors
117
118 //- Construct from components
119 topOZones
120 (
121 const fvMesh& mesh,
122 const dictionary& dict
123 );
124
125
126 //- Destructor
127 virtual ~topOZones() = default;
128
129
130 // Member Functions
131
132 //- Const reference to mesh
133 inline const fvMesh& mesh() const
134 {
135 return mesh_;
136 }
137
138 //- Cell zone IDs with fixed porosity values
139 inline const labelList& fixedPorousZoneIDs() const
140 {
141 return fixedPorousIDs_;
142 }
143
144 //- Values of alpha for each fixed porous zone
145 inline const scalarList& fixedPorousValues() const
146 {
147 return fixedPorousValues_;
148 }
149
150 //- Cell zone IDs with fixed zero porosity values
151 inline const labelList& fixedZeroPorousZoneIDs() const
152 {
154 }
155
156 //- Cell zone IDs in which porosity is allowed to change
157 inline const labelList& adjointPorousZoneIDs() const
158 {
159 return adjointPorousIDs_;
160 }
162 //- Cells next to IO boundaries
163 inline const cellZone& IOCells() const
164 {
165 return mesh_.cellZones()[IOcellsID_];
166 }
167
168 //- ID of the cellZone holding the IOcells
169 inline label IOzoneID() const
170 {
171 return IOcellsID_;
172 }
173
174 //- Get betaMax
175 inline scalar getBetaMax() const
176 {
177 return betaMaxPtr_().value();
178 }
179};
180
181
182// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183
184} // End namespace Foam
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188#endif
189
190// ************************************************************************* //
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A subset of mesh cells.
Definition cellZone.H:61
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
const labelList & fixedPorousZoneIDs() const
Cell zone IDs with fixed porosity values.
Definition topOZones.H:169
scalar getBetaMax() const
Get betaMax.
Definition topOZones.H:217
labelList getZoneIDs(const dictionary &dict, const word &zoneGroup)
Get zone IDs corresponding to a wordList, read from a dict.
Definition topOZones.C:36
const fvMesh & mesh_
Mesh reference.
Definition topOZones.H:59
scalarList fixedPorousValues_
The constant alpha values of fixedPorousIDs_.
Definition topOZones.H:74
const scalarList & fixedPorousValues() const
Values of alpha for each fixed porous zone.
Definition topOZones.H:177
void addIOcellsZone()
Add a cellZone containing the cells next to IO patches.
Definition topOZones.C:51
const cellZone & IOCells() const
Cells next to IO boundaries.
Definition topOZones.H:201
autoPtr< betaMax > betaMaxPtr_
The multiplier of the Brinkman penalisation term.
Definition topOZones.H:95
const labelList & adjointPorousZoneIDs() const
Cell zone IDs in which porosity is allowed to change.
Definition topOZones.H:193
label IOzoneID() const
ID of the cellZone holding the IOcells.
Definition topOZones.H:209
const labelList & fixedZeroPorousZoneIDs() const
Cell zone IDs with fixed zero porosity values.
Definition topOZones.H:185
const dictionary dict_
TopO design variables dictionary.
Definition topOZones.H:64
virtual ~topOZones()=default
Destructor.
labelList fixedZeroPorousIDs_
IDs of cellZones holding cells with zero alpha values.
Definition topOZones.H:79
TypeName("topOZones")
Runtime type information.
const fvMesh & mesh() const
Const reference to mesh.
Definition topOZones.H:161
labelList fixedPorousIDs_
IDs of cellZones holding cells with constant alpha values.
Definition topOZones.H:69
label IOcellsID_
ID of the cellZone holding the cells next to inlets & outlets.
Definition topOZones.H:90
labelList adjointPorousIDs_
IDs of cellZones with cells that can change their alpha value throughout the optimisation.
Definition topOZones.H:85
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
List< scalar > scalarList
List of scalar.
Definition scalarList.H:32
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68