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-2023 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 table;
57  fanCurveCoeffs
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 
136 
137  // Constructors
138 
139  //- Construct from patch, internal field and dictionary
141  (
142  const fvPatch&,
144  const dictionary&
145  );
146 
147  //- Construct by mapping given patch onto a new patch
149  (
151  const fvPatch&,
153  const fvPatchFieldMapper&
154  );
155 
156  //- Disallow copy without setting internal field reference
158  (
160  ) = delete;
161 
162  //- Copy constructor setting internal field reference
164  (
167  );
168 
169  //- Construct and return a clone setting internal field reference
171  (
173  ) const
174  {
176  (
177  new fanPressureJumpFvPatchScalarField(*this, iF)
178  );
179  }
180 
181 
182  // Member Functions
183 
184  //- Update the coefficients associated with the patch field
185  virtual void updateCoeffs();
186 
187  //- Write
188  virtual void write(Ostream&) const;
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
This boundary condition provides a pressure jump condition, using the cyclic condition as a base.
fanPressureJumpFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("fanPressureJump")
Runtime type information.
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
Foam::fvPatchFieldMapper.
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.