FreeFOAM The Cross-Platform CFD Toolkit
SRFVelocityFvPatchVectorField.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>
29 
30 #include <finiteVolume/SRFModel.H>
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 (
41  const fvPatch& p,
43 )
44 :
45  fixedValueFvPatchVectorField(p, iF),
46  relative_(0),
47  inletValue_(p.size(), vector::zero)
48 {}
49 
50 
52 (
54  const fvPatch& p,
56  const fvPatchFieldMapper& mapper
57 )
58 :
59  fixedValueFvPatchVectorField(ptf, p, iF, mapper),
60  relative_(ptf.relative_),
61  inletValue_(ptf.inletValue_, mapper)
62 {}
63 
64 
66 (
67  const fvPatch& p,
69  const dictionary& dict
70 )
71 :
72  fixedValueFvPatchVectorField(p, iF),
73  relative_(dict.lookup("relative")),
74  inletValue_("inletValue", dict, p.size())
75 {
76  fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
77 }
78 
79 
81 (
82  const SRFVelocityFvPatchVectorField& srfvpvf
83 )
84 :
85  fixedValueFvPatchVectorField(srfvpvf),
86  relative_(srfvpvf.relative_),
87  inletValue_(srfvpvf.inletValue_)
88 {}
89 
90 
92 (
93  const SRFVelocityFvPatchVectorField& srfvpvf,
95 )
96 :
97  fixedValueFvPatchVectorField(srfvpvf, iF),
98  relative_(srfvpvf.relative_),
99  inletValue_(srfvpvf.inletValue_)
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 
106 (
107  const fvPatchFieldMapper& m
108 )
109 {
111  inletValue_.autoMap(m);
112 }
113 
114 
116 (
117  const fvPatchVectorField& ptf,
118  const labelList& addr
119 )
120 {
121  fixedValueFvPatchVectorField::rmap(ptf, addr);
122 
123  const SRFVelocityFvPatchVectorField& tiptf =
124  refCast<const SRFVelocityFvPatchVectorField>(ptf);
125 
126  inletValue_.rmap(tiptf.inletValue_, addr);
127 }
128 
129 
131 {
132  if (updated())
133  {
134  return;
135  }
136 
137  // If not relative to the SRF include the effect of the SRF
138  if (!relative_)
139  {
140  // Get reference to the SRF model
141  const SRF::SRFModel& srf =
142  db().lookupObject<SRF::SRFModel>("SRFProperties");
143 
144  // Determine patch velocity due to SRF
145  const vectorField SRFVelocity = srf.velocity(patch().Cf());
146 
147  operator==(-SRFVelocity + inletValue_);
148  }
149  // If already relative to the SRF simply supply the inlet value as a fixed
150  // value
151  else
152  {
153  operator==(inletValue_);
154  }
155 
157 }
158 
159 
161 {
163  os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
164  inletValue_.writeEntry("inletValue", os);
165  writeEntry("value", os);
166 }
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
172 (
175 );
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // ************************ vim: set sw=4 sts=4 et: ************************ //