FreeFOAM The Cross-Platform CFD Toolkit
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 
28 #include <finiteVolume/volFields.H>
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 (
40  const fvPatch& p,
42 )
43 :
45  origin_(vector::zero),
46  axis_(vector::zero),
47  omega_(0)
48 {}
49 
50 
52 (
54  const fvPatch& p,
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 
67 (
68  const fvPatch& p,
70  const dictionary& dict
71 )
72 :
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 
84 (
86 )
87 :
89  origin_(pivpvf.origin_),
90  axis_(pivpvf.axis_),
91  omega_(pivpvf.omega_)
92 {}
93 
94 
96 (
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 
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 
126 }
127 
128 
130 {
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 
142 (
145 );
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // ************************ vim: set sw=4 sts=4 et: ************************ //