fanPressureFvPatchScalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fanPressureFvPatchScalarField
26 
27 Description
28  This boundary condition can be applied to assign either a pressure inlet
29  or outlet total pressure condition for a fan.
30 
31 Usage
32  \table
33  Property | Description | Required | Default value
34  fanCurve | fan curve function | yes |
35  p0 | environmental total pressure | yes |
36  \endtable
37 
38  Example of the boundary condition specification:
39  \verbatim
40  inlet
41  {
42  type fanPressure;
43  fanCurve table;
44  fanCurveCoeffs
45  {
46  file "$FOAM_CASE/constant/pressureVsQ";
47  format csv;
48  nHeaderLine 1;
49  columns (0 1);
50  separator ",";
51  mergeSeparators no;
52  outOfBounds clamp;
53  interpolationScheme linear;
54  }
55  direction in;
56  p0 uniform 0;
57  value uniform 0;
58  }
59 
60  outlet
61  {
62  type fanPressure;
63  fanCurve table;
64  fanCurveCoeffs
65  {
66  file "$FOAM_CASE/constant/pressureVsQ";
67  format csv;
68  nHeaderLine 1;
69  columns (0 1);
70  separator ",";
71  mergeSeparators no;
72  outOfBounds clamp;
73  interpolationScheme linear;
74  }
75  direction out;
76  p0 uniform 0;
77  value uniform 0;
78  }
79  \endverbatim
80 
81  The above example shows the use of a comma separated (CSV) file to specify
82  the condition.
83 
84 See also
85  Foam::totalPressureFvPatchScalarField
86  Foam::Function1s
87 
88 SourceFiles
89  fanPressureFvPatchScalarField.C
90 
91 \*---------------------------------------------------------------------------*/
92 
93 #ifndef fanPressureFvPatchScalarField_H
94 #define fanPressureFvPatchScalarField_H
95 
97 #include "Function1.H"
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 namespace Foam
102 {
103 
104 /*---------------------------------------------------------------------------*\
105  Class fanPressureFvPatchScalarField Declaration
106 \*---------------------------------------------------------------------------*/
107 
108 class fanPressureFvPatchScalarField
109 :
110  public totalPressureFvPatchScalarField
111 {
112 public:
113 
114  // Public Enumerations
115 
116  //- Fan flow direction
117  enum fanFlowDirection
118  {
119  ffdIn,
120  ffdOut
121  };
122 
123  //- Fan flow directions names
125 
126 
127 private:
128 
129  // Private Data
130 
131  //- Fan curve
132  const autoPtr<Function1<scalar>> fanCurve_;
133 
134  //- Direction of flow through the fan relative to patch
135  const fanFlowDirection direction_;
136 
137 
138 public:
139 
140  //- Runtime type information
141  TypeName("fanPressure");
142 
143 
144  // Constructors
145 
146  //- Construct from patch, internal field and dictionary
148  (
149  const fvPatch&,
151  const dictionary&
152  );
153 
154  //- Construct by mapping given fanPressureFvPatchScalarField
155  // onto a new patch
157  (
159  const fvPatch&,
161  const fieldMapper&
162  );
163 
164  //- Disallow copy without setting internal field reference
166  (
168  ) = delete;
169 
170  //- Copy constructor setting internal field reference
172  (
175  );
176 
177  //- Construct and return a clone setting internal field reference
179  (
181  ) const
182  {
184  (
186  (
187  *this,
188  iF
189  )
190  );
191  }
192 
193 
194  // Member Functions
195 
196  //- Update the coefficients associated with the patch field
197  virtual void updateCoeffs();
198 
199  //- Write
200  virtual void write(Ostream&) const;
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
This boundary condition can be applied to assign either a pressure inlet or outlet total pressure con...
virtual void write(Ostream &) const
Write.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
TypeName("fanPressure")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
fanPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
static const NamedEnum< fanFlowDirection, 2 > fanFlowDirectionNames_
Fan flow directions names.
Abstract base class for field mapping.
Definition: fieldMapper.H:48
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.