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 function | yes |
44  jumpTable | jump table function (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 fanPressureJump;
55  patchType cyclic;
56  fanCurve tableFile;
57  tableFileCoeffs
58  {
59  file "$FOAM_CASE/constant/pressureVsQ";
60  format csv;
61  nHeaderLine 1;
62  refColumn 0;
63  componentColumns 1(1);
64  separator ",";
65  mergeSeparators no;
66  outOfBounds clamp;
67  interpolationScheme linear;
68  }
69  value uniform 0;
70  }
71  \endverbatim
72 
73  The above example shows the use of a comma separated (CSV) file to specify
74  the jump condition.
75 
76 Note
77  The underlying \c patchType should be set to \c cyclic
78 
79 See also
80  Foam::Function1s
81 
82 SourceFiles
83  fanPressureJumpFvPatchScalarField.C
84 
85 \*---------------------------------------------------------------------------*/
86 
87 #ifndef fanPressureJumpFvPatchScalarField_H
88 #define fanPressureJumpFvPatchScalarField_H
89 
90 #include "fixedJumpFvPatchFields.H"
91 #include "Function1.H"
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 namespace Foam
96 {
97 
98 /*---------------------------------------------------------------------------*\
99  Class fanPressureJumpFvPatchScalarField Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 class fanPressureJumpFvPatchScalarField
103 :
104  public fixedJumpFvPatchScalarField
105 {
106  // Private Data
107 
108  //- Fan curve
109  autoPtr<Function1<scalar>> fanCurve_;
110 
111  //- Jump table (backward compatibility)
112  autoPtr<Function1<scalar>> jumpTable_;
113 
114  //- Set true to reverse jump direction
115  Switch reverse_;
116 
117  //- Name of the flux transporting the field
118  word phiName_;
119 
120  //- Name of the density field used to normalise the mass flux
121  // if necessary
122  word rhoName_;
123 
124 
125  // Private Member Functions
126 
127  //- Calculate the fan pressure jump
128  void calcFanJump();
129 
130 
131 public:
132 
133  //- Runtime type information
134  TypeName("fanPressureJump");
135 
137  // Constructors
138 
139  //- Construct from patch and internal field
141  (
142  const fvPatch&,
144  );
145 
146  //- Construct from patch, internal field and dictionary
148  (
149  const fvPatch&,
151  const dictionary&
152  );
153 
154  //- Construct by mapping given patch onto a new patch
156  (
158  const fvPatch&,
160  const fvPatchFieldMapper&
161  );
162 
163  //- Copy constructor
165  (
167  );
168 
169  //- Construct and return a clone
170  virtual tmp<fvPatchScalarField> clone() const
171  {
173  (
175  );
176  }
177 
178  //- Copy constructor setting internal field reference
180  (
183  );
184 
185  //- Construct and return a clone setting internal field reference
187  (
189  ) const
190  {
192  (
193  new fanPressureJumpFvPatchScalarField(*this, iF)
194  );
195  }
196 
197 
198  // Member Functions
199 
200  //- Update the coefficients associated with the patch field
201  virtual void updateCoeffs();
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
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:54
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.