edgeInterpolation.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) 2016-2017 Wikki Ltd
9  Copyright (C) 2022 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 Class
28  Foam::edgeInterpolation
29 
30 Description
31  Face to edge interpolation scheme. Included in faMesh.
32 
33 Author
34  Zeljko Tukovic, FMENA
35  Hrvoje Jasak, Wikki Ltd.
36 
37 SourceFiles
38  edgeInterpolation.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef Foam_edgeInterpolation_H
43 #define Foam_edgeInterpolation_H
44 
45 #include "tmp.H"
46 #include "scalar.H"
47 #include "areaFieldsFwd.H"
48 #include "edgeFieldsFwd.H"
49 #include "className.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward Declarations
57 class polyMesh;
58 
59 /*---------------------------------------------------------------------------*\
60  Class edgeInterpolation Declaration
61 \*---------------------------------------------------------------------------*/
62 
64 {
65  // Private Data
66 
67  // Reference to faMesh
68  const faMesh& faMesh_;
69 
70 
71  // Demand-driven data
72 
73  //- Geodesic distance between centroids of neighbour finite areas
74  mutable edgeScalarField* lPN_;
75 
76  //- Central-differencing weighting factors
77  mutable edgeScalarField* weightingFactors_;
78 
79  //- Face-gradient difference factors
80  mutable edgeScalarField* differenceFactors_;
81 
82  //- Non-orthogonality correction vectors
83  mutable edgeVectorField* correctionVectors_;
84 
85  //- Skew correction vectors
86  mutable edgeVectorField* skewCorrectionVectors_;
87 
88  //- Is mesh orthogonal
89  mutable bool orthogonal_;
90 
91  //- Is mesh skew
92  mutable bool skew_;
93 
94 
95  // Private Member Functions
96 
97  //- Return skewness correction per edge
98  const vector& skewCorr(const label edgeI) const;
99 
100  //- Construct geodesic distance between P and N
101  void makeLPN() const;
102 
103  //- Construct central-differencing weighting factors
104  void makeWeights() const;
105 
106  //- Construct face-gradient difference factors
107  void makeDeltaCoeffs() const;
108 
109  //- Construct non-orthogonality correction vectors
110  void makeCorrectionVectors() const;
111 
112  //- Construct skewness correction vectors
113  void makeSkewCorrectionVectors() const;
114 
115 
116 protected:
117 
118  // Protected Member Functions
119 
120  // Storage Management
121 
122  //- Clear all geometry and addressing
123  void clearOut();
124 
125 
126 public:
127 
128  // Declare name of the class and it's debug switch
129  ClassName("edgeInterpolation");
130 
131 
132  // Constructors
133 
134  //- Construct given an faMesh
135  explicit edgeInterpolation(const faMesh&);
136 
137 
138  //- Destructor
140 
141 
142  // Member Functions
143 
144  //- Return mesh reference
145  const faMesh& mesh() const noexcept
146  {
147  return faMesh_;
148  }
149 
150  //- Return reference to PN geodesic distance
151  const edgeScalarField& lPN() const;
152 
153  //- Return reference to weighting factors array
154  const edgeScalarField& weights() const;
155 
156  //- Return reference to difference factors array
157  const edgeScalarField& deltaCoeffs() const;
158 
159  //- Return reference to non-orthogonality correction vectors array
160  const edgeVectorField& correctionVectors() const;
161 
162  //- Return reference to skew vectors array
163  const edgeVectorField& skewCorrectionVectors() const;
164 
165  //- Return whether mesh is orthogonal or not
166  bool orthogonal() const;
167 
168  //- Return whether mesh is skew or not
169  bool skew() const;
170 
171 
172  // Mesh Motion
173 
174  //- Do what is necessary if the mesh has moved
175  bool movePoints() const;
176 
177 
178  // Storage Management
179 
180  //- True if weights exist
181  bool hasWeights() const noexcept { return bool(weightingFactors_); }
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:87
const edgeVectorField & skewCorrectionVectors() const
Return reference to skew vectors array.
const edgeScalarField & weights() const
Return reference to weighting factors array.
const edgeScalarField & deltaCoeffs() const
Return reference to difference factors array.
const edgeVectorField & correctionVectors() const
Return reference to non-orthogonality correction vectors array.
Face to edge interpolation scheme. Included in faMesh.
bool movePoints() const
Do what is necessary if the mesh has moved.
const edgeScalarField & lPN() const
Return reference to PN geodesic distance.
Forwards for edge field types.
void clearOut()
Clear all geometry and addressing.
bool orthogonal() const
Return whether mesh is orthogonal or not.
const direction noexcept
Definition: Scalar.H:258
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
~edgeInterpolation()
Destructor.
bool skew() const
Return whether mesh is skew or not.
ClassName("edgeInterpolation")
Macro definitions for declaring ClassName(), NamespaceName(), etc.
bool hasWeights() const noexcept
True if weights exist.
edgeInterpolation(const faMesh &)
Construct given an faMesh.
const faMesh & mesh() const noexcept
Return mesh reference.
Forwards and collection of common area field types.
Namespace for OpenFOAM.