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 "areaFieldsFwd.H"
46 #include "edgeFieldsFwd.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class polyMesh;
55 
56 /*---------------------------------------------------------------------------*\
57  Class edgeInterpolation Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 {
62  // Private Data
63 
64  // Reference to faMesh
65  const faMesh& faMesh_;
66 
67 
68  // Demand-driven data
69 
70  //- Geodesic distance between centroids of neighbour finite areas
71  mutable std::unique_ptr<edgeScalarField> lPNptr_;
72 
73  //- Central-differencing weighting factors
74  mutable std::unique_ptr<edgeScalarField> weightingFactorsPtr_;
75 
76  //- Face-gradient difference factors
77  mutable std::unique_ptr<edgeScalarField> differenceFactorsPtr_;
78 
79  //- Non-orthogonality correction vectors
80  mutable std::unique_ptr<edgeVectorField> correctionVectorsPtr_;
81 
82  //- Skew correction vectors
83  mutable std::unique_ptr<edgeVectorField> skewCorrectionVectorsPtr_;
84 
85  //- Is mesh orthogonal
86  mutable bool orthogonal_;
87 
88  //- Is mesh skew
89  mutable bool skew_;
90 
91 
92  // Private Member Functions
93 
94  //- Return skewness correction per edge
95  const vector& skewCorr(const label edgeI) const;
96 
97  //- Construct geodesic distance between P and N
98  void makeLPN() const;
99 
100  //- Construct central-differencing weighting factors
101  void makeWeights() const;
102 
103  //- Construct face-gradient difference factors
104  void makeDeltaCoeffs() const;
105 
106  //- Construct non-orthogonality correction vectors
107  void makeCorrectionVectors() const;
108 
109  //- Construct skewness correction vectors
110  void makeSkewCorrectionVectors() const;
111 
112 
113 public:
114 
115  // Declare name of the class and it's debug switch
116  ClassName("edgeInterpolation");
117 
118 
119  // Generated Methods
120 
121  //- No copy construct
122  edgeInterpolation(const edgeInterpolation&) = delete;
123 
124  //- No copy assignment
125  void operator=(const edgeInterpolation&) = delete;
126 
127 
128  // Constructors
129 
130  //- Construct given an faMesh
131  explicit edgeInterpolation(const faMesh&);
132 
133 
134  //- Destructor
135  ~edgeInterpolation() = default;
136 
137 
138  // Member Functions
139 
140  //- Return mesh reference
141  const faMesh& mesh() const noexcept { return faMesh_; }
142 
143  //- Return reference to PN geodesic distance
144  const edgeScalarField& lPN() const;
145 
146  //- Return reference to weighting factors array
147  const edgeScalarField& weights() const;
148 
149  //- Return reference to difference factors array
150  const edgeScalarField& deltaCoeffs() const;
151 
152  //- Return reference to non-orthogonality correction vectors array
153  const edgeVectorField& correctionVectors() const;
154 
155  //- Return reference to skew vectors array
156  const edgeVectorField& skewCorrectionVectors() const;
157 
158  //- Return whether mesh is orthogonal or not
159  bool orthogonal() const;
160 
161  //- Return whether mesh is skew or not
162  bool skew() const;
163 
164 
165  // Mesh Motion
166 
167  //- Do what is necessary if the mesh has moved
168  bool movePoints() const;
169 
170 
171  // Storage Management
173  //- True if weights exist
174  bool hasWeights() const noexcept { return bool(weightingFactorsPtr_); }
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
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.
edgeInterpolation(const edgeInterpolation &)=delete
No copy construct.
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.
bool orthogonal() const
Return whether mesh is orthogonal or not.
const direction noexcept
Definition: scalarImpl.H:265
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
bool skew() const
Return whether mesh is skew or not.
ClassName("edgeInterpolation")
bool hasWeights() const noexcept
True if weights exist.
void operator=(const edgeInterpolation &)=delete
No copy assignment.
~edgeInterpolation()=default
Destructor.
const faMesh & mesh() const noexcept
Return mesh reference.
Forwards and collection of common area field types.
Namespace for OpenFOAM.