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
fields
fvPatchFields
basic
fixedGradient
fixedGradientFvPatchField.C
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
\*---------------------------------------------------------------------------*/
25
26
#include "
fixedGradientFvPatchField.H
"
27
#include <
OpenFOAM/dictionary.H
>
28
29
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30
31
namespace
Foam
32
{
33
34
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35
36
template
<
class
Type>
37
fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
38
(
39
const
fvPatch
&
p
,
40
const
DimensionedField<Type, volMesh>
& iF
41
)
42
:
43
fvPatchField<Type>
(
p
, iF),
44
gradient_(p.
size
(),
pTraits<Type>::zero
)
45
{}
46
47
48
template
<
class
Type>
49
fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
50
(
51
const
fixedGradientFvPatchField<Type>
& ptf,
52
const
fvPatch
& p,
53
const
DimensionedField<Type, volMesh>
& iF,
54
const
fvPatchFieldMapper
& mapper
55
)
56
:
57
fvPatchField<Type>
(ptf,
p
, iF, mapper),
58
gradient_(ptf.gradient_, mapper)
59
{}
60
61
62
template
<
class
Type>
63
fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
64
(
65
const
fvPatch
& p,
66
const
DimensionedField<Type, volMesh>
& iF,
67
const
dictionary
& dict
68
)
69
:
70
fvPatchField<Type>
(
p
, iF, dict),
71
gradient_(
"gradient"
, dict, p.
size
())
72
{
73
evaluate();
74
}
75
76
77
template
<
class
Type>
78
fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
79
(
80
const
fixedGradientFvPatchField<Type>
& ptf
81
)
82
:
83
fvPatchField<Type>
(ptf),
84
gradient_(ptf.gradient_)
85
{}
86
87
88
template
<
class
Type>
89
fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
90
(
91
const
fixedGradientFvPatchField<Type>
& ptf,
92
const
DimensionedField<Type, volMesh>
& iF
93
)
94
:
95
fvPatchField<Type>
(ptf, iF),
96
gradient_(ptf.gradient_)
97
{}
98
99
100
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101
102
template
<
class
Type>
103
void
fixedGradientFvPatchField<Type>::autoMap
104
(
105
const
fvPatchFieldMapper
& m
106
)
107
{
108
fvPatchField<Type>::autoMap
(m);
109
gradient_.autoMap(m);
110
}
111
112
113
template
<
class
Type>
114
void
fixedGradientFvPatchField<Type>::rmap
115
(
116
const
fvPatchField<Type>
& ptf,
117
const
labelList
& addr
118
)
119
{
120
fvPatchField<Type>::rmap
(ptf, addr);
121
122
const
fixedGradientFvPatchField<Type>
& fgptf =
123
refCast<const fixedGradientFvPatchField<Type> >(ptf);
124
125
gradient_.
rmap
(fgptf.gradient_, addr);
126
}
127
128
129
template
<
class
Type>
130
void
fixedGradientFvPatchField<Type>::evaluate
(
const
Pstream::commsTypes
)
131
{
132
if
(!this->updated())
133
{
134
this->updateCoeffs();
135
}
136
137
Field<Type>::operator
=
138
(
139
this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
140
);
141
142
fvPatchField<Type>::evaluate
();
143
}
144
145
146
template
<
class
Type>
147
tmp<Field<Type>
>
fixedGradientFvPatchField<Type>::valueInternalCoeffs
148
(
149
const
tmp<scalarField>
&
150
)
const
151
{
152
return
tmp<Field<Type>
>(
new
Field<Type>
(this->size(),
pTraits<Type>::one
));
153
}
154
155
156
template
<
class
Type>
157
tmp<Field<Type>
>
fixedGradientFvPatchField<Type>::valueBoundaryCoeffs
158
(
159
const
tmp<scalarField>
&
160
)
const
161
{
162
return
gradient()/this->patch().deltaCoeffs();
163
}
164
165
166
template
<
class
Type>
167
tmp<Field<Type>
>
fixedGradientFvPatchField<Type>::
168
gradientInternalCoeffs
()
const
169
{
170
return
tmp<Field<Type>
>
171
(
172
new
Field<Type>
(this->size(),
pTraits<Type>::zero
)
173
);
174
}
175
176
177
template
<
class
Type>
178
tmp<Field<Type>
>
fixedGradientFvPatchField<Type>::
179
gradientBoundaryCoeffs
()
const
180
{
181
return
gradient();
182
}
183
184
185
template
<
class
Type>
186
void
fixedGradientFvPatchField<Type>::write
(
Ostream
& os)
const
187
{
188
fvPatchField<Type>::write
(os);
189
gradient_.writeEntry(
"gradient"
, os);
190
}
191
192
193
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195
}
// End namespace Foam
196
197
// ************************ vim: set sw=4 sts=4 et: ************************ //