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
derived
rotatingWallVelocity
rotatingWallVelocityFvPatchVectorField.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 "
rotatingWallVelocityFvPatchVectorField.H
"
27
#include <
OpenFOAM/addToRunTimeSelectionTable.H
>
28
#include <
finiteVolume/volFields.H
>
29
#include <
finiteVolume/surfaceFields.H
>
30
31
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33
namespace
Foam
34
{
35
36
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37
38
rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
39
(
40
const
fvPatch
&
p
,
41
const
DimensionedField<vector, volMesh>
& iF
42
)
43
:
44
fixedValueFvPatchField<vector>
(
p
, iF),
45
origin_(
vector::zero
),
46
axis_(
vector::zero
),
47
omega_(0)
48
{}
49
50
51
rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
52
(
53
const
rotatingWallVelocityFvPatchVectorField
& ptf,
54
const
fvPatch
& p,
55
const
DimensionedField<vector, volMesh>
& iF,
56
const
fvPatchFieldMapper
& mapper
57
)
58
:
59
fixedValueFvPatchField<vector>
(ptf,
p
, iF, mapper),
60
origin_(ptf.origin_),
61
axis_(ptf.axis_),
62
omega_(ptf.omega_)
63
{}
64
65
66
rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
67
(
68
const
fvPatch
& p,
69
const
DimensionedField<vector, volMesh>
& iF,
70
const
dictionary
& dict
71
)
72
:
73
fixedValueFvPatchField<vector>
(
p
, iF),
74
origin_(dict.
lookup
(
"origin"
)),
75
axis_(dict.
lookup
(
"axis"
)),
76
omega_(
readScalar
(dict.
lookup
(
"omega"
)))
77
{
78
// Evaluate the wall velocity
79
updateCoeffs();
80
}
81
82
83
rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
84
(
85
const
rotatingWallVelocityFvPatchVectorField
& pivpvf
86
)
87
:
88
fixedValueFvPatchField<vector>
(pivpvf),
89
origin_(pivpvf.origin_),
90
axis_(pivpvf.axis_),
91
omega_(pivpvf.omega_)
92
{}
93
94
95
rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
96
(
97
const
rotatingWallVelocityFvPatchVectorField
& pivpvf,
98
const
DimensionedField<vector, volMesh>
& iF
99
)
100
:
101
fixedValueFvPatchField<vector>
(pivpvf, iF),
102
origin_(pivpvf.origin_),
103
axis_(pivpvf.axis_),
104
omega_(pivpvf.omega_)
105
{}
106
107
108
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109
110
void
rotatingWallVelocityFvPatchVectorField::updateCoeffs
()
111
{
112
if
(updated())
113
{
114
return
;
115
}
116
117
// Calculate the rotating wall velocity from the specification of the motion
118
vectorField
Up = (-omega_)*((patch().Cf() - origin_) ^ (axis_/
mag
(axis_)));
119
120
// Remove the component of Up normal to the wall
121
// just in case it is not exactly circular
122
vectorField
n = patch().nf();
123
vectorField::operator=
(Up - n*(n & Up));
124
125
fixedValueFvPatchVectorField::updateCoeffs
();
126
}
127
128
129
void
rotatingWallVelocityFvPatchVectorField::write
(
Ostream
& os)
const
130
{
131
fvPatchVectorField::write
(os);
132
os.
writeKeyword
(
"origin"
) << origin_ <<
token::END_STATEMENT
<<
nl
;
133
os.
writeKeyword
(
"axis"
) << axis_ <<
token::END_STATEMENT
<<
nl
;
134
os.
writeKeyword
(
"omega"
) << omega_ <<
token::END_STATEMENT
<<
nl
;
135
writeEntry(
"value"
, os);
136
}
137
138
139
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140
141
makePatchTypeField
142
(
143
fvPatchVectorField
,
144
rotatingWallVelocityFvPatchVectorField
145
);
146
147
148
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150
}
// End namespace Foam
151
152
// ************************ vim: set sw=4 sts=4 et: ************************ //