averageNeighbourFvGeometryScheme.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) 2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::averageNeighbourFvGeometryScheme
28 
29 Description
30  Geometry calculation scheme to minimise non-orthogonality/
31 
32 SourceFiles
33  averageNeighbourFvGeometryScheme.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef averageNeighbourFvGeometryScheme_H
38 #define averageNeighbourFvGeometryScheme_H
39 
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class primitiveMesh;
48 
49 /*---------------------------------------------------------------------------*\
50  Class averageNeighbourFvGeometryScheme Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
56 {
57 private:
58 
59  //- No copy construct
61  (
63  ) = delete;
64 
65  //- No copy assignment
66  void operator=(const averageNeighbourFvGeometryScheme&) = delete;
67 
68 
69 protected:
70 
71  //- Number of averaging iterations
72  const label nIters_;
73 
74  //- Blending between old-iteration cell centres and current average
75  const scalar relax_;
76 
77  //- Clipping for pyramid heights - allowable shrinkage as fraction
78  // of original
79  const scalar minRatio_;
80 
81 
82  //- Clip face-centre correction vector if new triangle area
83  //- would get below min. Return number of clipped faces.
84  label clipFaceTet
85  (
86  const scalar minRatio,
87  const vectorField& faceCentres,
88  const vectorField& faceNormals,
89  vectorField& faceCorrection
90  ) const;
91 
92  //- Calculate pyramid heights
93  void makePyrHeights
94  (
95  const pointField& cellCentres,
96  const vectorField& faceCentres,
97  const vectorField& faceNormals,
98 
99  scalarField& ownHeight,
100  scalarField& neiHeight
101  ) const;
102 
103  //- Clip correction vector if new pyramid height would get below min.
104  //- Return number of clipped cells.
105  label clipPyramids
106  (
107  const pointField& cellCentres,
108  const vectorField& faceCentres,
109  const vectorField& faceNormals,
110 
111  const scalarField& minOwnHeight,
112  const scalarField& minNeiHeight,
113 
115  ) const;
116 
117  //- Average neighbouring cell centres to minimise non-ortho
119  (
120  const pointField& cellCentres,
121  const vectorField& faceNormals,
122  const scalarField& faceWeights
123  ) const;
124 
126  (
127  const pointField& cellCentres,
128  const pointField& faceCentres,
129  const vectorField& faceNormals
130  ) const;
131 
132  //- Make weights based on non-orthogonality
134  (
135  const pointField& cellCentres,
136  const vectorField& faceNormals,
137 
138  scalarField& cosAngles,
139  scalarField& faceWeights
140  ) const;
141 
142 
143 public:
144 
145  //- Runtime type information
146  TypeName("averageNeighbour");
147 
148 
149  // Constructors
150 
151  //- Construct from mesh
153  (
154  const fvMesh& mesh,
155  const dictionary& dict
156  );
157 
158 
159  //- Destructor
160  virtual ~averageNeighbourFvGeometryScheme() = default;
161 
162 
163  // Member Functions
164 
165  //- Do what is necessary if the mesh has moved
166  virtual void movePoints();
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
Foam::averageNeighbourFvGeometryScheme::nIters_
const label nIters_
Number of averaging iterations.
Definition: averageNeighbourFvGeometryScheme.H:71
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::averageNeighbourFvGeometryScheme::movePoints
virtual void movePoints()
Do what is necessary if the mesh has moved.
Definition: averageNeighbourFvGeometryScheme.C:630
highAspectRatioFvGeometryScheme.H
Foam::averageNeighbourFvGeometryScheme::averageNeighbourCentres
tmp< pointField > averageNeighbourCentres(const pointField &cellCentres, const vectorField &faceNormals, const scalarField &faceWeights) const
Average neighbouring cell centres to minimise non-ortho.
Definition: averageNeighbourFvGeometryScheme.C:271
Foam::correction
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Foam::averageNeighbourFvGeometryScheme::makePyrHeights
void makePyrHeights(const pointField &cellCentres, const vectorField &faceCentres, const vectorField &faceNormals, scalarField &ownHeight, scalarField &neiHeight) const
Calculate pyramid heights.
Definition: averageNeighbourFvGeometryScheme.C:133
Foam::averageNeighbourFvGeometryScheme::clipFaceTet
label clipFaceTet(const scalar minRatio, const vectorField &faceCentres, const vectorField &faceNormals, vectorField &faceCorrection) const
Definition: averageNeighbourFvGeometryScheme.C:55
Foam::fvGeometryScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: fvGeometryScheme.H:123
Foam::averageNeighbourFvGeometryScheme::clipPyramids
label clipPyramids(const pointField &cellCentres, const vectorField &faceCentres, const vectorField &faceNormals, const scalarField &minOwnHeight, const scalarField &minNeiHeight, vectorField &correction) const
Definition: averageNeighbourFvGeometryScheme.C:173
Foam::averageNeighbourFvGeometryScheme::~averageNeighbourFvGeometryScheme
virtual ~averageNeighbourFvGeometryScheme()=default
Destructor.
Foam::averageNeighbourFvGeometryScheme::makeNonOrthoWeights
void makeNonOrthoWeights(const pointField &cellCentres, const vectorField &faceNormals, scalarField &cosAngles, scalarField &faceWeights) const
Make weights based on non-orthogonality.
Definition: averageNeighbourFvGeometryScheme.C:517
faceNormals
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf())
Foam::Field< vector >
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::averageNeighbourFvGeometryScheme::minRatio_
const scalar minRatio_
Clipping for pyramid heights - allowable shrinkage as fraction.
Definition: averageNeighbourFvGeometryScheme.H:78
Foam::averageNeighbourFvGeometryScheme
Geometry calculation scheme to minimise non-orthogonality/.
Definition: averageNeighbourFvGeometryScheme.H:52
Foam::averageNeighbourFvGeometryScheme::averageCentres
tmp< pointField > averageCentres(const pointField &cellCentres, const pointField &faceCentres, const vectorField &faceNormals) const
Definition: averageNeighbourFvGeometryScheme.C:382
Foam::highAspectRatioFvGeometryScheme
Geometry calculation scheme with automatic stabilisation for high-aspect ratio cells.
Definition: highAspectRatioFvGeometryScheme.H:54
Foam::averageNeighbourFvGeometryScheme::TypeName
TypeName("averageNeighbour")
Runtime type information.
Foam::averageNeighbourFvGeometryScheme::relax_
const scalar relax_
Blending between old-iteration cell centres and current average.
Definition: averageNeighbourFvGeometryScheme.H:74