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 OpenCFD Ltd.
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 Class
28  Foam::refinementParameters
29 
30 Description
31  Simple container to keep together refinement specific information.
32 
33 SourceFiles
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 "wordPairHashTable.H"
45 #include "surfaceZonesInfo.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Class forward declarations
53 class polyMesh;
54 
55 /*---------------------------------------------------------------------------*\
56  Class refinementParameters Declaration
57 \*---------------------------------------------------------------------------*/
58 
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  //- Region for location
91  wordList zonesInMesh_;
92 
93  //- Information on how to handle faces on faceZones
94  const dictionary faceZoneControls_;
95 
96 
97  //- FaceZone faces allowed which have owner and neighbour in same
98  // cellZone?
99  const Switch allowFreeStandingZoneFaces_;
100 
101  //- Use old topology based problem-cell removal (cells with 8 points
102  // on surface)
103  const Switch useTopologicalSnapDetection_;
104 
105  //- Allowed load unbalance
106  const scalar maxLoadUnbalance_;
107 
108  const Switch handleSnapProblems_;
109 
110  const Switch interfaceRefine_;
111 
112  const label nErodeCellZone_;
113 
114  const label nFilterIter_;
115 
116  const scalar minCellFraction_;
117 
118  const bool dryRun_;
119 
120 
121  // Private Member Functions
122 
123  //- No copy construct
125 
126  //- No copy assignment
127  void operator=(const refinementParameters&) = delete;
128 
129 
130 public:
131 
132  // Constructors
133 
134  //- Construct from dictionary - new syntax
135  refinementParameters(const dictionary& dict, const bool dryRun = false);
136 
137 
138  // Member Functions
139 
140  // Access
141 
142  //- Total number of cells
143  label maxGlobalCells() const
144  {
145  return maxGlobalCells_;
146  }
147 
148  //- Per processor max number of cells
149  label maxLocalCells() const
150  {
151  return maxLocalCells_;
152  }
153 
154  //- When to stop refining
155  label minRefineCells() const
156  {
157  return minRefineCells_;
158  }
159 
160  //- Curvature
161  scalar curvature() const
162  {
163  return curvature_;
164  }
165 
166  //- Angle when two intersections are considered to be planar
167  scalar planarAngle() const
168  {
169  return planarAngle_;
170  }
171 
172  //- Number of layers between different refinement levels
173  label nBufferLayers() const
174  {
175  return nBufferLayers_;
176  }
177 
178  //- Areas to keep
179  const pointField& locationsInMesh() const
180  {
181  return locationsInMesh_;
182  }
183 
184  //- Per area the zone name
185  const wordList& zonesInMesh() const
186  {
187  return zonesInMesh_;
188  }
189 
190  //- Optional points which are checked to be outside the mesh
191  const pointField& locationsOutsideMesh() const
192  {
193  return locationsOutsideMesh_;
194  }
195 
196  //- Are zone faces allowed only inbetween different cell zones
197  // or also just free standing?
198  bool allowFreeStandingZoneFaces() const
199  {
200  return allowFreeStandingZoneFaces_;
201  }
202 
203  //- Use old topology based problem-cell removal
204  // (cells with 8 points on surface)
205  bool useTopologicalSnapDetection() const
206  {
207  return useTopologicalSnapDetection_;
208  }
209 
210  //- Allowed load unbalance
211  scalar maxLoadUnbalance() const
212  {
213  return maxLoadUnbalance_;
214  }
215 
216  bool handleSnapProblems() const
217  {
218  return handleSnapProblems_;
219  }
220 
221  //- Refine cell with opposite faces with different refinement level
222  bool interfaceRefine() const
223  {
224  return interfaceRefine_;
225  }
226 
227  //- Number of iterations of erosion to get a consistent cellZone
228  label nErodeCellZone() const
229  {
230  return nErodeCellZone_;
231  }
232 
233  //- Number of iterations of infill/erosion to get a smoother
234  // blockage
235  label nFilterIter() const
236  {
237  return nFilterIter_;
238  }
239 
240  //- When are disconnected regions small. Fraction of overall size
241  // of a zone or background. Default 0.
242  scalar minCellFraction() const
243  {
244  return minCellFraction_;
245  }
246 
247 
248  // Other
249 
250  //- Get patchInfo and faceType for faceZone
252  (
253  const word& fzName,
255  ) const;
256 
257  //- Add cellZones to mesh. Return indices of cellZones (or -1)
259 
260  //- Checks that cells are in mesh. Returns cells (or -1) they
261  // are in.
262  static labelList findCells
263  (
264  const bool checkInsideMesh,
265  const polyMesh&,
266  const pointField& locations
267  );
268 
269  //- Extract indices of named locations (so excludes 'keepPoints')
271 
272  //- Extract indices of unnamed locations ('keepPoints')
274 
275 };
276 
277 
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 
280 } // End namespace Foam
281 
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 
284 #endif
285 
286 // ************************************************************************* //
Foam::refinementParameters::allowFreeStandingZoneFaces
bool allowFreeStandingZoneFaces() const
Are zone faces allowed only inbetween different cell zones.
Definition: refinementParameters.H:197
Foam::refinementParameters::zonedLocations
static labelList zonedLocations(const wordList &zonesInMesh)
Extract indices of named locations (so excludes 'keepPoints')
Definition: refinementParameters.C:270
Foam::refinementParameters::zonesInMesh
const wordList & zonesInMesh() const
Per area the zone name.
Definition: refinementParameters.H:184
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::refinementParameters::useTopologicalSnapDetection
bool useTopologicalSnapDetection() const
Use old topology based problem-cell removal.
Definition: refinementParameters.H:204
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::refinementParameters::maxGlobalCells
label maxGlobalCells() const
Total number of cells.
Definition: refinementParameters.H:142
Foam::refinementParameters::maxLoadUnbalance
scalar maxLoadUnbalance() const
Allowed load unbalance.
Definition: refinementParameters.H:210
Foam::surfaceZonesInfo::faceZoneType
faceZoneType
What to do with faceZone faces.
Definition: surfaceZonesInfo.H:86
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::refinementParameters::planarAngle
scalar planarAngle() const
Angle when two intersections are considered to be planar.
Definition: refinementParameters.H:166
Foam::refinementParameters::nFilterIter
label nFilterIter() const
Number of iterations of infill/erosion to get a smoother.
Definition: refinementParameters.H:234
Foam::refinementParameters::findCells
static labelList findCells(const bool checkInsideMesh, const polyMesh &, const pointField &locations)
Checks that cells are in mesh. Returns cells (or -1) they.
Definition: refinementParameters.C:210
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::refinementParameters::maxLocalCells
label maxLocalCells() const
Per processor max number of cells.
Definition: refinementParameters.H:148
Foam::refinementParameters::nBufferLayers
label nBufferLayers() const
Number of layers between different refinement levels.
Definition: refinementParameters.H:172
Foam::refinementParameters::unzonedLocations
static labelList unzonedLocations(const wordList &zonesInMesh)
Extract indices of unnamed locations ('keepPoints')
Definition: refinementParameters.C:292
Switch.H
Foam::refinementParameters
Simple container to keep together refinement specific information.
Definition: refinementParameters.H:58
Foam::refinementParameters::curvature
scalar curvature() const
Curvature.
Definition: refinementParameters.H:160
surfaceZonesInfo.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::refinementParameters::locationsOutsideMesh
const pointField & locationsOutsideMesh() const
Optional points which are checked to be outside the mesh.
Definition: refinementParameters.H:190
Foam::refinementParameters::interfaceRefine
bool interfaceRefine() const
Refine cell with opposite faces with different refinement level.
Definition: refinementParameters.H:221
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::refinementParameters::handleSnapProblems
bool handleSnapProblems() const
Definition: refinementParameters.H:215
pointField.H
wordPairHashTable.H
Foam::refinementParameters::getZoneInfo
dictionary getZoneInfo(const word &fzName, surfaceZonesInfo::faceZoneType &faceType) const
Get patchInfo and faceType for faceZone.
Definition: refinementParameters.C:159
Foam::List< word >
dictionary.H
Foam::refinementParameters::addCellZonesToMesh
labelList addCellZonesToMesh(polyMesh &) const
Add cellZones to mesh. Return indices of cellZones (or -1)
Definition: refinementParameters.C:188
Foam::refinementParameters::minCellFraction
scalar minCellFraction() const
When are disconnected regions small. Fraction of overall size.
Definition: refinementParameters.H:241
Foam::refinementParameters::nErodeCellZone
label nErodeCellZone() const
Number of iterations of erosion to get a consistent cellZone.
Definition: refinementParameters.H:227
Foam::refinementParameters::locationsInMesh
const pointField & locationsInMesh() const
Areas to keep.
Definition: refinementParameters.H:178
Foam::refinementParameters::minRefineCells
label minRefineCells() const
When to stop refining.
Definition: refinementParameters.H:154