FreeFOAM The Cross-Platform CFD Toolkit
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 
28 #include <finiteVolume/volFields.H>
30 
31 #include <finiteVolume/SRFModel.H>
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
41 (
42  const fvPatch& p,
44 )
45 :
46  inletOutletFvPatchVectorField(p, iF),
47  UInf_(vector::zero)
48 {}
49 
50 
52 (
54  const fvPatch& p,
56  const fvPatchFieldMapper& mapper
57 )
58 :
59  inletOutletFvPatchVectorField(ptf, p, iF, mapper),
60  UInf_(ptf.UInf_)
61 {}
62 
63 
65 (
66  const fvPatch& p,
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 
79 (
81 )
82 :
83  inletOutletFvPatchVectorField(srfvpvf),
84  UInf_(srfvpvf.UInf_)
85 {}
86 
87 
89 (
92 )
93 :
94  inletOutletFvPatchVectorField(srfvpvf, iF),
95  UInf_(srfvpvf.UInf_)
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
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 
123 }
124 
125 
127 {
129  os.writeKeyword("UInf") << UInf_ << token::END_STATEMENT << nl;
130  writeEntry("value", os);
131 }
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
137 (
140 );
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // ************************ vim: set sw=4 sts=4 et: ************************ //