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
cfdTools
general
SRF
derivedFvPatchFields
SRFFreestreamVelocityFvPatchVectorField
SRFFreestreamVelocityFvPatchVectorField.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-2011 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 "
SRFFreestreamVelocityFvPatchVectorField.H
"
27
#include <
OpenFOAM/addToRunTimeSelectionTable.H
>
28
#include <
finiteVolume/volFields.H
>
29
#include <
finiteVolume/surfaceFields.H
>
30
31
#include <
finiteVolume/SRFModel.H
>
32
33
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35
namespace
Foam
36
{
37
38
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39
40
SRFFreestreamVelocityFvPatchVectorField::SRFFreestreamVelocityFvPatchVectorField
41
(
42
const
fvPatch
&
p
,
43
const
DimensionedField<vector, volMesh>
& iF
44
)
45
:
46
inletOutletFvPatchVectorField(p, iF),
47
UInf_(
vector::zero
)
48
{}
49
50
51
SRFFreestreamVelocityFvPatchVectorField::SRFFreestreamVelocityFvPatchVectorField
52
(
53
const
SRFFreestreamVelocityFvPatchVectorField
& ptf,
54
const
fvPatch
& p,
55
const
DimensionedField<vector, volMesh>
& iF,
56
const
fvPatchFieldMapper
& mapper
57
)
58
:
59
inletOutletFvPatchVectorField(ptf, p, iF, mapper),
60
UInf_(ptf.UInf_)
61
{}
62
63
64
SRFFreestreamVelocityFvPatchVectorField::SRFFreestreamVelocityFvPatchVectorField
65
(
66
const
fvPatch
& p,
67
const
DimensionedField<vector, volMesh>
& iF,
68
const
dictionary
& dict
69
)
70
:
71
inletOutletFvPatchVectorField(p, iF),
72
UInf_(dict.
lookup
(
"UInf"
))
73
{
74
fvPatchVectorField::operator=
(
vectorField
(
"value"
, dict, p.
size
()));
75
}
76
77
78
SRFFreestreamVelocityFvPatchVectorField::SRFFreestreamVelocityFvPatchVectorField
79
(
80
const
SRFFreestreamVelocityFvPatchVectorField
& srfvpvf
81
)
82
:
83
inletOutletFvPatchVectorField(srfvpvf),
84
UInf_(srfvpvf.UInf_)
85
{}
86
87
88
SRFFreestreamVelocityFvPatchVectorField::SRFFreestreamVelocityFvPatchVectorField
89
(
90
const
SRFFreestreamVelocityFvPatchVectorField
& srfvpvf,
91
const
DimensionedField<vector, volMesh>
& iF
92
)
93
:
94
inletOutletFvPatchVectorField(srfvpvf, iF),
95
UInf_(srfvpvf.UInf_)
96
{}
97
98
99
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100
101
void
SRFFreestreamVelocityFvPatchVectorField::updateCoeffs
()
102
{
103
if
(updated())
104
{
105
return
;
106
}
107
108
// Get reference to the SRF model
109
const
SRF::SRFModel
& srf =
110
db().lookupObject<
SRF::SRFModel
>(
"SRFProperties"
);
111
112
scalar time = this->db().
time
().
value
();
113
scalar theta = time*
mag
(srf.
omega
().
value
());
114
115
refValue() =
116
cos
(theta)*UInf_ +
sin
(theta)*(srf.
axis
() ^ UInf_)
117
- srf.
velocity
(patch().Cf());
118
119
// Set the inlet-outlet choice based on the direction of the freestream
120
valueFraction() = 1.0 -
pos
(refValue() & patch().Sf());
121
122
mixedFvPatchField<vector>::updateCoeffs
();
123
}
124
125
126
void
SRFFreestreamVelocityFvPatchVectorField::write
(
Ostream
& os)
const
127
{
128
fvPatchVectorField::write
(os);
129
os.
writeKeyword
(
"UInf"
) << UInf_ <<
token::END_STATEMENT
<<
nl
;
130
writeEntry(
"value"
, os);
131
}
132
133
134
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135
136
makePatchTypeField
137
(
138
fvPatchVectorField
,
139
SRFFreestreamVelocityFvPatchVectorField
140
);
141
142
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144
}
// End namespace Foam
145
146
// ************************ vim: set sw=4 sts=4 et: ************************ //