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
UpwindFitScheme
UpwindFitScheme.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::UpwindFitScheme
26
27
Description
28
Upwind biased fit surface interpolation scheme that applies an explicit
29
correction to linear.
30
31
\*---------------------------------------------------------------------------*/
32
33
#ifndef UpwindFitScheme_H
34
#define UpwindFitScheme_H
35
36
#include "
UpwindFitData.H
"
37
#include <
finiteVolume/linear.H
>
38
39
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40
41
namespace
Foam
42
{
43
44
/*---------------------------------------------------------------------------*\
45
Class UpwindFitScheme Declaration
46
\*---------------------------------------------------------------------------*/
47
48
template
<
class
Type,
class
Polynomial,
class
Stencil>
49
class
UpwindFitScheme
50
:
51
public
linear
<Type>
52
{
53
// Private Data
54
55
//- Reference to the surface flux used to choose upwind direction
56
const
surfaceScalarField
& faceFlux_;
57
58
//- Factor the fit is allowed to deviate from linear.
59
// This limits the amount of high-order correction and increases
60
// stability on bad meshes
61
const
scalar linearLimitFactor_;
62
63
//- Weights for central stencil
64
const
scalar centralWeight_;
65
66
67
// Private Member Functions
68
69
//- Disallow default bitwise copy construct
70
UpwindFitScheme
(
const
UpwindFitScheme
&);
71
72
//- Disallow default bitwise assignment
73
void
operator=(
const
UpwindFitScheme
&);
74
75
76
public
:
77
78
//- Runtime type information
79
TypeName
(
"UpwindFitScheme"
);
80
81
82
// Constructors
83
84
//- Construct from mesh and Istream
85
// The name of the flux field is read from the Istream and looked-up
86
// from the mesh objectRegistry
87
UpwindFitScheme
(
const
fvMesh
&
mesh
,
Istream
& is)
88
:
89
linear
<Type>(mesh),
90
faceFlux_(mesh.lookupObject<
surfaceScalarField
>(
word
(is))),
91
linearLimitFactor_(
readScalar
(is)),
92
centralWeight_(1000)
93
{}
94
95
96
//- Construct from mesh, faceFlux and Istream
97
UpwindFitScheme
98
(
99
const
fvMesh
&
mesh
,
100
const
surfaceScalarField
& faceFlux,
101
Istream
& is
102
)
103
:
104
linear<Type>
(
mesh
),
105
faceFlux_(faceFlux),
106
linearLimitFactor_(
readScalar
(is)),
107
centralWeight_(1000)
108
{}
109
110
111
// Member Functions
112
113
//- Return true if this scheme uses an explicit correction
114
virtual
bool
corrected
()
const
115
{
116
return
true
;
117
}
118
119
//- Return the explicit correction to the face-interpolate
120
virtual
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>
>
121
correction
122
(
123
const
GeometricField<Type, fvPatchField, volMesh>
& vf
124
)
const
125
{
126
const
fvMesh
& mesh = this->
mesh
();
127
128
const
extendedUpwindCellToFaceStencil
& stencil =
Stencil::New
129
(
130
mesh,
131
false
,
//pureUpwind
132
scalar(0.5)
133
);
134
135
const
UpwindFitData<Polynomial>
& ufd =
136
UpwindFitData<Polynomial>::New
137
(
138
mesh,
139
stencil,
140
true
,
//calculate as offset to linear
141
linearLimitFactor_,
142
centralWeight_
143
);
144
145
const
List<scalarList>
& fo = ufd.
owncoeffs
();
146
const
List<scalarList>
& fn = ufd.
neicoeffs
();
147
148
return
stencil.
weightedSum
(faceFlux_, vf, fo, fn);
149
}
150
};
151
152
153
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155
}
// End namespace Foam
156
157
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158
159
// Add the patch constructor functions to the hash tables
160
161
#define makeUpwindFitSurfaceInterpolationTypeScheme(SS, POLYNOMIAL, STENCIL, TYPE) \
162
\
163
typedef UpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> \
164
UpwindFitScheme##TYPE##POLYNOMIAL##STENCIL##_; \
165
defineTemplateTypeNameAndDebugWithName \
166
(UpwindFitScheme##TYPE##POLYNOMIAL##STENCIL##_, #SS, 0); \
167
\
168
surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
169
<UpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> > \
170
add##SS##STENCIL##TYPE##MeshConstructorToTable_; \
171
\
172
surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
173
<UpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> > \
174
add##SS##STENCIL##TYPE##MeshFluxConstructorToTable_;
175
176
#define makeUpwindFitSurfaceInterpolationScheme(SS, POLYNOMIAL, STENCIL) \
177
\
178
makeUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,scalar) \
179
makeUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,vector) \
180
makeUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,sphericalTensor) \
181
makeUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,symmTensor) \
182
makeUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,tensor)
183
184
185
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187
#endif
188
189
// ************************ vim: set sw=4 sts=4 et: ************************ //