Loading...
Searching...
No Matches
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;
49/*---------------------------------------------------------------------------*\
50 Class averageNeighbourFvGeometryScheme Declaration
51\*---------------------------------------------------------------------------*/
52
53class averageNeighbourFvGeometryScheme
54:
55 public highAspectRatioFvGeometryScheme
56{
57private:
58
59 //- No copy construct
60 averageNeighbourFvGeometryScheme
61 (
62 const averageNeighbourFvGeometryScheme&
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_;
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
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
143public:
144
145 //- Runtime type information
146 TypeName("averageNeighbour");
147
148
149 // Constructors
150
151 //- Construct from mesh
152 averageNeighbourFvGeometryScheme
153 (
154 const fvMesh& mesh,
155 const dictionary& dict
156 );
157
158
159 //- Destructor
160 virtual ~averageNeighbourFvGeometryScheme() = default;
161
162
163 // Member Functions
165 //- Do what is necessary if the mesh has moved
166 virtual void movePoints();
167
168 //- Calculate geometry quantities using mesh topology and provided
169 //- points. If oldPoints provided only does local update. Returns
170 //- true if anything changed, false otherwise
171 virtual bool updateGeom
172 (
173 const pointField& points,
174 const refPtr<pointField>& oldPoints, // optional old points
175 pointField& faceCentres,
176 vectorField& faceAreas,
177 pointField& cellCentres,
178 scalarField& cellVolumes
179 ) const
180 {
182 return true;
183 }
184};
185
186
187// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188
189} // End namespace Foam
190
191// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192
193#endif
194
195// ************************************************************************* //
const label nIters_
Number of averaging iterations.
label clipFaceTet(const scalar minRatio, const vectorField &faceCentres, const vectorField &faceNormals, vectorField &faceCorrection) const
Clip face-centre correction vector if new triangle area would get below min. Return number of clipped...
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 bool updateGeom(const pointField &points, const refPtr< pointField > &oldPoints, pointField &faceCentres, vectorField &faceAreas, pointField &cellCentres, scalarField &cellVolumes) const
Calculate geometry quantities using mesh topology and provided points. If oldPoints provided only doe...
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
Clip correction vector if new pyramid height would get below min. Return number of clipped cells.
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:133
const fvMesh & mesh() const
Return mesh reference.
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Cell-face mesh analysis engine.
A class for managing references or pointers (no reference counting).
Definition refPtr.H:54
A class for managing temporary objects.
Definition tmp.H:75
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
const pointField & points
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Field< vector > vectorField
Specialisation of Field<T> for vector.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
vectorField pointField
pointField is a vectorField.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68