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-2019 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 bool dryRun_;
117 
118 
119  // Private Member Functions
120 
121  //- No copy construct
123 
124  //- No copy assignment
125  void operator=(const refinementParameters&) = delete;
126 
127 
128 public:
129 
130  // Constructors
131 
132  //- Construct from dictionary - new syntax
133  refinementParameters(const dictionary& dict, const bool dryRun = false);
134 
135 
136  // Member Functions
137 
138  // Access
139 
140  //- Total number of cells
141  label maxGlobalCells() const
142  {
143  return maxGlobalCells_;
144  }
145 
146  //- Per processor max number of cells
147  label maxLocalCells() const
148  {
149  return maxLocalCells_;
150  }
151 
152  //- When to stop refining
153  label minRefineCells() const
154  {
155  return minRefineCells_;
156  }
157 
158  //- Curvature
159  scalar curvature() const
160  {
161  return curvature_;
162  }
163 
164  //- Angle when two intersections are considered to be planar
165  scalar planarAngle() const
166  {
167  return planarAngle_;
168  }
169 
170  //- Number of layers between different refinement levels
171  label nBufferLayers() const
172  {
173  return nBufferLayers_;
174  }
175 
176  //- Areas to keep
177  const pointField& locationsInMesh() const
178  {
179  return locationsInMesh_;
180  }
181 
182  //- Per area the zone name
183  const wordList& zonesInMesh() const
184  {
185  return zonesInMesh_;
186  }
187 
188  //- Optional points which are checked to be outside the mesh
189  const pointField& locationsOutsideMesh() const
190  {
191  return locationsOutsideMesh_;
192  }
193 
194  //- Are zone faces allowed only inbetween different cell zones
195  // or also just free standing?
196  bool allowFreeStandingZoneFaces() const
197  {
198  return allowFreeStandingZoneFaces_;
199  }
200 
201  //- Use old topology based problem-cell removal
202  // (cells with 8 points on surface)
203  bool useTopologicalSnapDetection() const
204  {
205  return useTopologicalSnapDetection_;
206  }
207 
208  //- Allowed load unbalance
209  scalar maxLoadUnbalance() const
210  {
211  return maxLoadUnbalance_;
212  }
213 
214  bool handleSnapProblems() const
215  {
216  return handleSnapProblems_;
217  }
218 
219  //- Refine cell with opposite faces with different refinement level
220  bool interfaceRefine() const
221  {
222  return interfaceRefine_;
223  }
224 
225  //- Number of iterations of erosion to get a consistent cellZone
226  label nErodeCellZone() const
227  {
228  return nErodeCellZone_;
229  }
230 
231  //- Number of iterations of infill/erosion to get a smoother
232  // blockage
233  label nFilterIter() const
234  {
235  return nFilterIter_;
236  }
237 
238 
239  // Other
240 
241  //- Get patchInfo and faceType for faceZone
243  (
244  const word& fzName,
246  ) const;
247 
248  //- Add cellZones to mesh. Return indices of cellZones (or -1)
250 
251  //- Checks that cells are in mesh. Returns cells (or -1) they
252  // are in.
253  static labelList findCells
254  (
255  const bool checkInsideMesh,
256  const polyMesh&,
257  const pointField& locations
258  );
259 
260  //- Extract indices of named locations (so excludes 'keepPoints')
262 
263  //- Extract indices of unnamed locations ('keepPoints')
265 
266 };
267 
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 } // End namespace Foam
272 
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 
275 #endif
276 
277 // ************************************************************************* //
Foam::refinementParameters::allowFreeStandingZoneFaces
bool allowFreeStandingZoneFaces() const
Are zone faces allowed only inbetween different cell zones.
Definition: refinementParameters.H:195
Foam::refinementParameters::zonedLocations
static labelList zonedLocations(const wordList &zonesInMesh)
Extract indices of named locations (so excludes 'keepPoints')
Definition: refinementParameters.C:269
Foam::refinementParameters::zonesInMesh
const wordList & zonesInMesh() const
Per area the zone name.
Definition: refinementParameters.H:182
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
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:202
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:76
Foam::refinementParameters::maxGlobalCells
label maxGlobalCells() const
Total number of cells.
Definition: refinementParameters.H:140
Foam::refinementParameters::maxLoadUnbalance
scalar maxLoadUnbalance() const
Allowed load unbalance.
Definition: refinementParameters.H:208
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:62
Foam::refinementParameters::planarAngle
scalar planarAngle() const
Angle when two intersections are considered to be planar.
Definition: refinementParameters.H:164
Foam::refinementParameters::nFilterIter
label nFilterIter() const
Number of iterations of infill/erosion to get a smoother.
Definition: refinementParameters.H:232
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:209
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:59
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:146
Foam::refinementParameters::nBufferLayers
label nBufferLayers() const
Number of layers between different refinement levels.
Definition: refinementParameters.H:170
Foam::refinementParameters::unzonedLocations
static labelList unzonedLocations(const wordList &zonesInMesh)
Extract indices of unnamed locations ('keepPoints')
Definition: refinementParameters.C:291
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:158
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:121
Foam::refinementParameters::locationsOutsideMesh
const pointField & locationsOutsideMesh() const
Optional points which are checked to be outside the mesh.
Definition: refinementParameters.H:188
Foam::refinementParameters::interfaceRefine
bool interfaceRefine() const
Refine cell with opposite faces with different refinement level.
Definition: refinementParameters.H:219
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::refinementParameters::handleSnapProblems
bool handleSnapProblems() const
Definition: refinementParameters.H:213
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:158
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:187
Foam::refinementParameters::nErodeCellZone
label nErodeCellZone() const
Number of iterations of erosion to get a consistent cellZone.
Definition: refinementParameters.H:225
Foam::refinementParameters::locationsInMesh
const pointField & locationsInMesh() const
Areas to keep.
Definition: refinementParameters.H:176
Foam::refinementParameters::minRefineCells
label minRefineCells() const
When to stop refining.
Definition: refinementParameters.H:152