swirlFanVelocityFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2018-2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::swirlFanVelocityFvPatchField
28 
29 Group
30  grpCoupledBoundaryConditions
31 
32 Description
33  This boundary condition provides a jump condition for U across a
34  cyclic pressure jump condition and applies a transformation to U.
35 
36  The U-jump is specified with a swirl component as follows:
37  \verbatim
38  Utan = deltaP/rEff/fanEff/(rpm*pi/30.0);
39 
40  where
41 
42  deltaP : pressure drop across the cyclic.
43  rEff : effective radius
44  fanEff : fan efficiency coefficient
45  rpm : RPM of the fan
46  \endverbatim
47 
48  Alternatively an inner and outer radii can be used instead of rEff. The
49  Utan is as follow for r > rInner and r < rOuter
50  \verbatim
51  Utan = deltaP/r/fanEff/(rpm/pi/30.0);
52 
53  where
54 
55  r : p - origin, p is the face center
56  \endverbatim
57 
58  Outside rInner and rOuter, Utan = 0. The input for this mode is:
59  \verbatim
60  useRealRadius true;
61  rInner 0.005;
62  rOuter 0.01;
63  \endverbatim
64 
65  The radial velocity is zero in the present model.
66 
67 Usage
68  \table
69  Property | Description | Required | Default
70  patchType | underlying patch type should be \c cyclic| yes |
71  phi | flux field name | no | phi
72  rho | density field name | no | rho
73  p | pressure field name | no | p
74  origin | fan centre | no | calculated
75  rpm | RPM of the fan | yes
76  fanEff | Fan efficiency | no | 1
77  rEff | Effective radius | no | 0
78  useRealRadius| Use inner/outer radii | no | false
79  rInner | Inner radius | no | 0
80  rOuter | Outer radius | no | 0
81  \endtable
82 
83  Example of the boundary condition specification:
84  \verbatim
85  <patchName>
86  {
87  cyclicFaces_master
88  {
89  type swirlFanVelocity;
90  patchType cyclic;
91  jump uniform (0 0 0);
92  value uniform (0 0 0);
93  rpm 1000;
94  rEff 0.01;
95  }
96  }
97  \endverbatim
98 
99 SourceFiles
100  swirlFanVelocityFvPatchField.C
101 
102 \*---------------------------------------------------------------------------*/
103 
104 #ifndef swirlFanVelocityFvPatchField_H
105 #define swirlFanVelocityFvPatchField_H
106 
107 #include "fixedJumpFvPatchField.H"
108 #include "Function1.H"
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 namespace Foam
113 {
114 
115 /*---------------------------------------------------------------------------*\
116  Class swirlFanVelocityFvPatchField Declaration
117 \*---------------------------------------------------------------------------*/
118 
119 class swirlFanVelocityFvPatchField
120 :
121  public fixedJumpFvPatchField<vector>
122 {
123  // Private data
124 
125  //- Name of the flux field
126  const word phiName_;
127 
128  //- Name of the pressure field
129  const word pName_;
130 
131  //- Name of the rho field
132  const word rhoName_;
133 
134  //- Origin of the rotation
135  const vector origin_;
136 
137  //- Fan rpm
138  autoPtr<Function1<scalar>> rpm_;
139 
140  //- Fan efficiency
141  scalar fanEff_;
142 
143  //- Effective fan radius
144  scalar rEff_;
145 
146  //- Inner radius
147  scalar rInner_;
148 
149  //- Outer radius
150  scalar rOuter_;
151 
152  //- Switch to use effective radius or inner and outer radius
153  bool useRealRadius_;
154 
155 
156  // Private Member Functions
157 
158  //- Calculate the fan pressure jump
159  void calcFanJump();
160 
161 
162 public:
163 
164  //- Runtime type information
165  TypeName("swirlFanVelocity");
166 
167 
168  // Constructors
169 
170  //- Construct from patch and internal field
172  (
173  const fvPatch&,
174  const DimensionedField<vector, volMesh>&
175  );
176 
177  //- Construct from patch, internal field and dictionary
179  (
180  const fvPatch&,
182  const dictionary&
183  );
184 
185  //- Construct by mapping given swirlFanVelocityFvPatchField
186  //- onto a new patch
188  (
190  const fvPatch&,
192  const fvPatchFieldMapper&
193  );
194 
195  //- Construct as copy
197  (
199  );
200 
201  //- Construct and return a clone
202  virtual tmp<fvPatchField<vector>> clone() const
203  {
205  (
207  );
208  }
209 
210  //- Construct as copy setting internal field reference
212  (
215  );
216 
217  //- Construct and return a clone setting internal field reference
219  (
221  ) const
222  {
224  (
225  new swirlFanVelocityFvPatchField(*this, iF)
226  );
227  }
228 
229 
230  // Member functions
231 
232  //- Update the coefficients associated with the patch field
233  virtual void updateCoeffs();
234 
235  //- Write
236  virtual void write(Ostream& os) const;
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 #endif
245 
246 // ************************************************************************* //
Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField
swirlFanVelocityFvPatchField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: swirlFanVelocityFvPatchField.C:129
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Function1.H
Foam::swirlFanVelocityFvPatchField::TypeName
TypeName("swirlFanVelocity")
Runtime type information.
Foam::swirlFanVelocityFvPatchField::clone
virtual tmp< fvPatchField< vector > > clone() const
Construct and return a clone.
Definition: swirlFanVelocityFvPatchField.H:260
Foam::fixedJumpFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base.
Definition: fixedJumpFvPatchField.H:111
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::swirlFanVelocityFvPatchField::write
virtual void write(Ostream &os) const
Write.
Definition: swirlFanVelocityFvPatchField.C:257
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector< scalar >
Foam::swirlFanVelocityFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: swirlFanVelocityFvPatchField.C:246
fixedJumpFvPatchField.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::swirlFanVelocityFvPatchField
This boundary condition provides a jump condition for U across a cyclic pressure jump condition and a...
Definition: swirlFanVelocityFvPatchField.H:177
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54