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 |
73  dm | mean diameter (non-dimensional table) | no |
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 #include "Function1.H"
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 namespace Foam
123 {
124 
125 /*---------------------------------------------------------------------------*\
126  Class fanFvPatchField Declaration
127 \*---------------------------------------------------------------------------*/
128 
129 template<class Type>
130 class fanFvPatchField
131 :
132  public uniformJumpFvPatchField<Type>
133 {
134  // Private Data
135 
136  //- Name of the flux transporting the field
137  word phiName_;
138 
139  //- Name of the density field for normalising the mass flux if necessary
140  word rhoName_;
141 
142  //- Apply uniform pressure drop
143  bool uniformJump_;
144 
145  //- Use non-dimensional curve
146  bool nonDimensional_;
147 
148  //- Fan rpm (for non-dimensional curve)
149  autoPtr<Function1<scalar>> rpm_;
150 
151  //- Fan mean diameter (for non-dimensional curve)
152  autoPtr<Function1<scalar>> dm_;
153 
154 
155  // Private Member Functions
156 
157  //- Calculate the fan pressure jump
158  void calcFanJump();
159 
160 
161 public:
162 
163  //- Runtime type information
164  TypeName("fan");
165 
166 
167  // Constructors
168 
169  //- Construct from patch and internal field
171  (
172  const fvPatch&,
173  const DimensionedField<Type, volMesh>&
174  );
175 
176  //- Construct from patch, internal field and dictionary
178  (
179  const fvPatch&,
181  const dictionary&
182  );
183 
184  //- Construct by mapping given fanFvPatchField onto a new patch
186  (
187  const fanFvPatchField<Type>&,
188  const fvPatch&,
190  const fvPatchFieldMapper&
191  );
192 
193  //- Construct as copy
195  (
196  const fanFvPatchField<Type>&
197  );
198 
199  //- Construct and return a clone
200  virtual tmp<fvPatchField<Type>> clone() const
201  {
202  return tmp<fvPatchField<Type>>
203  (
204  new fanFvPatchField<Type>(*this)
205  );
206  }
207 
208  //- Construct as copy setting internal field reference
210  (
211  const fanFvPatchField<Type>&,
213  );
214 
215  //- Construct and return a clone setting internal field reference
217  (
219  ) const
220  {
221  return tmp<fvPatchField<Type>>
222  (
223  new fanFvPatchField<Type>(*this, iF)
224  );
225  }
226 
227 
228  // Member functions
229 
230  //- Update the coefficients associated with the patch field
231  virtual void updateCoeffs();
232 
233  //- Write
234  virtual void write(Ostream& os) const;
235 };
236 
237 
238 //- Specialisation of the jump-condition for the pressure
239 template<>
240 void fanFvPatchField<scalar>::calcFanJump();
241 
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 } // End namespace Foam
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #ifdef NoRepository
250  #include "fanFvPatchField.C"
251 #endif
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 #endif
256 
257 // ************************************************************************* //
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::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:174
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:123
os
OBJstream os(runTime.globalPath()/outputName)
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:244
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::fanFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base.
Definition: fanFvPatchField.H:174
Foam::fanFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fanFvPatchField.C:159
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