layerParameters.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 | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::layerParameters
26 
27 Description
28  Simple container to keep together layer specific information.
29 
30 SourceFiles
31  layerParameters.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef layerParameters_H
36 #define layerParameters_H
37 
38 #include "dictionary.H"
39 #include "scalarField.H"
40 #include "labelList.H"
41 #include "Switch.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Class forward declarations
49 class polyBoundaryMesh;
50 class refinementSurfaces;
51 
52 /*---------------------------------------------------------------------------*\
53  Class layerParameters Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class layerParameters
57 {
58 public:
59 
60  // Public data types
61 
62  //- Enumeration defining the layer specification:
63  // - first and total thickness specified
64  // - first and expansion ratio specified
65  // - final and total thickness specified
66  // - final and expansion ratio specified
67  // - total thickness and expansion ratio specified
69  {
76  };
77 
78 
79 private:
80 
81  // Static data members
82 
83  //- Default angle for faces to be convcave
84  static const scalar defaultConcaveAngle;
85 
86 
87  // Private data
88 
89  const dictionary dict_;
90 
91 
92  // Per patch (not region!) information
93 
94  //- How many layers to add.
96 
97  //- Are sizes relative to local cell size
99 
100  //- How thickness is specified.
102 
104 
106 
108 
110 
111  //- Minimum total thickness
113 
114 
115  scalar featureAngle_;
116 
117  scalar mergePatchFacesAngle_;
118 
119  scalar concaveAngle_;
120 
121  label nGrow_;
122 
123  scalar maxFaceThicknessRatio_;
124 
126 
128 
130 
132 
134 
135 
136  // Private Member Functions
137 
138  //- Calculate expansion ratio from overall size v.s. thickness of
139  // first layer.
140  scalar layerExpansionRatio
141  (
142  const label n,
143  const scalar totalOverFirst
144  ) const;
145 
146  //- Disallow default bitwise copy construct
148 
149  //- Disallow default bitwise assignment
150  void operator=(const layerParameters&);
151 
152 
153 public:
154 
155  // Constructors
156 
157  //- Construct from dictionary
159 
160 
161  // Member Functions
162 
163  const dictionary& dict() const
164  {
165  return dict_;
166  }
167 
168 
169  // Per patch information
170 
171  //- How many layers to add.
172  // -1 : no specification. Assume 0 layers but allow sliding
173  // to make layers
174  // 0 : specified to have 0 layers. No sliding allowed.
175  // >0 : number of layers
176  const labelList& numLayers() const
177  {
178  return numLayers_;
179  }
180 
181  //- Are size parameters relative to inner cell size or
182  // absolute distances.
183  bool relativeSizes() const
184  {
185  return relativeSizes_;
186  }
187 
188  // Expansion factor for layer mesh
189  const scalarField& expansionRatio() const
190  {
191  return expansionRatio_;
192  }
193 
194  //- Wanted thickness of the layer furthest away
195  // from the wall (i.e. nearest the original mesh).
196  // If relativeSize() this number is relative to undistorted
197  // size of the cell outside layer.
198  const scalarField& finalLayerThickness() const
199  {
200  return finalLayerThickness_;
201  }
202 
203  //- Wanted thickness of the layer nearest to the wall.
204  // If relativeSize() this number is relative to undistorted
205  // size of the cell outside layer.
206  const scalarField& firstLayerThickness() const
207  {
208  return firstLayerThickness_;
209  }
210 
211  //- Wanted overall thickness of all layers.
212  // If relativeSize() this number is relative to undistorted
213  // size of the cell outside layer.
214  const scalarField& thickness() const
215  {
216  return thickness_;
217  }
218 
219  //- Minimum overall thickness of cell layer. If for any reason layer
220  // cannot be above minThickness do not add layer.
221  // If relativeSize() this number is relative to undistorted
222  // size of the cell outside layer.
223  const scalarField& minThickness() const
224  {
225  return minThickness_;
226  }
227 
228 
229  // Control
230 
231  //- Number of overall layer addition iterations
232  label nLayerIter() const
233  {
234  return nLayerIter_;
235  }
236 
237  //- Number of iterations after which relaxed motion rules
238  // are to be used.
239  label nRelaxedIter() const
240  {
241  return nRelaxedIter_;
242  }
243 
244 
245  // Control
246 
247  scalar featureAngle() const
248  {
249  return featureAngle_;
250  }
251 
252  scalar mergePatchFacesAngle() const
253  {
254  return mergePatchFacesAngle_;
255  }
256 
257  scalar concaveAngle() const
258  {
259  return concaveAngle_;
260  }
261 
262  //- If points get not extruded do nGrow layers of connected faces
263  // that are not grown. Is used to not do layers at all close to
264  // features.
265  label nGrow() const
266  {
267  return nGrow_;
268  }
269 
270  //- Stop layer growth on highly warped cells
271  scalar maxFaceThicknessRatio() const
272  {
273  return maxFaceThicknessRatio_;
274  }
275 
276  //- Create buffer region for new layer terminations
278  {
279  return nBufferCellsNoExtrude_;
280  }
281 
282  const Switch& additionalReporting() const
283  {
284  return additionalReporting_;
285  }
286 
287  //- Type of mesh shrinker
288  const word& meshShrinker() const
289  {
290  return meshShrinker_;
291  }
292 
293 
294  // Helper
295 
296  //- Determine overall thickness. Uses two of the four parameters
297  // according to the layerSpecification
298  scalar layerThickness
299  (
300  const label nLayers,
301  const scalar firstLayerThickess,
302  const scalar finalLayerThickess,
303  const scalar totalThickness,
304  const scalar expansionRatio
305  ) const;
306 
307  //- Determine expansion ratio. Uses two of the four parameters
308  // according to the layerSpecification
309  scalar layerExpansionRatio
310  (
311  const label nLayers,
312  const scalar firstLayerThickess,
313  const scalar finalLayerThickess,
314  const scalar totalThickness,
315  const scalar expansionRatio
316  ) const;
317 
318  //- Determine first layer (near-wall) thickness. Uses two of the
319  // four parameters according to the layerSpecification
320  scalar firstLayerThickness
321  (
322  const label nLayers,
323  const scalar firstLayerThickess,
324  const scalar finalLayerThickess,
325  const scalar totalThickness,
326  const scalar expansionRatio
327  ) const;
328 
329  //- Determine ratio of final layer thickness to
330  // overall layer thickness
332  (
333  const label nLayers,
334  const scalar expansionRatio
335  ) const;
336 };
337 
338 
339 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
340 
341 } // End namespace Foam
342 
343 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
344 
345 #endif
346 
347 // ************************************************************************* //
Foam::layerParameters::nGrow
label nGrow() const
If points get not extruded do nGrow layers of connected faces.
Definition: layerParameters.H:264
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
Foam::layerParameters::firstLayerThickness_
scalarField firstLayerThickness_
Definition: layerParameters.H:102
Foam::layerParameters::layerExpansionRatio
scalar layerExpansionRatio(const label n, const scalar totalOverFirst) const
Calculate expansion ratio from overall size v.s. thickness of.
Definition: layerParameters.C:41
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::layerParameters::concaveAngle_
scalar concaveAngle_
Definition: layerParameters.H:118
Foam::layerParameters::layerParameters
layerParameters(const layerParameters &)
Disallow default bitwise copy construct.
Foam::polyBoundaryMesh
Foam::polyBoundaryMesh.
Definition: polyBoundaryMesh.H:60
Foam::layerParameters::dict
const dictionary & dict() const
Definition: layerParameters.H:162
scalarField.H
Foam::layerParameters::additionalReporting_
Switch additionalReporting_
Definition: layerParameters.H:130
Foam::layerParameters::maxFaceThicknessRatio
scalar maxFaceThicknessRatio() const
Stop layer growth on highly warped cells.
Definition: layerParameters.H:270
Foam::layerParameters::nRelaxedIter
label nRelaxedIter() const
Number of iterations after which relaxed motion rules.
Definition: layerParameters.H:238
Foam::layerParameters::FINAL_AND_EXPANSION
@ FINAL_AND_EXPANSION
Definition: layerParameters.H:73
Foam::layerParameters::ILLEGAL
@ ILLEGAL
Definition: layerParameters.H:69
Foam::layerParameters::operator=
void operator=(const layerParameters &)
Disallow default bitwise assignment.
Foam::layerParameters::nLayerIter
label nLayerIter() const
Number of overall layer addition iterations.
Definition: layerParameters.H:231
Foam::layerParameters::nRelaxedIter_
label nRelaxedIter_
Definition: layerParameters.H:128
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::layerParameters::minThickness
const scalarField & minThickness() const
Minimum overall thickness of cell layer. If for any reason layer.
Definition: layerParameters.H:222
Foam::layerParameters::nBufferCellsNoExtrude
label nBufferCellsNoExtrude() const
Create buffer region for new layer terminations.
Definition: layerParameters.H:276
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
labelList.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::layerParameters::FIRST_AND_TOTAL
@ FIRST_AND_TOTAL
Definition: layerParameters.H:70
Foam::layerParameters::TOTAL_AND_EXPANSION
@ TOTAL_AND_EXPANSION
Definition: layerParameters.H:74
Foam::layerParameters::mergePatchFacesAngle
scalar mergePatchFacesAngle() const
Definition: layerParameters.H:251
Switch.H
Foam::layerParameters::FIRST_AND_EXPANSION
@ FIRST_AND_EXPANSION
Definition: layerParameters.H:71
Foam::layerParameters::mergePatchFacesAngle_
scalar mergePatchFacesAngle_
Definition: layerParameters.H:116
Foam::layerParameters::nBufferCellsNoExtrude_
label nBufferCellsNoExtrude_
Definition: layerParameters.H:124
Foam::layerParameters::numLayers_
labelList numLayers_
How many layers to add.
Definition: layerParameters.H:94
Foam::layerParameters
Simple container to keep together layer specific information.
Definition: layerParameters.H:55
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::layerParameters::layerSpec_
layerSpecification layerSpec_
How thickness is specified.
Definition: layerParameters.H:100
Foam::layerParameters::numLayers
const labelList & numLayers() const
How many layers to add.
Definition: layerParameters.H:175
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::layerParameters::layerThickness
scalar layerThickness(const label nLayers, const scalar firstLayerThickess, const scalar finalLayerThickess, const scalar totalThickness, const scalar expansionRatio) const
Determine overall thickness. Uses two of the four parameters.
Definition: layerParameters.C:380
Foam::layerParameters::finalLayerThickness_
scalarField finalLayerThickness_
Definition: layerParameters.H:104
Foam::layerParameters::relativeSizes_
Switch relativeSizes_
Are sizes relative to local cell size.
Definition: layerParameters.H:97
Foam::layerParameters::additionalReporting
const Switch & additionalReporting() const
Definition: layerParameters.H:281
Foam::layerParameters::maxFaceThicknessRatio_
scalar maxFaceThicknessRatio_
Definition: layerParameters.H:122
Foam::layerParameters::defaultConcaveAngle
static const scalar defaultConcaveAngle
Default angle for faces to be convcave.
Definition: layerParameters.H:83
Foam::layerParameters::nGrow_
label nGrow_
Definition: layerParameters.H:120
Foam::layerParameters::finalLayerThicknessRatio
scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio) const
Determine ratio of final layer thickness to.
Definition: layerParameters.C:550
Foam::layerParameters::FINAL_AND_TOTAL
@ FINAL_AND_TOTAL
Definition: layerParameters.H:72
Foam::layerParameters::featureAngle
scalar featureAngle() const
Definition: layerParameters.H:246
Foam::layerParameters::minThickness_
scalarField minThickness_
Minimum total thickness.
Definition: layerParameters.H:111
Foam::layerParameters::layerSpecification
layerSpecification
Enumeration defining the layer specification:
Definition: layerParameters.H:67
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::layerParameters::dict_
const dictionary dict_
Definition: layerParameters.H:88
Foam::layerParameters::meshShrinker_
word meshShrinker_
Definition: layerParameters.H:132
Foam::layerParameters::firstLayerThickness
const scalarField & firstLayerThickness() const
Wanted thickness of the layer nearest to the wall.
Definition: layerParameters.H:205
Foam::layerParameters::featureAngle_
scalar featureAngle_
Definition: layerParameters.H:114
dictionary.H
Foam::layerParameters::expansionRatio
const scalarField & expansionRatio() const
Definition: layerParameters.H:188
Foam::layerParameters::thickness
const scalarField & thickness() const
Wanted overall thickness of all layers.
Definition: layerParameters.H:213
Foam::layerParameters::expansionRatio_
scalarField expansionRatio_
Definition: layerParameters.H:108
Foam::layerParameters::relativeSizes
bool relativeSizes() const
Are size parameters relative to inner cell size or.
Definition: layerParameters.H:182
Foam::layerParameters::nLayerIter_
label nLayerIter_
Definition: layerParameters.H:126
Foam::layerParameters::finalLayerThickness
const scalarField & finalLayerThickness() const
Wanted thickness of the layer furthest away.
Definition: layerParameters.H:197
Foam::layerParameters::meshShrinker
const word & meshShrinker() const
Type of mesh shrinker.
Definition: layerParameters.H:287
Foam::layerParameters::thickness_
scalarField thickness_
Definition: layerParameters.H:106
Foam::layerParameters::concaveAngle
scalar concaveAngle() const
Definition: layerParameters.H:256