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