fanPressureFvPatchScalarField.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-2021 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::fanPressureFvPatchScalarField
29 
30 Group
31  grpInletBoundaryConditions grpOutletBoundaryConditions
32 
33 Description
34  This boundary condition can be applied to assign either a pressure inlet
35  or outlet total pressure condition for a fan.
36 
37  The switch nonDimensional can be used for a non-dimensional fan curve.
38  It needs inputs rpm and dm of the fan.
39 
40  The nonDimensional flux is calculate as :
41 
42  phi = 4.0*mDot/(rho*sqr(PI)*dm^3*omega)
43  where:
44  dm is the mean diameter.
45  omega is rad/sec.
46 
47  The nonDimensinal pressure :
48 
49  Psi = 2 deltaP/(rho*(sqr(PI*omega*dm)))
50  where:
51  deltaP is the pressure drop
52 
53  The non-dimensional table should be given as Psi = F(phi).
54 
55 Usage
56  \table
57  Property | Description | Required | Default
58  fanCurve | Pressure vs flow-rate | yes |
59  direction | direction of flow through fan [in/out] | yes |
60  p0 | environmental total pressure | yes |
61  nonDimensional | uses non-dimensional table | no | false
62  rpm | fan rpm for non-dimensional table | no |
63  dm | mean diameter for non-dimensional table | no |
64  file | fan curve file name | legacy |
65  outOfBounds | out of bounds handling | legacy |
66  \endtable
67 
68  Example of the boundary condition specification:
69  \verbatim
70  inlet
71  {
72  type fanPressure;
73  direction in;
74  fanCurve
75  {
76  type table;
77  file "<constant>/fanCurve";
78  outOfBounds clamp; // Optional out-of-bounds handling
79  }
80  p0 uniform 0;
81  value uniform 0;
82  }
83 
84  // Legacy specification
85  outlet
86  {
87  type fanPressure;
88  direction out;
89  file "<constant>/fanCurve";
90  outOfBounds clamp;
91  p0 uniform 0;
92  value uniform 0;
93  }
94  \endverbatim
95 
96 Note
97  For compatibility with older versions (OpenFOAM-v2006 and earlier),
98  a missing \c fanCurve keyword is treated as a tableFile and makes
99  the \c file keyword mandatory.
100 
101 See also
102  Foam::fanFvPatchField
103  Foam::totalPressureFvPatchScalarField
104  Foam::Function1
105 
106 SourceFiles
107  fanPressureFvPatchScalarField.C
108 
109 \*---------------------------------------------------------------------------*/
110 
111 #ifndef fanPressureFvPatchScalarField_H
112 #define fanPressureFvPatchScalarField_H
113 
115 #include "Function1.H"
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 namespace Foam
120 {
121 
122 /*---------------------------------------------------------------------------*\
123  Class fanPressureFvPatchScalarField Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 class fanPressureFvPatchScalarField
127 :
128  public totalPressureFvPatchScalarField
129 {
130 public:
131 
132  //- Fan flow direction
133  enum fanFlowDirection : uint8_t
134  {
135  ffdIn,
136  ffdOut
137  };
138 
139  //- Fan flow direction names
140  static const Enum<fanFlowDirection> fanFlowDirectionNames_;
141 
142 
143 private:
144 
145  // Private Data
146 
147  //- Run-time selectable fan curve
148  autoPtr<Function1<scalar>> fanCurve_;
149 
150  //- Direction of flow through the fan relative to patch
151  fanFlowDirection direction_;
152 
153  //- Use non-dimensional curve
154  bool nonDimensional_;
155 
156  //- Fan rpm (for non-dimensional curve)
157  autoPtr<Function1<scalar>> rpm_;
158 
159  //- Fan mean diameter (for non-dimensional curve)
160  autoPtr<Function1<scalar>> dm_;
161 
162 
163 public:
164 
165  //- Runtime type information
166  TypeName("fanPressure");
167 
168 
169  // Constructors
170 
171  //- Construct from patch and internal field
173  (
174  const fvPatch&,
176  );
177 
178  //- Construct from patch, internal field and dictionary
180  (
181  const fvPatch&,
183  const dictionary&
184  );
185 
186  //- Construct by mapping given
187  // fanPressureFvPatchScalarField
188  // onto a new patch
190  (
192  const fvPatch&,
194  const fvPatchFieldMapper&
195  );
196 
197  //- Construct as copy
199  (
201  );
202 
203  //- Construct and return a clone
204  virtual tmp<fvPatchScalarField> clone() const
205  {
207  (
209  );
210  }
211 
212  //- Construct as copy setting internal field reference
214  (
217  );
218 
219  //- Construct and return a clone setting internal field reference
221  (
223  ) const
224  {
226  (
228  (
229  *this,
230  iF
231  )
232  );
233  }
234 
235 
236  // Member functions
237 
238  //- Update the coefficients associated with the patch field
239  virtual void updateCoeffs();
240 
241  //- Write
242  virtual void write(Ostream& os) const;
243 };
244 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 } // End namespace Foam
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #endif
253 
254 // ************************************************************************* //
Foam::fanPressureFvPatchScalarField
This boundary condition can be applied to assign either a pressure inlet or outlet total pressure con...
Definition: fanPressureFvPatchScalarField.H:170
Foam::Enum< fanFlowDirection >
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fanPressureFvPatchScalarField::write
virtual void write(Ostream &os) const
Write.
Definition: fanPressureFvPatchScalarField.C:226
Function1.H
totalPressureFvPatchScalarField.H
Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
fanPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: fanPressureFvPatchScalarField.C:51
Foam::totalPressureFvPatchScalarField
This boundary condition provides a total pressure condition. Four variants are possible:
Definition: totalPressureFvPatchScalarField.H:256
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::fanPressureFvPatchScalarField::ffdIn
Definition: fanPressureFvPatchScalarField.H:179
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::fanPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: fanPressureFvPatchScalarField.H:248
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::fanPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fanPressureFvPatchScalarField.C:148
Foam::fanPressureFvPatchScalarField::TypeName
TypeName("fanPressure")
Runtime type information.
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::fanPressureFvPatchScalarField::fanFlowDirectionNames_
static const Enum< fanFlowDirection > fanFlowDirectionNames_
Fan flow direction names.
Definition: fanPressureFvPatchScalarField.H:184
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fanPressureFvPatchScalarField::fanFlowDirection
fanFlowDirection
Fan flow direction.
Definition: fanPressureFvPatchScalarField.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
Foam::fanPressureFvPatchScalarField::ffdOut
Definition: fanPressureFvPatchScalarField.H:180