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,2022 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;
54
55/*---------------------------------------------------------------------------*\
56 Class refinementParameters Declaration
57\*---------------------------------------------------------------------------*/
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 const Switch handleSnapProblems_;
112
113 const Switch interfaceRefine_;
114
115 const label nErodeCellZone_;
116
117 const label nFilterIter_;
118
119 const scalar minCellFraction_;
120
121 const label nMinCells_;
122
123 const bool dryRun_;
124
125
126 // Private Member Functions
127
128 //- No copy construct
130
131 //- No copy assignment
132 void operator=(const refinementParameters&) = delete;
133
134
135public:
136
137 // Constructors
138
139 //- Construct from dictionary - new syntax
140 refinementParameters(const dictionary& dict, const bool dryRun = false);
141
142
143 // Member Functions
144
145 // Access
146
147 //- Total number of cells
148 label maxGlobalCells() const
149 {
150 return maxGlobalCells_;
151 }
152
153 //- Per processor max number of cells
154 label maxLocalCells() const
155 {
156 return maxLocalCells_;
157 }
158
159 //- When to stop refining
160 label minRefineCells() const
161 {
162 return minRefineCells_;
163 }
164
165 //- Curvature
166 scalar curvature() const
167 {
168 return curvature_;
169 }
170
171 //- Angle when two intersections are considered to be planar
172 scalar planarAngle() const
173 {
174 return planarAngle_;
175 }
176
177 //- Number of layers between different refinement levels
178 label nBufferLayers() const
179 {
180 return nBufferLayers_;
181 }
182
183 //- Areas to keep
184 const pointField& locationsInMesh() const
185 {
186 return locationsInMesh_;
187 }
188
189 //- Per area the zone name
190 const wordList& zonesInMesh() const
191 {
192 return zonesInMesh_;
193 }
194
195 //- Optional points which are checked to be outside the mesh
196 const pointField& locationsOutsideMesh() const
197 {
198 return locationsOutsideMesh_;
199 }
200
201 //- Whether to attempt to close any 'leak' between
202 // locationsInsideMesh and locationsOutsideMesh. Default is
203 // false (dump path and exit with error)
204 // (see also refinementSurfaces::leakLevel to force surfaces to
205 // be checked for leaks early-on in the refinement)
206 bool useLeakClosure() const
207 {
208 return useLeakClosure_;
209 }
210
211 //- Are zone faces allowed only inbetween different cell zones
212 // or also just free standing?
213 bool allowFreeStandingZoneFaces() const
214 {
215 return allowFreeStandingZoneFaces_;
216 }
217
218 //- Use old topology based problem-cell removal
219 // (cells with 8 points on surface)
220 bool useTopologicalSnapDetection() const
221 {
222 return useTopologicalSnapDetection_;
223 }
224
225 //- Allowed load unbalance
226 scalar maxLoadUnbalance() const
227 {
228 return maxLoadUnbalance_;
229 }
231 bool handleSnapProblems() const
232 {
233 return handleSnapProblems_;
234 }
235
236 //- Refine cell with opposite faces with different refinement level
237 bool interfaceRefine() const
238 {
239 return interfaceRefine_;
240 }
241
242 //- Number of iterations of erosion to get a consistent cellZone
243 label nErodeCellZone() const
244 {
245 return nErodeCellZone_;
246 }
247
248 //- Number of iterations of infill/erosion to get a smoother
249 // blockage
250 label nFilterIter() const
251 {
252 return nFilterIter_;
253 }
254
255 //- When are disconnected regions small. Fraction of overall size
256 // of a zone or background. Default 0.
257 scalar minCellFraction() const
258 {
259 return minCellFraction_;
260 }
261
262 //- When are disconnected regions small. Absolute number of cells
263 // in a zone or background. Default 0.
264 label nMinCells() const
265 {
266 return nMinCells_;
267 }
268
269
270 // Other
271
272 //- Get patchInfo and faceType for faceZone
274 (
275 const word& fzName,
277 ) const;
278
279 //- Add cellZones to mesh. Return indices of cellZones (or -1)
281
282 //- Checks that cells are in mesh. Returns cells (or -1) they
283 // are in.
284 static labelList findCells
285 (
286 const bool checkInsideMesh,
287 const polyMesh&,
288 const pointField& locations
289 );
290
291 //- Extract indices of named locations (so excludes 'keepPoints')
293
294 //- Extract indices of unnamed locations ('keepPoints')
296
297 //- Helper: per zone (entry in zonesInMesh) the locations with
298 // additionally locationsOutsideMesh as last. Used in
299 // hole filling
301 (
303 const wordList& zonesInMesh,
305 );
306};
307
308
309// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310
311} // End namespace Foam
312
313// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
314
315#endif
316
317// ************************************************************************* //
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Simple container to keep together refinement specific information.
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.
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 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:68
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:63
List< label > labelList
A List of labels.
Definition: List.H:66
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
dictionary dict