1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::polyMeshGeometry
29 Updateable mesh geometry and checking routines.
31 - non-ortho done across coupled faces.
32 - faceWeight (delta factors) done across coupled faces.
37 \*---------------------------------------------------------------------------*/
39 #ifndef polyMeshGeometry_H
40 #define polyMeshGeometry_H
42 #include "pointFields.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class polyMeshGeometry Declaration
52 \*---------------------------------------------------------------------------*/
54 class polyMeshGeometry
56 //- Reference to polyMesh.
57 const polyMesh& mesh_;
59 //- Uptodate copy of face areas
60 vectorField faceAreas_;
62 //- Uptodate copy of face centres
63 vectorField faceCentres_;
65 //- Uptodate copy of cell centres
66 vectorField cellCentres_;
68 //- Uptodate copy of cell volumes
69 scalarField cellVolumes_;
72 // Private Member Functions
74 //- Update face areas and centres on selected faces.
75 void updateFaceCentresAndAreas
78 const labelList& changedFaces
81 //- Update cell volumes and centres on selected cells. Requires
82 // cells and faces to be consistent set.
83 void updateCellCentresAndVols
85 const labelList& changedCells,
86 const labelList& changedFaces
89 //- Detect&report non-ortho error for single face.
90 static scalar checkNonOrtho
94 const scalar severeNonorthogonalityThreshold,
96 const vector& s, // face area vector
97 const vector& d, // cc-cc vector
104 //- Calculate skewness given two cell centres and one face centre.
105 static scalar calcSkewness
114 ClassName("polyMeshGeometry");
118 //- Construct from mesh
119 polyMeshGeometry(const polyMesh&);
126 const polyMesh& mesh() const
131 const vectorField& faceAreas() const
135 const vectorField& faceCentres() const
139 const vectorField& cellCentres() const
143 const scalarField& cellVolumes() const
150 //- Take over properties from mesh
153 //- Recalculate on selected faces. Recalculates cell properties
154 // on owner and neighbour of these cells.
158 const labelList& changedFaces
161 //- Helper function: get affected cells from faces
162 static labelList affectedCells
165 const labelList& changedFaces
169 // Checking of selected faces with supplied geometry (mesh only used for
170 // topology). Coupled aware (coupled faces treated as internal ones)
172 //- See primitiveMesh
173 static bool checkFaceDotProduct
176 const scalar orthWarn,
178 const vectorField& cellCentres,
179 const vectorField& faceAreas,
180 const labelList& checkFaces,
181 const List<labelPair>& baffles,
185 //- See primitiveMesh
186 static bool checkFacePyramids
189 const scalar minPyrVol,
191 const vectorField& cellCentres,
193 const labelList& checkFaces,
194 const List<labelPair>& baffles,
198 //- See primitiveMesh
199 static bool checkFaceSkewness
202 const scalar internalSkew,
203 const scalar boundarySkew,
204 const polyMesh& mesh,
205 const vectorField& cellCentres,
206 const vectorField& faceCentres,
207 const vectorField& faceAreas,
208 const labelList& checkFaces,
209 const List<labelPair>& baffles,
213 //- Interpolation weights (0.5 for regular mesh)
214 static bool checkFaceWeights
217 const scalar warnWeight,
218 const polyMesh& mesh,
219 const vectorField& cellCentres,
220 const vectorField& faceCentres,
221 const vectorField& faceAreas,
222 const labelList& checkFaces,
223 const List<labelPair>& baffles,
227 //- Cell volume ratio of neighbouring cells (1 for regular mesh)
228 static bool checkVolRatio
231 const scalar warnRatio,
232 const polyMesh& mesh,
233 const scalarField& cellVolumes,
234 const labelList& checkFaces,
235 const List<labelPair>& baffles,
239 //- See primitiveMesh
240 static bool checkFaceAngles
244 const polyMesh& mesh,
245 const vectorField& faceAreas,
247 const labelList& checkFaces,
251 //- Triangle (from face-centre decomposition) normal v.s.
252 // average face normal
253 static bool checkFaceTwist
256 const scalar minTwist,
258 const vectorField& cellCentres,
259 const vectorField& faceAreas,
260 const vectorField& faceCentres,
262 const labelList& checkFaces,
266 //- Consecutive triangle (from face-centre decomposition) normals
267 static bool checkTriangleTwist
270 const scalar minTwist,
272 const vectorField& faceAreas,
273 const vectorField& faceCentres,
275 const labelList& checkFaces,
280 static bool checkFaceArea
283 const scalar minArea,
285 const vectorField& faceAreas,
286 const labelList& checkFaces,
290 static bool checkCellDeterminant
295 const vectorField& faceAreas,
296 const labelList& checkFaces,
297 const labelList& affectedCells,
302 // Checking of selected faces with local geometry. Uses above static
303 // functions. Parallel aware.
305 bool checkFaceDotProduct
308 const scalar orthWarn,
309 const labelList& checkFaces,
310 const List<labelPair>& baffles,
314 bool checkFacePyramids
317 const scalar minPyrVol,
319 const labelList& checkFaces,
320 const List<labelPair>& baffles,
324 bool checkFaceSkewness
327 const scalar internalSkew,
328 const scalar boundarySkew,
329 const labelList& checkFaces,
330 const List<labelPair>& baffles,
334 bool checkFaceWeights
337 const scalar warnWeight,
338 const labelList& checkFaces,
339 const List<labelPair>& baffles,
346 const scalar warnRatio,
347 const labelList& checkFaces,
348 const List<labelPair>& baffles,
357 const labelList& checkFaces,
364 const scalar minTwist,
366 const labelList& checkFaces,
370 bool checkTriangleTwist
373 const scalar minTwist,
375 const labelList& checkFaces,
382 const scalar minArea,
383 const labelList& checkFaces,
387 bool checkCellDeterminant
390 const scalar warnDet,
391 const labelList& checkFaces,
392 const labelList& affectedCells,
397 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
399 } // End namespace Foam
401 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
405 // ************************************************************************* //