Loading...
Searching...
No Matches
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
42#include "gaussFaGrad.H"
43#include "areaFields.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class skewCorrectedEdgeInterpolation Declaration
52\*---------------------------------------------------------------------------*/
53
54template<class Type>
56:
57 virtual public edgeInterpolationScheme<Type>
58{
59 // Private Data
60
61 //- Edge-interpolation scheme
63
64
65public:
66
67 //- Runtime type information
68 TypeName("skewCorrected");
69
70
71 // Generated Methods
72
73 //- No copy construct
75 = delete;
76
77 //- No copy assignment
78 void operator=(const skewCorrectedEdgeInterpolation&) = delete;
79
80
81 // Constructors
82
83 //- Construct from Istream
85 :
87 tScheme_
88 (
90 )
91 {}
92
93 //- Construct from mesh, faceFlux and blendingFactor
95 (
96 const faMesh& mesh,
97 const edgeScalarField& faceFlux,
98 Istream& is
99 )
100 :
102 tScheme_
103 (
104 edgeInterpolationScheme<Type>::New(mesh, faceFlux, is)
105 )
106 {}
107
108
109 // Member Functions
110
111 //- Return the interpolation weighting factors
113 (
115 ) const
116 {
117 return tScheme_().weights(vf);
118 }
119
120 //- Return true if this scheme uses an explicit correction
121 virtual bool corrected() const
122 {
123 return
124 tScheme_().corrected() || (this->mesh()).skew();
125 }
126
129 (
131 ) const
133 const faMesh& mesh = this->mesh();
134
135 const edgeVectorField& scv = mesh.skewCorrectionVectors();
136
138 (
140 (
142 (
143 "skewCorrected::skewCorrection(" + vf.name() + ')',
144 vf.instance(),
145 vf.db()
146 ),
147 mesh,
149 )
150 );
151
153
154 for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
155 {
156 corr.replace
157 (
158 cmpt,
160 <
161 typename outerProduct
162 <
163 vector,
165 >::type
167 (
169 (mesh).grad(vf.component(cmpt))
170 )
171 );
172 }
173
174 return tsfCorr;
175 }
176
177
178 //- Return the explicit correction to the face-interpolate
179 virtual tmp<GeometricField<Type, faePatchField, edgeMesh>>
181 (
182 const GeometricField<Type, faPatchField, areaMesh>& vf
183 ) const
184 {
185 if
186 (
187 tScheme_().corrected()
188 && (this->mesh()).skew()
189 )
190 {
191 return tScheme_().correction(vf) + skewCorrection(vf);
192 }
193 else if (tScheme_().corrected())
194 {
195 return tScheme_().correction(vf);
196 }
197 else if ((this->mesh()).skew())
198 {
199 return skewCorrection(vf);
200 }
201 else
202 {
203 return
204 tmp<GeometricField<Type, faePatchField, edgeMesh>>
205 (
206 nullptr
207 );
208 }
209 }
210};
211
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215} // End namespace Foam
216
217// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218
219#endif
220
221// ************************************************************************* //
const dimensionSet & dimensions() const noexcept
Return dimensions.
Generic GeometricField class.
void replace(const direction d, const GeometricField< cmptType, PatchField, GeoMesh > &gcf)
Replace specified field component with content from another field.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef().
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:191
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition IOobject.C:450
const fileName & instance() const noexcept
Read access to instance path component.
Definition IOobjectI.H:289
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
Generic dimensioned Type class.
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.
edgeInterpolationScheme(const edgeInterpolationScheme &)=delete
No copy construct.
const faMesh & mesh() const
Return mesh reference.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition faMesh.H:140
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition gaussFaGrad.H:60
Central-differencing interpolation scheme class.
A traits class, which is primarily used for primitives and vector-space.
Definition pTraits.H:64
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:75
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
dynamicFvMesh & mesh
Namespace for OpenFOAM.
GeometricField< vector, faePatchField, edgeMesh > edgeVectorField
GeometricField< scalar, faePatchField, edgeMesh > edgeScalarField
uint8_t direction
Definition direction.H:49
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
Vector< scalar > vector
Definition vector.H:57
dimensionedTensor skew(const dimensionedTensor &dt)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68