fanFvPatchField.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fanFvPatchField
29 
30 Group
31  grpCoupledBoundaryConditions
32 
33 Description
34  This boundary condition provides a jump condition, using the \c cyclic
35  condition as a base.
36 
37  The jump is specified as a \c Function1 type, to enable the use of, e.g.
38  constant, polynomial, table values.
39 
40  The switch nonDimensional can be used for a non-dimensional table,
41  in combination with uniformJump = true.
42  As inputs it needs the fan RPM (rpm) and the mean diameter (dm).
43 
44  The non-dimensional U for the table is calculated as follows:
45 
46  \verbatim
47  phi = 120*Un/(PI^3*dm*rpm)
48  where:
49  dm is the mean diameter.
50  rpm is the RPM of the fan.
51  \endverbatim
52 
53  The non-dimensional pressure:
54 
55  \verbatim
56  Psi = 2 deltaP/(rho*(sqr(PI*omega*dm)))
57  where:
58  deltaP is the pressure drop
59  \endverbatim
60 
61  The non-dimensional table should be given as Psi = F(phi).
62 
63 Usage
64  \table
65  Property | Description | Required | Default
66  patchType | underlying patch type should be \c cyclic | yes |
67  jumpTable | jump data, e.g. \c csvFile | yes |
68  phi | flux field name | no | phi
69  rho | density field name | no | rho
70  uniformJump | apply uniform pressure based on avg velocity | no | false
71  nonDimensional | use non-dimensional table | no | false
72  rpm | fan rpm (non-dimensional table) | no | 0
73  dm | mean diameter (non-dimensional table) | no | 0
74  \endtable
75 
76  Example of the boundary condition specification:
77  \verbatim
78  <patchName>
79  {
80  type fan;
81  patchType cyclic;
82  jumpTable csvFile;
83 
84  jumpTableCoeffs
85  {
86  nHeaderLine 1;
87  refColumn 0;
88  componentColumns 1(1);
89  separator ",";
90  mergeSeparators no;
91  file "<constant>/UvsPressure";
92  }
93  value uniform 0;
94  }
95  \endverbatim
96 
97  The above example shows the use of a comma separated (CSV) file to specify
98  the jump condition.
99 
100 Note
101  The underlying \c patchType should be set to \c cyclic
102 
103 See also
104  Foam::Function1Types
105 
106 SourceFiles
107  fanFvPatchField.C
108  fanFvPatchFields.H
109  fanFvPatchFields.C
110  fanFvPatchFieldsFwd.H
111 
112 \*---------------------------------------------------------------------------*/
113 
114 #ifndef fanFvPatchField_H
115 #define fanFvPatchField_H
116 
117 #include "uniformJumpFvPatchField.H"
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 namespace Foam
122 {
123 
124 /*---------------------------------------------------------------------------*\
125  Class fanFvPatchField Declaration
126 \*---------------------------------------------------------------------------*/
127 
128 template<class Type>
129 class fanFvPatchField
130 :
131  public uniformJumpFvPatchField<Type>
132 {
133  // Private data
134 
135  //- Name of the flux transporting the field
136  word phiName_;
137 
138  //- Name of the density field for normalising the mass flux if necessary
139  word rhoName_;
140 
141  //- Apply uniform pressure drop
142  bool uniformJump_;
143 
144  //- Use non-dimensional curve
145  bool nonDimensional_;
146 
147  // Parameters for non-dimensional table
148 
149  //- Fan rpm
150  scalar rpm_;
151 
152  //- Fan mean diameter
153  scalar dm_;
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("fan");
166 
167 
168  // Constructors
169 
170  //- Construct from patch and internal field
172  (
173  const fvPatch&,
175  );
176 
177  //- Construct from patch, internal field and dictionary
179  (
180  const fvPatch&,
182  const dictionary&
183  );
184 
185  //- Construct by mapping given fanFvPatchField onto a new patch
187  (
188  const fanFvPatchField<Type>&,
189  const fvPatch&,
191  const fvPatchFieldMapper&
192  );
193 
194  //- Construct as copy
196  (
197  const fanFvPatchField<Type>&
198  );
199 
200  //- Construct and return a clone
201  virtual tmp<fvPatchField<Type>> clone() const
202  {
203  return tmp<fvPatchField<Type>>
204  (
205  new fanFvPatchField<Type>(*this)
206  );
207  }
208 
209  //- Construct as copy setting internal field reference
211  (
212  const fanFvPatchField<Type>&,
214  );
215 
216  //- Construct and return a clone setting internal field reference
218  (
220  ) const
221  {
222  return tmp<fvPatchField<Type>>
223  (
224  new fanFvPatchField<Type>(*this, iF)
225  );
226  }
227 
228 
229  // Member functions
230 
231  //- Update the coefficients associated with the patch field
232  virtual void updateCoeffs();
233 
234  //- Write
235  virtual void write(Ostream& os) const;
236 };
237 
238 
239 //- Specialisation of the jump-condition for the pressure
240 template<>
241 void fanFvPatchField<scalar>::calcFanJump();
242 
243 template<>
245 (
246  const fvPatch&,
248  const dictionary&
249 );
250 
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 } // End namespace Foam
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #ifdef NoRepository
259  #include "fanFvPatchField.C"
260 #endif
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #endif
265 
266 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fanFvPatchField::TypeName
TypeName("fan")
Runtime type information.
Foam::uniformJumpFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base....
Definition: uniformJumpFvPatchField.H:102
Foam::fanFvPatchField::write
virtual void write(Ostream &os) const
Write.
Definition: fanFvPatchField.C:156
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
fanFvPatchField.C
uniformJumpFvPatchField.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fanFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: fanFvPatchField.H:245
Foam::fanFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base.
Definition: fanFvPatchField.H:173
Foam::fanFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fanFvPatchField.C:141
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::fanFvPatchField::fanFvPatchField
fanFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: fanFvPatchField.C:47
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54