skewCorrectedEdgeInterpolation.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) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::skewCorrectedEdgeInterpolation
29
30Description
31 Linear/upwind blended differencing scheme
32
33SourceFiles
34 skewCorrectedEdgeInterpolationMake.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef skewCorrectedEdgeInterpolation_H
39#define skewCorrectedEdgeInterpolation_H
40
43#include "gaussFaGrad.H"
44#include "areaFields.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class skewCorrectedEdgeInterpolation Declaration
54\*---------------------------------------------------------------------------*/
55
56template<class Type>
58:
59 virtual public edgeInterpolationScheme<Type>
60{
61 // Private Data
62
64
65
66public:
67
68 //- Runtime type information
69 TypeName("skewCorrected");
70
71
72 // Constructors
73
74 //- Construct from Istream
76 :
78 tScheme_
79 (
81 )
82 {}
83
84 //- Construct from mesh, faceFlux and blendingFactor
86 (
87 const faMesh& mesh,
88 const edgeScalarField& faceFlux,
89 Istream& is
90 )
91 :
93 tScheme_
94 (
95 edgeInterpolationScheme<Type>::New(mesh, faceFlux, is)
96 )
97 {}
98
99 //- No copy construct
101 delete;
102
103 //- No copy assignment
104 void operator=(const skewCorrectedEdgeInterpolation&) = delete;
105
106
107 // Member Functions
108
109 //- Return the interpolation weighting factors
111 (
113 ) const
114 {
115 return tScheme_().weights(vf);
116 }
117
118 //- Return true if this scheme uses an explicit correction
119 virtual bool corrected() const
120 {
121 return
122 tScheme_().corrected() || (this->mesh()).skew();
123 }
124
127 (
129 ) const
130 {
131 const faMesh& mesh = this->mesh();
132
134
136 (
138 (
140 (
141 "skewCorrected::skewCorrection(" + vf.name() + ')',
142 vf.instance(),
143 vf.db()
144 ),
145 mesh,
147 )
148 );
149
151
152 for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
153 {
154 corr.replace
155 (
156 cmpt,
158 <
159 typename outerProduct
160 <
161 vector,
163 >::type
165 (
167 (mesh).grad(vf.component(cmpt))
168 )
169 );
170 }
171
172 return tsfCorr;
173 }
174
175
176 //- Return the explicit correction to the face-interpolate
179 (
181 ) const
182 {
183 if
184 (
185 tScheme_().corrected()
186 && (this->mesh()).skew()
187 )
188 {
189 return tScheme_().correction(vf) + skewCorrection(vf);
190 }
191 else if (tScheme_().corrected())
192 {
193 return tScheme_().correction(vf);
194 }
195 else if ((this->mesh()).skew())
196 {
197 return skewCorrection(vf);
198 }
199 else
200 {
201 return
203 (
204 nullptr
205 );
206 }
207 }
208};
209
210
211// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212
213} // End namespace Foam
214
215// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216
217#endif
218
219// ************************************************************************* //
const dimensionSet & dimensions() const
Return dimensions.
void replace(const direction d, const GeometricField< cmptType, PatchField, GeoMesh > &gcf)
Replace specified field component with content from another field.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:500
const fileName & instance() const noexcept
Read access to instance path component.
Definition: IOobjectI.H:196
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Generic dimensioned Type class.
Abstract base class for edge interpolation schemes.
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &, const tmp< edgeScalarField > &, const tmp< edgeScalarField > &)
Return the face-interpolate of the given cell field.
static tmp< edgeInterpolationScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
const faMesh & mesh() const
Return mesh reference.
const edgeVectorField & skewCorrectionVectors() const
Return reference to skew vectors array.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussFaGrad.H:63
Central-differencing interpolation scheme class.
Linear/upwind blended differencing scheme.
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
tmp< GeometricField< Type, faePatchField, edgeMesh > > skewCorrection(const GeometricField< Type, faPatchField, areaMesh > &vf) const
void operator=(const skewCorrectedEdgeInterpolation &)=delete
No copy assignment.
skewCorrectedEdgeInterpolation(const faMesh &mesh, Istream &is)
Construct from Istream.
skewCorrectedEdgeInterpolation(const faMesh &mesh, const edgeScalarField &faceFlux, Istream &is)
Construct from mesh, faceFlux and blendingFactor.
TypeName("skewCorrected")
Runtime type information.
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &vf) const
Return the interpolation weighting factors.
skewCorrectedEdgeInterpolation(const skewCorrectedEdgeInterpolation &)=delete
No copy construct.
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &vf) const
Return the explicit correction to the face-interpolate.
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
uint8_t direction
Definition: direction.H:56
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
dimensionedTensor skew(const dimensionedTensor &dt)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73