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