skewCorrected.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) 2011-2016 OpenFOAM Foundation
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::skewCorrected
28
29Group
30 grpFvSurfaceInterpolationSchemes
31
32Description
33 Skewness-corrected interpolation scheme that applies an explicit
34 correction to given scheme.
35
36SourceFiles
37 skewCorrected.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef skewCorrected_H
42#define skewCorrected_H
43
46#include "linear.H"
47#include "gaussGrad.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54/*---------------------------------------------------------------------------*\
55 Class skewCorrected Declaration
56\*---------------------------------------------------------------------------*/
57
58template<class Type>
59class skewCorrected
60:
62{
63 // Private member data
64
66
67
68 // Private Member Functions
69
70 //- No copy construct
71 skewCorrected(const skewCorrected&) = delete;
72
73 //- No copy assignment
74 void operator=(const skewCorrected&) = delete;
75
76
77public:
78
79 //- Runtime type information
80 TypeName("skewCorrected");
81
82
83 // Constructors
84
85 //- Construct from mesh and Istream
87 (
88 const fvMesh& mesh,
89 Istream& is
90 )
91 :
93 tScheme_
94 (
96 )
97 {}
98
99
100 //- Construct from mesh, faceFlux and Istream
102 (
103 const fvMesh& mesh,
104 const surfaceScalarField& faceFlux,
105 Istream& is
106 )
107 :
109 tScheme_
110 (
111 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
112 )
113 {}
114
115
116 // Member Functions
117
118 //- Return the interpolation weighting factors
120 (
122 ) const
123 {
124 return tScheme_().weights(vf);
125 }
126
127 //- Return true if this scheme uses an explicit correction
128 virtual bool corrected() const
129 {
130 return
131 tScheme_().corrected()
132 || skewCorrectionVectors::New(this->mesh()).skew();
133 }
134
137 (
139 ) const
140 {
141 const fvMesh& mesh = this->mesh();
142
144
146 (
148 (
150 (
151 "skewCorrected::skewCorrection(" + vf.name() + ')',
152 mesh.time().timeName(),
153 mesh
154 ),
155 mesh,
157 )
158 );
159
160 for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
161 {
162 tsfCorr.ref().replace
163 (
164 cmpt,
165 scv() & linear
166 <
167 typename outerProduct
168 <
169 vector,
171 >::type
172 > (mesh).interpolate
173 (
175 (mesh).grad(vf.component(cmpt))
176 )
177 );
178 }
179
180 return tsfCorr;
181 }
182
183
184 //- Return the explicit correction to the face-interpolate
187 (
189 ) const
190 {
191 if
192 (
193 tScheme_().corrected()
195 )
196 {
197 return tScheme_().correction(vf) + skewCorrection(vf);
198 }
199 else if (tScheme_().corrected())
200 {
201 return tScheme_().correction(vf);
202 }
203 else if (skewCorrectionVectors::New(this->mesh()).skew())
204 {
205 return skewCorrection(vf);
206 }
207 else
208 {
209 return
211 (
212 nullptr
213 );
214 }
215 }
216};
217
218
219// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220
221} // End namespace Foam
222
223// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224
225#endif
226
227// ************************************************************************* //
const dimensionSet & dimensions() const
Return dimensions.
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
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Generic dimensioned Type class.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussGrad.H:66
Central-differencing interpolation scheme class.
Definition: linear.H:58
Skewness-corrected interpolation scheme that applies an explicit correction to given scheme.
Definition: skewCorrected.H:61
skewCorrected(const fvMesh &mesh, Istream &is)
Construct from mesh and Istream.
Definition: skewCorrected.H:86
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
tmp< surfaceScalarField > weights(const GeometricField< Type, fvPatchField, volMesh > &vf) const
Return the interpolation weighting factors.
TypeName("skewCorrected")
Runtime type information.
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &vf) const
Return the explicit correction to the face-interpolate.
skewCorrected(const fvMesh &mesh, const surfaceScalarField &faceFlux, Istream &is)
Construct from mesh, faceFlux and Istream.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > skewCorrection(const GeometricField< Type, fvPatchField, volMesh > &vf) const
Skew-correction vectors for the skewness-corrected interpolation scheme.
Abstract base class for surface interpolation schemes.
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &, const tmp< surfaceScalarField > &, const tmp< surfaceScalarField > &)
Return the face-interpolate of the given cell field.
const fvMesh & mesh() const
Return mesh reference.
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
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