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-2024 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 basis of the table is specified according to the \c mode:
41 
42  - velocity: deltap = F(velocity per face) \[DEFAULT\]
43  - uniformVelocity: deltap = F(patch area-averaged velocity)
44  - volumeFlowRate: deltap = F(patch volume flow rate)
45  - nonDimensional: non-dim deltap = F(non-dim volume flow rate)
46 
47  Non-dimensional operation:
48 
49  As inputs it needs the fan RPM (rpm) and the mean diameter (dm).
50 
51  The non-dimensional U for the table is calculated as follows:
52 
53  \verbatim
54  phi = 120*Un/(PI^3*dm^3*rpm)
55  where:
56  dm is the mean diameter.
57  rpm is the RPM of the fan.
58  \endverbatim
59 
60  The non-dimensional pressure:
61 
62  \verbatim
63  Psi = 2 deltaP/(rho*(sqr(PI*omega*dm)))
64  where:
65  deltaP is the pressure drop
66  \endverbatim
67 
68  The non-dimensional table should be given as Psi = F(phi).
69 
70 Usage
71  \table
72  Property | Description | Required | Default
73  patchType | underlying patch type should be \c cyclic | yes |
74  mode | jump table operating mode (see above) | no | velocity
75  jumpTable | jump data, e.g. \c csvFile | yes |
76  phi | flux field name | no | phi
77  rho | density field name | no | rho
78  rpm | fan rpm (non-dimensional table) | no |
79  dm | mean diameter (non-dimensional table) | no |
80  \endtable
81 
82  Example of the boundary condition specification:
83  \verbatim
84  <patchName>
85  {
86  type fan;
87  patchType cyclic;
88  jumpTable csvFile;
89  mode velocity;
90 
91  jumpTableCoeffs
92  {
93  nHeaderLine 1;
94  refColumn 0;
95  componentColumns 1(1);
96  separator ",";
97  mergeSeparators no;
98  file "<constant>/UvsPressure";
99  }
100  value uniform 0;
101  }
102  \endverbatim
103 
104  The above example shows the use of a comma separated (CSV) file to specify
105  the jump condition.
106 
107 Note
108  The underlying \c patchType should be set to \c cyclic
109 
110 See also
111  Foam::Function1Types
112 
113 SourceFiles
114  fanFvPatchField.C
115  fanFvPatchFields.H
116  fanFvPatchFields.C
117 
118 \*---------------------------------------------------------------------------*/
119 
120 #ifndef foam_fanFvPatchField_H
121 #define foam_fanFvPatchField_H
122 
123 #include "uniformJumpFvPatchField.H"
124 #include "Function1.H"
125 #include "Enum.H"
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 namespace Foam
130 {
131 
132 /*---------------------------------------------------------------------------*\
133  Class fanFvPatchField Declaration
134 \*---------------------------------------------------------------------------*/
135 
136 template<class Type>
137 class fanFvPatchField
138 :
139  public uniformJumpFvPatchField<Type>
140 {
141 public:
142 
143  // Public Data Types
144 
145  //- Enumeration defining the operating modes
146  enum class operatingMode
147  {
148  VELOCITY,
150  VOL_FLOW_RATE,
152  };
153 
154  //- Names for the operating modes
155  static const Enum<operatingMode> operatingModeNames_;
156 
157 
158 private:
159 
160  // Private Data
161 
162  //- Operating mode
163  operatingMode operatingMode_;
164 
165  //- Name of the flux transporting the field
166  word phiName_;
167 
168  //- Name of the density field for normalising the mass flux if necessary
169  word rhoName_;
170 
171  //- Fan rpm (for non-dimensional curve)
173 
174  //- Fan mean diameter (for non-dimensional curve)
176 
177 
178  // Private Member Functions
179 
180  //- Calculate the fan pressure jump
181  void calcFanJump();
182 
184 public:
185 
186  //- Runtime type information
187  TypeName("fan");
188 
189 
190  // Constructors
191 
192  //- Construct from patch and internal field
194  (
195  const fvPatch&,
197  );
198 
199  //- Construct from patch, internal field and dictionary
201  (
202  const fvPatch&,
204  const dictionary&
205  );
206 
207  //- Construct by mapping given fanFvPatchField onto a new patch
209  (
210  const fanFvPatchField<Type>&,
211  const fvPatch&,
213  const fvPatchFieldMapper&
214  );
215 
216  //- Construct as copy
218  (
219  const fanFvPatchField<Type>&
220  );
221 
222  //- Construct as copy setting internal field reference
224  (
225  const fanFvPatchField<Type>&,
227  );
228 
229  //- Return a clone
230  virtual tmp<fvPatchField<Type>> clone() const
231  {
232  return fvPatchField<Type>::Clone(*this);
233  }
234 
235  //- Clone with an internal field reference
237  (
239  ) const
240  {
241  return fvPatchField<Type>::Clone(*this, iF);
242  }
243 
244 
245  // Member functions
246 
247  //- Update the coefficients associated with the patch field
248  virtual void updateCoeffs();
249 
250  //- Write
251  virtual void write(Ostream& os) const;
252 };
253 
254 
255 //- Specialisation of the jump-condition for the pressure
256 template<>
257 void fanFvPatchField<scalar>::calcFanJump();
258 
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 } // End namespace Foam
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #ifdef NoRepository
267  #include "fanFvPatchField.C"
268 #endif
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 #endif
273 
274 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
operatingMode
Enumeration defining the operating modes.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
static const Enum< operatingMode > operatingModeNames_
Names for the operating modes.
This boundary condition provides a jump condition, using the cyclic condition as a base...
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
TypeName("fan")
Runtime type information.
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &os) const
Write.
OBJstream os(runTime.globalPath()/outputName)
fanFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.