porousBafflePressureFvPatchField.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) 2016 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::porousBafflePressureFvPatchField
29 
30 Group
31  grpCoupledBoundaryConditions
32 
33 Description
34  This boundary condition provides a jump condition, using the \c cyclic
35  condition as a base.
36 
37  The porous baffle introduces a pressure jump defined by:
38 
39  \f[
40  \Delta p = -(D \mu U + 0.5 I \rho |U|^2 )L
41  \f]
42 
43  where
44 
45  \vartable
46  p | pressure [Pa]
47  \rho | density [kg/m3]
48  \mu | laminar viscosity [Pa s]
49  D | Darcy coefficient
50  I | inertial coefficient
51  L | porous media length in the flow direction
52  \endvartable
53 
54 
55 Usage
56  \table
57  Property | Description | Required | Default value
58  patchType | underlying patch type should be \c cyclic| yes |
59  phi | flux field name | no | phi
60  rho | density field name | no | rho
61  D | Darcy coefficient | yes |
62  I | inertial coefficient | yes |
63  length | porous media length in the flow direction | yes |
64  uniformJump | applies a uniform pressure drop on the patch based on the
65  \endtable
66 
67  Example of the boundary condition specification:
68  \verbatim
69  <patchName>
70  {
71  type porousBafflePressure;
72  patchType cyclic;
73  jump uniform 0;
74  D 0.001;
75  I 1000000;
76  length 0.1;
77  uniformJump false;
78  value uniform 0;
79  }
80  \endverbatim
81 
82 Note
83  The underlying \c patchType should be set to \c cyclic
84 
85 SourceFiles
86  porousBafflePressureFvPatchField.C
87 
88 \*---------------------------------------------------------------------------*/
89 
90 #ifndef porousBafflePressureFvPatchField_H
91 #define porousBafflePressureFvPatchField_H
92 
93 #include "fixedJumpFvPatchField.H"
94 #include "Function1.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class porousBafflePressureFvPatchField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class porousBafflePressureFvPatchField
106 :
107  public fixedJumpFvPatchField<scalar>
108 {
109  // Private data
110 
111  //- Name of flux field (default = phi)
112  const word phiName_;
113 
114  //- Name of density field (default = rho)
115  const word rhoName_;
116 
117  //- Darcy pressure loss coefficient
118  autoPtr<Function1<scalar>> D_;
119 
120  //- Inertia pressure lost coefficient
121  autoPtr<Function1<scalar>> I_;
122 
123  //- Porous media length
124  scalar length_;
125 
126  //- Aplies uniform pressure drop
127  bool uniformJump_;
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("porousBafflePressure");
134 
135 
136  // Constructors
137 
138  //- Construct from patch and internal field
140  (
141  const fvPatch&,
142  const DimensionedField<scalar, volMesh>&
143  );
144 
145  //- Construct from patch, internal field and dictionary
147  (
148  const fvPatch&,
149  const DimensionedField<scalar, volMesh>&,
150  const dictionary&
151  );
152 
153  //- Construct by mapping given porousBafflePressureFvPatchField
154  // onto a new patch
156  (
158  const fvPatch&,
159  const DimensionedField<scalar, volMesh>&,
160  const fvPatchFieldMapper&
161  );
162 
163  //- Construct as copy
165  (
167  );
168 
169  //- Construct and return a clone
170  virtual tmp<fvPatchField<scalar>> clone() const
171  {
173  (
175  );
176  }
177 
178  //- Construct as copy setting internal field reference
180  (
183  );
184 
185  //- Construct and return a clone setting internal field reference
187  (
189  ) const
190  {
192  (
193  new porousBafflePressureFvPatchField(*this, iF)
194  );
195  }
196 
197 
198  // Member functions
199 
200 
201  // Evaluation functions
202 
203  //- Update the coefficients associated with the patch field
204  virtual void updateCoeffs();
205 
206 
207  //- Write
208  virtual void write(Ostream&) const;
209 };
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
Foam::porousBafflePressureFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: porousBafflePressureFvPatchField.C:197
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Function1.H
Foam::porousBafflePressureFvPatchField::clone
virtual tmp< fvPatchField< scalar > > clone() const
Construct and return a clone.
Definition: porousBafflePressureFvPatchField.H:231
Foam::fixedJumpFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base.
Definition: fixedJumpFvPatchField.H:111
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::porousBafflePressureFvPatchField
This boundary condition provides a jump condition, using the cyclic condition as a base.
Definition: porousBafflePressureFvPatchField.H:166
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
porousBafflePressureFvPatchField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: porousBafflePressureFvPatchField.C:37
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::porousBafflePressureFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: porousBafflePressureFvPatchField.C:126
Foam::porousBafflePressureFvPatchField::TypeName
TypeName("porousBafflePressure")
Runtime type information.
fixedJumpFvPatchField.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54