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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::averageNeighbourFvGeometryScheme
28
29Description
30 Geometry calculation scheme to minimise non-orthogonality/
31
32SourceFiles
33 averageNeighbourFvGeometryScheme.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef averageNeighbourFvGeometryScheme_H
38#define averageNeighbourFvGeometryScheme_H
39
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44namespace Foam
45{
46
47class primitiveMesh;
48
49/*---------------------------------------------------------------------------*\
50 Class averageNeighbourFvGeometryScheme Declaration
51\*---------------------------------------------------------------------------*/
54:
56{
57private:
58
59 //- No copy construct
61 (
63 ) = delete;
64
65 //- No copy assignment
66 void operator=(const averageNeighbourFvGeometryScheme&) = delete;
67
68
69protected:
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,
89 vectorField& faceCorrection
90 ) const;
91
92 //- Calculate pyramid heights
94 (
95 const pointField& cellCentres,
96 const vectorField& faceCentres,
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,
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,
122 const scalarField& faceWeights
123 ) const;
124
126 (
127 const pointField& cellCentres,
128 const pointField& faceCentres,
130 ) const;
131
132 //- Make weights based on non-orthogonality
134 (
135 const pointField& cellCentres,
137
138 scalarField& cosAngles,
139 scalarField& faceWeights
140 ) const;
141
142
143public:
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// ************************************************************************* //
Geometry calculation scheme to minimise non-orthogonality/.
const label nIters_
Number of averaging iterations.
label clipFaceTet(const scalar minRatio, const vectorField &faceCentres, const vectorField &faceNormals, vectorField &faceCorrection) const
const scalar minRatio_
Clipping for pyramid heights - allowable shrinkage as fraction.
tmp< pointField > averageCentres(const pointField &cellCentres, const pointField &faceCentres, const vectorField &faceNormals) const
TypeName("averageNeighbour")
Runtime type information.
virtual void movePoints()
Do what is necessary if the mesh has moved.
void makePyrHeights(const pointField &cellCentres, const vectorField &faceCentres, const vectorField &faceNormals, scalarField &ownHeight, scalarField &neiHeight) const
Calculate pyramid heights.
virtual ~averageNeighbourFvGeometryScheme()=default
Destructor.
tmp< pointField > averageNeighbourCentres(const pointField &cellCentres, const vectorField &faceNormals, const scalarField &faceWeights) const
Average neighbouring cell centres to minimise non-ortho.
const scalar relax_
Blending between old-iteration cell centres and current average.
label clipPyramids(const pointField &cellCentres, const vectorField &faceCentres, const vectorField &faceNormals, const scalarField &minOwnHeight, const scalarField &minNeiHeight, vectorField &correction) const
void makeNonOrthoWeights(const pointField &cellCentres, const vectorField &faceNormals, scalarField &cosAngles, scalarField &faceWeights) const
Make weights based on non-orthogonality.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const fvMesh & mesh() const
Return mesh reference.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Geometry calculation scheme with automatic stabilisation for high-aspect ratio cells.
A class for managing temporary objects.
Definition: tmp.H:65
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf())
Namespace for OpenFOAM.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73