All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
primitiveMeshTools.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2018 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 Namespace
25  Foam::primitiveMeshTools
26 
27 Description
28  Collection of static functions operating on primitiveMesh (mainly checks).
29 
30 SourceFiles
31  primitiveMeshTools.C
32 
33 \*---------------------------------------------------------------------------*/
34 #ifndef primitiveMeshTools_H
35 #define primitiveMeshTools_H
36 
37 #include "primitiveMesh.H"
38 #include "PackedBoolList.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Namespace primitiveMeshTools Declaration
47 \*---------------------------------------------------------------------------*/
48 
50 {
51 public:
52 
53  //- Generate non-orthogonality field (internal faces only)
55  (
56  const primitiveMesh& mesh,
57  const vectorField& fAreas,
58  const vectorField& cellCtrs
59  );
60 
61  //- Generate face pyramid volume fields
62  static void facePyramidVolume
63  (
64  const primitiveMesh& mesh,
65  const pointField& points,
66  const vectorField& cellCtrs,
67  scalarField& ownPyrVol,
68  scalarField& neiPyrVol
69  );
70 
71  //- Generate skewness field
73  (
74  const primitiveMesh& mesh,
75  const pointField& points,
76  const vectorField& fCtrs,
77  const vectorField& fAreas,
78  const vectorField& cellCtrs
79  );
80 
81  //- Generate cell openness and cell ascpect ratio field
82  static void cellClosedness
83  (
84  const primitiveMesh& mesh,
85  const Vector<label>& meshD,
86  const vectorField& areas,
87  const scalarField& vols,
88  scalarField& openness,
89  scalarField& aratio
90  );
91 
92  //- Generate face concavity field. Returns per face the (sin of the)
93  // most concave angle between two consecutive edges
95  (
96  const scalar maxSin,
97  const primitiveMesh& mesh,
98  const pointField& p,
99  const vectorField& faceAreas
100  );
101 
102  //- Generate face flatness field. Compares the individual triangles'
103  // normals against the face average normal. Between 0 (fully warped)
104  // and 1 (fully flat)
106  (
107  const primitiveMesh& mesh,
108  const pointField& p,
109  const vectorField& fCtrs,
110  const vectorField& faceAreas
111  );
112 
113  //- Generate edge alignment field. Is per face the minimum aligned edge
114  // (does not use edge addressing)
116  (
117  const primitiveMesh& mesh,
118  const Vector<label>& directions,
119  const pointField& p
120  );
121 
122  //- Generate cell determinant field
124  (
125  const primitiveMesh& mesh,
126  const Vector<label>& directions,
127  const vectorField& faceAreas,
128  const PackedBoolList& internalOrCoupledFace
129  );
130 
131 
132  // Helpers: single face check
133 
134  //- Skewness of single face
135  static scalar faceSkewness
136  (
137  const primitiveMesh& mesh,
138  const pointField& p,
139  const vectorField& fCtrs,
140  const vectorField& fAreas,
141 
142  const label facei,
143  const point& ownCc,
144  const point& neiCc
145  );
146 
147  //- Skewness of single boundary face
148  static scalar boundaryFaceSkewness
149  (
150  const primitiveMesh& mesh,
151  const pointField& p,
152  const vectorField& fCtrs,
153  const vectorField& fAreas,
154 
155  const label facei,
156  const point& ownCc
157  );
158 
159  //- Orthogonality of single face
160  static scalar faceOrthogonality
161  (
162  const point& ownCc,
163  const point& neiCc,
164  const vector& s
165  );
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
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
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:74
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Definition: directions.H:64
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)
static tmp< scalarField > faceSkewness(const primitiveMesh &mesh, const pointField &points, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs)
Generate skewness field.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
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.
dynamicFvMesh & mesh
const pointField & points
static void facePyramidVolume(const primitiveMesh &mesh, const pointField &points, const vectorField &cellCtrs, scalarField &ownPyrVol, scalarField &neiPyrVol)
Generate face pyramid volume fields.
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.
A bit-packed bool list.
static tmp< scalarField > faceOrthogonality(const primitiveMesh &mesh, const vectorField &fAreas, const vectorField &cellCtrs)
Generate non-orthogonality field (internal faces only)
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
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.
static tmp< scalarField > faceFlatness(const primitiveMesh &mesh, const pointField &p, const vectorField &fCtrs, const vectorField &faceAreas)
Generate face flatness field. Compares the individual triangles&#39;.
static tmp< scalarField > cellDeterminant(const primitiveMesh &mesh, const Vector< label > &directions, const vectorField &faceAreas, const PackedBoolList &internalOrCoupledFace)
Generate cell determinant field.
Namespace for OpenFOAM.