fanPressureJumpFvPatchScalarField.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-2019 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::fanPressureJumpFvPatchScalarField
26 
27 Description
28  This boundary condition provides a pressure jump condition, using
29  the \c cyclic condition as a base.
30 
31  The jump is specified as a \c Function1 type, to enable the use of, e.g.
32  constant, polynomial, table values. This boundary condition can operate
33  in two modes - standard and backward compatibility.
34  In standard mode, jump is specified as a function of total volumetric
35  flow rate through the patch. In backward compatibility mode, the boundary
36  conditions serves as a direct replacement for the fanFvPatchField, where
37  jump is defined as a function of local velocity.
38 
39 Usage
40  \table
41  Property | Description | Required | Default value
42  patchType | underlying patch type should be \c cyclic| yes |
43  fanCurve | fan curve, e.g. \c csvFile | yes |
44  jumpTable | jump data (backward compatibility mode) | no |
45  reverse | reverse jump direction | no | false
46  phi | flux field name | no | phi
47  rho | density field name | no | rho
48  \endtable
49 
50  Example of the boundary condition specification:
51  \verbatim
52  <patchName>
53  {
54  type fan;
55  patchType cyclic;
56  fanCurve csvFile;
57  csvFileCoeffs
58  {
59  hasHeaderLine 1;
60  refColumn 0;
61  componentColumns 1(1);
62  separator ",";
63  file "$FOAM_CASE/constant/pressureVsQ";
64  }
65  value uniform 0;
66  }
67  \endverbatim
68 
69  The above example shows the use of a comma separated (CSV) file to specify
70  the jump condition.
71 
72 Note
73  The underlying \c patchType should be set to \c cyclic
74 
75 See also
76  Foam::Function1Types
77 
78 SourceFiles
79  fanPressureJumpFvPatchScalarField.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef fanPressureJumpFvPatchScalarField_H
84 #define fanPressureJumpFvPatchScalarField_H
85 
86 #include "fixedJumpFvPatchFields.H"
87 #include "Function1.H"
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 namespace Foam
92 {
93 
94 /*---------------------------------------------------------------------------*\
95  Class fanPressureJumpFvPatchScalarField Declaration
96 \*---------------------------------------------------------------------------*/
97 
98 class fanPressureJumpFvPatchScalarField
99 :
100  public fixedJumpFvPatchScalarField
101 {
102  // Private Data
103 
104  //- Fan curve
105  autoPtr<Function1<scalar>> fanCurve_;
106 
107  //- Jump table (backward compatibility)
108  autoPtr<Function1<scalar>> jumpTable_;
109 
110  //- Set true to reverse jump direction
111  Switch reverse_;
112 
113  //- Name of the flux transporting the field
114  word phiName_;
115 
116  //- Name of the density field used to normalise the mass flux
117  // if necessary
118  word rhoName_;
119 
120 
121  // Private Member Functions
122 
123  //- Calculate the fan pressure jump
124  void calcFanJump();
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("fanPressureJump");
131 
133  // Constructors
134 
135  //- Construct from patch and internal field
137  (
138  const fvPatch&,
140  );
141 
142  //- Construct from patch, internal field and dictionary
144  (
145  const fvPatch&,
147  const dictionary&
148  );
149 
150  //- Construct by mapping given patch onto a new patch
152  (
154  const fvPatch&,
156  const fvPatchFieldMapper&
157  );
158 
159  //- Copy constructor
161  (
163  );
164 
165  //- Construct and return a clone
166  virtual tmp<fvPatchScalarField> clone() const
167  {
169  (
171  );
172  }
173 
174  //- Copy constructor setting internal field reference
176  (
179  );
180 
181  //- Construct and return a clone setting internal field reference
183  (
185  ) const
186  {
188  (
189  new fanPressureJumpFvPatchScalarField(*this, iF)
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 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
This boundary condition provides a pressure jump condition, using the cyclic condition as a base...
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:53
fanPressureJumpFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.
TypeName("fanPressureJump")
Runtime type information.