primitiveMeshTools.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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2017 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 Namespace
28  Foam::primitiveMeshTools
29 
30 Description
31  Collection of static functions operating on primitiveMesh (mainly checks).
32 
33 SourceFiles
34  primitiveMeshTools.C
35 
36 \*---------------------------------------------------------------------------*/
37 #ifndef primitiveMeshTools_H
38 #define primitiveMeshTools_H
39 
40 #include "primitiveMesh.H"
41 #include "bitSet.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Namespace primitiveMeshTools Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 {
54 public:
55 
56  //- Generate non-orthogonality field (internal faces only)
58  (
59  const primitiveMesh& mesh,
60  const vectorField& fAreas,
61  const vectorField& cellCtrs
62  );
63 
64  //- Generate face pyramid volume fields
65  static void facePyramidVolume
66  (
67  const primitiveMesh& mesh,
68  const pointField& points,
69  const vectorField& cellCtrs,
70  scalarField& ownPyrVol,
71  scalarField& neiPyrVol
72  );
73 
74  //- Generate skewness field
76  (
77  const primitiveMesh& mesh,
78  const pointField& points,
79  const vectorField& fCtrs,
80  const vectorField& fAreas,
81  const vectorField& cellCtrs
82  );
83 
84  //- Generate cell openness and cell ascpect ratio field
85  static void cellClosedness
86  (
87  const primitiveMesh& mesh,
88  const Vector<label>& meshD,
89  const vectorField& areas,
90  const scalarField& vols,
91  scalarField& openness,
92  scalarField& aratio
93  );
94 
95  //- Generate face concavity field. Returns per face the (sin of the)
96  // most concave angle between two consecutive edges
98  (
99  const scalar maxSin,
100  const primitiveMesh& mesh,
101  const pointField& p,
102  const vectorField& faceAreas
103  );
104 
105  //- Generate face flatness field. Compares the individual triangles'
106  // normals against the face average normal. Between 0 (fully warped)
107  // and 1 (fully flat)
109  (
110  const primitiveMesh& mesh,
111  const pointField& p,
112  const vectorField& fCtrs,
113  const vectorField& faceAreas
114  );
115 
116  //- Generate edge alignment field. Is per face the minimum aligned edge
117  // (does not use edge addressing)
119  (
120  const primitiveMesh& mesh,
121  const Vector<label>& directions,
122  const pointField& p
123  );
124 
125  //- Generate cell determinant field. Normalised to 1 for an internal cube.
127  (
128  const primitiveMesh& mesh,
129  const Vector<label>& directions,
130  const vectorField& faceAreas,
131  const bitSet& internalOrCoupledFace
132  );
133 
134 
135  // Helpers: single face check
136 
137  //- Skewness of single face
138  static scalar faceSkewness
139  (
140  const primitiveMesh& mesh,
141  const pointField& p,
142  const vectorField& fCtrs,
143  const vectorField& fAreas,
144 
145  const label facei,
146  const point& ownCc,
147  const point& neiCc
148  );
149 
150  //- Skewness of single boundary face
151  static scalar boundaryFaceSkewness
152  (
153  const primitiveMesh& mesh,
154  const pointField& p,
155  const vectorField& fCtrs,
156  const vectorField& fAreas,
157 
158  const label facei,
159  const point& ownCc
160  );
161 
162  //- Orthogonality of single face
163  static scalar faceOrthogonality
164  (
165  const point& ownCc,
166  const point& neiCc,
167  const vector& s
168  );
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::primitiveMeshTools::cellDeterminant
static tmp< scalarField > cellDeterminant(const primitiveMesh &mesh, const Vector< label > &directions, const vectorField &faceAreas, const bitSet &internalOrCoupledFace)
Generate cell determinant field. Normalised to 1 for an internal cube.
Definition: primitiveMeshTools.C:457
p
volScalarField & p
Definition: createFieldRefs.H:8
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:64
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::primitiveMeshTools::faceConcavity
static tmp< scalarField > faceConcavity(const scalar maxSin, const primitiveMesh &mesh, const pointField &p, const vectorField &faceAreas)
Generate face concavity field. Returns per face the (sin of the)
Definition: primitiveMeshTools.C:337
Foam::primitiveMeshTools::faceOrthogonality
static tmp< scalarField > faceOrthogonality(const primitiveMesh &mesh, const vectorField &fAreas, const vectorField &cellCtrs)
Generate non-orthogonality field (internal faces only)
Definition: primitiveMeshTools.C:125
primitiveMesh.H
Foam::directions
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Definition: directions.H:66
bitSet.H
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:62
Foam::Field< vector >
Foam::primitiveMeshTools::faceFlatness
static tmp< scalarField > faceFlatness(const primitiveMesh &mesh, const pointField &p, const vectorField &fCtrs, const vectorField &faceAreas)
Generate face flatness field. Compares the individual triangles'.
Definition: primitiveMeshTools.C:407
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::primitiveMeshTools::faceSkewness
static tmp< scalarField > faceSkewness(const primitiveMesh &mesh, const pointField &points, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs)
Generate skewness field.
Definition: primitiveMeshTools.C:153
Foam::Vector< label >
Foam::primitiveMeshTools::cellClosedness
static void cellClosedness(const primitiveMesh &mesh, const Vector< label > &meshD, const vectorField &areas, const scalarField &vols, scalarField &openness, scalarField &aratio)
Generate cell openness and cell ascpect ratio field.
Definition: primitiveMeshTools.C:243
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::primitiveMeshTools::boundaryFaceSkewness
static scalar boundaryFaceSkewness(const primitiveMesh &mesh, const pointField &p, const vectorField &fCtrs, const vectorField &fAreas, const label facei, const point &ownCc)
Skewness of single boundary face.
Definition: primitiveMeshTools.C:72
Foam::primitiveMeshTools
Definition: primitiveMeshTools.H:52
Foam::primitiveMeshTools::facePyramidVolume
static void facePyramidVolume(const primitiveMesh &mesh, const pointField &points, const vectorField &cellCtrs, scalarField &ownPyrVol, scalarField &neiPyrVol)
Generate face pyramid volume fields.
Definition: primitiveMeshTools.C:204
Foam::primitiveMeshTools::edgeAlignment
static tmp< scalarField > edgeAlignment(const primitiveMesh &mesh, const Vector< label > &directions, const pointField &p)
Generate edge alignment field. Is per face the minimum aligned edge.
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78