Loading...
Searching...
No Matches
refinementParameters.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) 2011-2014 OpenFOAM Foundation
9 Copyright (C) 2015-2020,2023 OpenCFD Ltd.
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 Foam::refinementParameters
29
30Description
31 Simple container to keep together refinement specific information.
32
33SourceFiles
34 refinementParameters.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef refinementParameters_H
39#define refinementParameters_H
40
41#include "dictionary.H"
42#include "pointField.H"
43#include "Switch.H"
44#include "wordPairHashes.H"
45#include "surfaceZonesInfo.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// Forward Declarations
53class polyMesh;
55/*---------------------------------------------------------------------------*\
56 Class refinementParameters Declaration
57\*---------------------------------------------------------------------------*/
58
59class refinementParameters
60{
61 // Private Data
62
63 //- Total number of cells
64 const label maxGlobalCells_;
65
66 //- Per processor max number of cells
67 const label maxLocalCells_;
68
69 //- When to stop refining
70 const label minRefineCells_;
71
72 //- Curvature
73 scalar curvature_;
74
75 //- Planarity criterion
76 const scalar planarAngle_;
77
78 //- Number of layers between different refinement levels
79 const label nBufferLayers_;
80
81
82 // Selection of areas
83
84 //- Areas not to keep
85 const pointField locationsOutsideMesh_;
86
87 //- Areas to keep
88 pointField locationsInMesh_;
89
90 //- How to handle connections between inside and outside points
91 const bool useLeakClosure_;
92
93 //- Region for location
94 wordList zonesInMesh_;
95
96 //- Information on how to handle faces on faceZones
97 const dictionary faceZoneControls_;
98
99
100 //- FaceZone faces allowed which have owner and neighbour in same
101 // cellZone?
102 const Switch allowFreeStandingZoneFaces_;
103
104 //- Use old topology based problem-cell removal (cells with 8 points
105 // on surface)
106 const Switch useTopologicalSnapDetection_;
107
108 //- Allowed load unbalance
109 const scalar maxLoadUnbalance_;
110
111 //- Trigger cell count to start balancing
112 const label maxCellUnbalance_;
113
114 const Switch handleSnapProblems_;
115
116 const Switch interfaceRefine_;
117
118 const label nErodeCellZone_;
119
120 const label nFilterIter_;
121
122 const scalar minCellFraction_;
123
124 const label nMinCells_;
125
126 //- Force final balancing after castellation
127 const bool balanceAtEnd_;
128
129 //const bool dryRun_;
130
131
132 // Private Member Functions
133
134 //- No copy construct
135 refinementParameters(const refinementParameters&) = delete;
136
137 //- No copy assignment
138 void operator=(const refinementParameters&) = delete;
139
140
141public:
142
143 // Constructors
144
145 //- Construct from dictionary - new syntax
146 refinementParameters(const dictionary& dict, const bool dryRun = false);
147
148
149 // Member Functions
150
151 // Access
152
153 //- Total number of cells
154 label maxGlobalCells() const
155 {
156 return maxGlobalCells_;
157 }
158
159 //- Per processor max number of cells
160 label maxLocalCells() const
161 {
162 return maxLocalCells_;
163 }
164
165 //- When to stop refining
166 label minRefineCells() const
167 {
168 return minRefineCells_;
169 }
170
171 //- Curvature
172 scalar curvature() const
173 {
174 return curvature_;
175 }
176
177 //- Angle when two intersections are considered to be planar
178 scalar planarAngle() const
179 {
180 return planarAngle_;
181 }
182
183 //- Number of layers between different refinement levels
184 label nBufferLayers() const
185 {
186 return nBufferLayers_;
187 }
188
189 //- Areas to keep
190 const pointField& locationsInMesh() const
192 return locationsInMesh_;
193 }
194
195 //- Per area the zone name
196 const wordList& zonesInMesh() const
197 {
198 return zonesInMesh_;
200
201 //- Optional points which are checked to be outside the mesh
202 const pointField& locationsOutsideMesh() const
203 {
204 return locationsOutsideMesh_;
205 }
206
207 //- Whether to attempt to close any 'leak' between
208 // locationsInsideMesh and locationsOutsideMesh. Default is
209 // false (dump path and exit with error)
210 // (see also refinementSurfaces::leakLevel to force surfaces to
211 // be checked for leaks early-on in the refinement)
212 bool useLeakClosure() const
213 {
214 return useLeakClosure_;
216
217 //- Are zone faces allowed only inbetween different cell zones
218 // or also just free standing?
219 bool allowFreeStandingZoneFaces() const
220 {
221 return allowFreeStandingZoneFaces_;
222 }
224 //- Use old topology based problem-cell removal
225 // (cells with 8 points on surface)
226 bool useTopologicalSnapDetection() const
227 {
228 return useTopologicalSnapDetection_;
229 }
230
231 //- Allowed load unbalance
232 scalar maxLoadUnbalance() const
233 {
234 return maxLoadUnbalance_;
235 }
236
237 //- Trigger cell count to start balancing
238 label maxCellUnbalance() const
240 return maxCellUnbalance_;
241 }
242
243 bool handleSnapProblems() const
244 {
245 return handleSnapProblems_;
246 }
248 //- Refine cell with opposite faces with different refinement level
249 bool interfaceRefine() const
250 {
251 return interfaceRefine_;
252 }
253
254 //- Number of iterations of erosion to get a consistent cellZone
255 label nErodeCellZone() const
256 {
257 return nErodeCellZone_;
258 }
259
260 //- Number of iterations of infill/erosion to get a smoother
261 // blockage
262 label nFilterIter() const
263 {
264 return nFilterIter_;
265 }
266
267 //- When are disconnected regions small. Fraction of overall size
268 // of a zone or background. Default 0.
269 scalar minCellFraction() const
270 {
271 return minCellFraction_;
272 }
273
274 //- When are disconnected regions small. Absolute number of cells
275 // in a zone or background. Default 0.
276 label nMinCells() const
277 {
278 return nMinCells_;
279 }
280
281 //- Force final balancing after castallation
282 bool balanceAtEnd() const
283 {
284 return balanceAtEnd_;
285 }
286
287
288 // Other
289
290 //- Get patchInfo and faceType for faceZone
292 (
293 const word& fzName,
295 ) const;
297 //- Add cellZones to mesh. Return indices of cellZones (or -1)
299
300 //- Checks that cells are in mesh. Returns cells (or -1) they
301 // are in.
302 static labelList findCells
303 (
304 const bool checkInsideMesh,
305 const polyMesh&,
306 const pointField& locations
307 );
308
309 //- Extract indices of named locations (so excludes 'keepPoints')
311
312 //- Extract indices of unnamed locations ('keepPoints')
314
315 //- Helper: per zone (entry in zonesInMesh) the locations with
316 // additionally locationsOutsideMesh as last. Used in
317 // hole filling
319 (
321 const wordList& zonesInMesh,
323 );
324};
326
327// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
328
329} // End namespace Foam
330
331// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
332
333#endif
334
335// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition Switch.H:81
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
scalar planarAngle() const
Angle when two intersections are considered to be planar.
label maxLocalCells() const
Per processor max number of cells.
bool useLeakClosure() const
Whether to attempt to close any 'leak' between.
scalar curvature() const
Curvature.
scalar minCellFraction() const
When are disconnected regions small. Fraction of overall size.
static labelList unzonedLocations(const wordList &zonesInMesh)
Extract indices of unnamed locations ('keepPoints').
labelList addCellZonesToMesh(polyMesh &) const
Add cellZones to mesh. Return indices of cellZones (or -1).
label minRefineCells() const
When to stop refining.
static labelList zonedLocations(const wordList &zonesInMesh)
Extract indices of named locations (so excludes 'keepPoints').
bool useTopologicalSnapDetection() const
Use old topology based problem-cell removal.
label nMinCells() const
When are disconnected regions small. Absolute number of cells.
const pointField & locationsOutsideMesh() const
Optional points which are checked to be outside the mesh.
static labelList findCells(const bool checkInsideMesh, const polyMesh &, const pointField &locations)
Checks that cells are in mesh. Returns cells (or -1) they.
const pointField & locationsInMesh() const
Areas to keep.
static List< pointField > zonePoints(const pointField &locationsInMesh, const wordList &zonesInMesh, const pointField &locationsOutsideMesh)
Helper: per zone (entry in zonesInMesh) the locations with.
dictionary getZoneInfo(const word &fzName, surfaceZonesInfo::faceZoneType &faceType) const
Get patchInfo and faceType for faceZone.
label maxCellUnbalance() const
Trigger cell count to start balancing.
scalar maxLoadUnbalance() const
Allowed load unbalance.
bool allowFreeStandingZoneFaces() const
Are zone faces allowed only inbetween different cell zones.
label maxGlobalCells() const
Total number of cells.
label nBufferLayers() const
Number of layers between different refinement levels.
const wordList & zonesInMesh() const
Per area the zone name.
label nErodeCellZone() const
Number of iterations of erosion to get a consistent cellZone.
bool balanceAtEnd() const
Force final balancing after castallation.
bool interfaceRefine() const
Refine cell with opposite faces with different refinement level.
label nFilterIter() const
Number of iterations of infill/erosion to get a smoother.
faceZoneType
What to do with faceZone faces.
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
List< label > labelList
A List of labels.
Definition List.H:62
vectorField pointField
pointField is a vectorField.
dictionary dict