FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/dictionary.H>
39 #include <OpenFOAM/scalarField.H>
40 #include <OpenFOAM/labelList.H>
41 #include <OpenFOAM/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 
57 {
58  // Static data members
59 
60  //- Default angle for faces to be convcave
61  static const scalar defaultConcaveAngle;
62 
63 
64  // Private data
65 
66  // Per patch (not region!) information
67 
68  //- How many layers to add.
69  labelList numLayers_;
70 
71  scalarField expansionRatio_;
72 
73  Switch relativeSizes_;
74 
75  scalarField finalLayerThickness_;
76 
77  scalarField minThickness_;
78 
79 
80  scalar featureAngle_;
81 
82  scalar concaveAngle_;
83 
84  label nGrow_;
85 
86  label nSmoothSurfaceNormals_;
87 
88  label nSmoothNormals_;
89 
90  label nSmoothThickness_;
91 
92  scalar maxFaceThicknessRatio_;
93 
94  scalar layerTerminationCos_;
95 
96  scalar maxThicknessToMedialRatio_;
97 
98  scalar minMedianAxisAngleCos_;
99 
100  label nBufferCellsNoExtrude_;
101 
102  label nSnap_;
103 
104  label nLayerIter_;
105 
106  label nRelaxedIter_;
107 
108 
109  // Private Member Functions
110 
111  //- Extract patch-wise number of layers
112  static labelList readNumLayers
113  (
114  const PtrList<dictionary>& surfaceDicts,
115  const refinementSurfaces& refineSurfaces,
116  const labelList& globalToPatch,
118  );
119 
120  //- Disallow default bitwise copy construct
122 
123  //- Disallow default bitwise assignment
124  void operator=(const layerParameters&);
125 
126 
127 public:
128 
129  // Constructors
130 
131  //- Construct from dictionary - old syntax
133  (
134  const PtrList<dictionary>& surfaceDicts,
135  const refinementSurfaces& refineSurfaces,
136  const labelList& globalToPatch,
137  const dictionary& dict,
138  const polyBoundaryMesh& boundaryMesh
139  );
140 
141  //- Construct from dictionary - new syntax
142  layerParameters(const dictionary& dict, const polyBoundaryMesh&);
143 
144 
145  // Member Functions
146 
147  // Access
148 
149  // Per patch information
150 
151  //- How many layers to add.
152  const labelList& numLayers() const
153  {
154  return numLayers_;
155  }
156 
157  // Expansion factor for layer mesh
159  {
160  return expansionRatio_;
161  }
162 
163  //- Are size parameters relative to inner cell size or
164  // absolute distances.
165  bool relativeSizes() const
166  {
167  return relativeSizes_;
168  }
169 
170  //- Wanted thickness of final added cell layer. If multiple
171  // layers is the thickness of the layer furthest away
172  // from the wall (i.e. nearest the original mesh)
173  // If relativeSize() this number is relative to undistorted
174  // size of the cell outside layer.
176  {
177  return finalLayerThickness_;
178  }
179 
180  //- Minimum thickness of cell layer. If for any reason layer
181  // cannot be above minThickness do not add layer.
182  // If relativeSize() this number is relative to undistorted
183  // size of the cell outside layer.
184  const scalarField& minThickness() const
185  {
186  return minThickness_;
187  }
188 
189 
190  scalar featureAngle() const
191  {
192  return featureAngle_;
193  }
194 
195  scalar concaveAngle() const
196  {
197  return concaveAngle_;
198  }
199 
200  //- If points get not extruded do nGrow layers of connected faces
201  // that are not grown. Is used to not do layers at all close to
202  // features.
203  label nGrow() const
204  {
205  return nGrow_;
206  }
207 
208  //- Number of smoothing iterations of surface normals
209  label nSmoothSurfaceNormals() const
210  {
211  return nSmoothSurfaceNormals_;
212  }
213 
214  //- Number of smoothing iterations of interior mesh movement
215  // direction
216  label nSmoothNormals() const
217  {
218  return nSmoothNormals_;
219  }
220 
221  //- Stop layer growth on highly warped cells
222  scalar maxFaceThicknessRatio() const
223  {
224  return maxFaceThicknessRatio_;
225  }
226 
227  scalar layerTerminationCos() const
228  {
229  return layerTerminationCos_;
230  }
231 
232  //- Smooth layer thickness over surface patches
233  label nSmoothThickness() const
234  {
235  return nSmoothThickness_;
236  }
237 
238  //- Reduce layer growth where ratio thickness to medial
239  // distance is large
241  {
242  return maxThicknessToMedialRatio_;
243  }
244 
245  //- Angle used to pick up medial axis points
246  scalar minMedianAxisAngleCos() const
247  {
248  return minMedianAxisAngleCos_;
249  }
250 
251  //- Create buffer region for new layer terminations
252  label nBufferCellsNoExtrude() const
253  {
254  return nBufferCellsNoExtrude_;
255  }
256 
257  label nSnap() const
258  {
259  return nSnap_;
260  }
261 
262  // Overall
263 
264  //- Number of overall layer addition iterations
265  label nLayerIter() const
266  {
267  return nLayerIter_;
268  }
269 
270  //- Number of iterations after which relaxed motion rules
271  // are to be used.
272  label nRelaxedIter() const
273  {
274  return nRelaxedIter_;
275  }
276 
277 
278 
279 };
280 
281 
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 
284 } // End namespace Foam
285 
286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 
288 #endif
289 
290 // ************************ vim: set sw=4 sts=4 et: ************************ //