Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
finiteVolume
interpolation
surfaceInterpolation
schemes
skewCorrected
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 | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::skewCorrected
26
27
Description
28
Skewness-corrected interpolation scheme that applies an explicit
29
correction to given scheme.
30
31
SourceFiles
32
skewCorrected.C
33
34
\*---------------------------------------------------------------------------*/
35
36
#ifndef skewCorrected_H
37
#define skewCorrected_H
38
39
#include <
finiteVolume/surfaceInterpolationScheme.H
>
40
#include "
skewCorrectionVectors.H
"
41
#include <
finiteVolume/linear.H
>
42
#include <
finiteVolume/gaussGrad.H
>
43
44
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46
namespace
Foam
47
{
48
49
/*---------------------------------------------------------------------------*\
50
Class skewCorrected Declaration
51
\*---------------------------------------------------------------------------*/
52
53
template
<
class
Type>
54
class
skewCorrected
55
:
56
public
surfaceInterpolationScheme
<Type>
57
{
58
// Private member data
59
60
tmp<surfaceInterpolationScheme<Type>
> tScheme_;
61
62
63
// Private Member Functions
64
65
//- Disallow default bitwise copy construct
66
skewCorrected
(
const
skewCorrected
&);
67
68
//- Disallow default bitwise assignment
69
void
operator=(
const
skewCorrected
&);
70
71
72
public
:
73
74
//- Runtime type information
75
TypeName
(
"skewCorrected"
);
76
77
78
// Constructors
79
80
//- Construct from mesh and Istream
81
skewCorrected
82
(
83
const
fvMesh
&
mesh
,
84
Istream
& is
85
)
86
:
87
surfaceInterpolationScheme<Type>
(
mesh
),
88
tScheme_
89
(
90
surfaceInterpolationScheme<Type>::New
(mesh, is)
91
)
92
{}
93
94
95
//- Construct from mesh, faceFlux and Istream
96
skewCorrected
97
(
98
const
fvMesh
& mesh,
99
const
surfaceScalarField
& faceFlux,
100
Istream
& is
101
)
102
:
103
surfaceInterpolationScheme<Type>
(
mesh
),
104
tScheme_
105
(
106
surfaceInterpolationScheme<Type>::New
(mesh, faceFlux, is)
107
)
108
{}
109
110
111
// Member Functions
112
113
//- Return the interpolation weighting factors
114
tmp<surfaceScalarField>
weights
115
(
116
const
GeometricField<Type, fvPatchField, volMesh>
& vf
117
)
const
118
{
119
return
tScheme_().weights(vf);
120
}
121
122
//- Return true if this scheme uses an explicit correction
123
virtual
bool
corrected
()
const
124
{
125
return
126
tScheme_().corrected()
127
||
skewCorrectionVectors::New
(this->
mesh
()).skew();
128
}
129
130
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>
>
131
skewCorrection
132
(
133
const
GeometricField<Type, fvPatchField, volMesh>
& vf
134
)
const
135
{
136
const
fvMesh
& mesh = this->
mesh
();
137
138
const
skewCorrectionVectors
& scv =
skewCorrectionVectors::New
(mesh);
139
140
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>
> tsfCorr
141
(
142
new
GeometricField<Type, fvsPatchField, surfaceMesh>
143
(
144
IOobject
145
(
146
vf.
name
(),
147
mesh.
time
().
timeName
(),
148
mesh
149
),
150
mesh,
151
dimensioned<Type>
152
(
153
vf.
name
(),
154
vf.
dimensions
(),
155
pTraits<Type>::zero
156
)
157
)
158
);
159
160
for
(
direction
cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
161
{
162
tsfCorr().replace
163
(
164
cmpt,
165
scv() &
linear
166
<
167
typename
outerProduct
168
<
169
vector
,
170
typename
pTraits<Type>::cmptType
171
>::
type
172
> (mesh).
interpolate
173
(
174
fv::gaussGrad
<
typename
pTraits<Type>::cmptType
>
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
185
virtual
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>
>
186
correction
187
(
188
const
GeometricField<Type, fvPatchField, volMesh>
& vf
189
)
const
190
{
191
if
192
(
193
tScheme_().
corrected
()
194
&&
skewCorrectionVectors::New
(this->
mesh
()).
skew
()
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
210
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>
>(NULL);
211
}
212
}
213
};
214
215
216
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218
}
// End namespace Foam
219
220
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222
#endif
223
224
// ************************ vim: set sw=4 sts=4 et: ************************ //