FreeFOAM The Cross-Platform CFD Toolkit
cylindricalInletVelocityFvPatchVectorField.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) 2010-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 the
13  Free Software Foundation; either version 3 of the License, or (at your
14  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, write to the Free Software Foundation,
23  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 \*---------------------------------------------------------------------------*/
26 
28 #include <finiteVolume/volFields.H>
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
36 Foam::
39 (
40  const fvPatch& p,
42 )
43 :
45  axialVelocity_(0),
46  centre_(pTraits<vector>::zero),
47  axis_(pTraits<vector>::zero),
48  rpm_(0),
49  radialVelocity_(0)
50 {}
51 
52 
53 Foam::
56 (
58  const fvPatch& p,
60  const fvPatchFieldMapper& mapper
61 )
62 :
63  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
64  axialVelocity_(ptf.axialVelocity_),
65  centre_(ptf.centre_),
66  axis_(ptf.axis_),
67  rpm_(ptf.rpm_),
68  radialVelocity_(ptf.radialVelocity_)
69 {}
70 
71 
72 Foam::
75 (
76  const fvPatch& p,
78  const dictionary& dict
79 )
80 :
82  axialVelocity_(readScalar(dict.lookup("axialVelocity"))),
83  centre_(dict.lookup("centre")),
84  axis_(dict.lookup("axis")),
85  rpm_(readScalar(dict.lookup("rpm"))),
86  radialVelocity_(readScalar(dict.lookup("radialVelocity")))
87 {}
88 
89 
90 Foam::
93 (
95 )
96 :
98  axialVelocity_(ptf.axialVelocity_),
99  centre_(ptf.centre_),
100  axis_(ptf.axis_),
101  rpm_(ptf.rpm_),
102  radialVelocity_(ptf.radialVelocity_)
103 {}
104 
105 
106 Foam::
109 (
112 )
113 :
115  axialVelocity_(ptf.axialVelocity_),
116  centre_(ptf.centre_),
117  axis_(ptf.axis_),
118  rpm_(ptf.rpm_),
119  radialVelocity_(ptf.radialVelocity_)
120 {}
121 
122 
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
124 
126 {
127  if (updated())
128  {
129  return;
130  }
131 
132  vector hatAxis = axis_/mag(axis_);
133 
134  vectorField r = (patch().Cf() - centre_);
135 
136  vectorField d = r - (hatAxis & r)*hatAxis;
137 
138  vectorField tangVelo =
139  (rpm_*mathematicalConstant::pi/30.0)*(hatAxis)^d;
140 
141  operator==(tangVelo + axis_*axialVelocity_ + radialVelocity_*d);
142 
144 }
145 
146 
148 {
150  os.writeKeyword("axialVelocity") << axialVelocity_ <<
152  os.writeKeyword("centre") << centre_ << token::END_STATEMENT << nl;
153  os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
154  os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
155  os.writeKeyword("radialVelocity") << radialVelocity_ <<
157  writeEntry("value", os);
158 }
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 namespace Foam
164 {
166  (
169  );
170 }
171 
172 
173 // ************************************************************************* //