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-2022 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,
35  using the \c cyclic 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  \vartable
45  p | pressure [Pa]
46  \rho | density [kg/m3]
47  \mu | laminar viscosity [Pa s]
48  D | Darcy coefficient
49  I | inertial coefficient
50  L | porous media length in the flow direction
51  \endvartable
52 
53 Usage
54  Example of the boundary condition specification:
55  \verbatim
56  <patchName>
57  {
58  // Mandatory entries
59  type porousBafflePressure;
60  D 0.001;
61  I 1000000;
62  length 0.1;
63 
64  // Optional entries
65  phi phi;
66  rho rho;
67  uniformJump false;
68  value uniform 0;
69 
70  // Inherited entries
71  patchType cyclic;
72  jump uniform 0;
73  ...
74  }
75  \endverbatim
76 
77  where the entries mean:
78  \table
79  Property | Description | Type | Reqd | Deflt
80  type | Type name: porousBafflePressure | word | yes | -
81  D | Darcy coefficient | Function1<scalar> | yes | -
82  I | Inertial coefficient | Function1<scalar> | yes | -
83  length | Porous media length in the flow direction <!--
84  --> | scalar | yes | -
85  uniformJump | Flag to apply a uniform pressure drop on <!--
86  --> the patch based on the | bool | no | false
87  phi | Name of flux field | word | no | phi
88  rho | Name of density field | word | no | rho
89  patchType | Underlying patch type should be \c cyclic | word | yes | -
90  jump | Jump value | scalarField | yes | -
91  \endtable
92 
93  The inherited entries are elaborated in:
94  - \link fixedJumpFvPatchField.H \endlink
95  - \link Function1.H \endlink
96 
97 Note
98  The underlying \c patchType should be set to \c cyclic.
99 
100 SourceFiles
101  porousBafflePressureFvPatchField.C
102 
103 \*---------------------------------------------------------------------------*/
104 
105 #ifndef porousBafflePressureFvPatchField_H
106 #define porousBafflePressureFvPatchField_H
107 
108 #include "fixedJumpFvPatchField.H"
109 #include "Function1.H"
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 namespace Foam
114 {
115 
116 /*---------------------------------------------------------------------------*\
117  Class porousBafflePressureFvPatchField Declaration
118 \*---------------------------------------------------------------------------*/
119 
120 class porousBafflePressureFvPatchField
121 :
122  public fixedJumpFvPatchField<scalar>
123 {
124  // Private Data
125 
126  //- Name of flux field (default = phi)
127  const word phiName_;
128 
129  //- Name of density field (default = rho)
130  const word rhoName_;
131 
132  //- Darcy pressure loss coefficient
133  autoPtr<Function1<scalar>> D_;
134 
135  //- Inertia pressure lost coefficient
136  autoPtr<Function1<scalar>> I_;
137 
138  //- Porous media length
139  scalar length_;
140 
141  //- Aplies uniform pressure drop
142  bool uniformJump_;
143 
144 
145 public:
146 
147  //- Runtime type information
148  TypeName("porousBafflePressure");
149 
150 
151  // Constructors
152 
153  //- Construct from patch and internal field
155  (
156  const fvPatch&,
157  const DimensionedField<scalar, volMesh>&
158  );
159 
160  //- Construct from patch, internal field and dictionary
162  (
163  const fvPatch&,
164  const DimensionedField<scalar, volMesh>&,
165  const dictionary&,
166  const bool valueRequired = true
167  );
168 
169  //- Construct by mapping given porousBafflePressureFvPatchField
170  //- onto a new patch
172  (
174  const fvPatch&,
175  const DimensionedField<scalar, volMesh>&,
176  const fvPatchFieldMapper&
177  );
178 
179  //- Construct as copy
181  (
183  );
184 
185  //- Construct and return a clone
186  virtual tmp<fvPatchField<scalar>> clone() const
187  {
188  return tmp<fvPatchField<scalar>>
189  (
191  );
192  }
193 
194  //- Construct as copy setting internal field reference
196  (
198  const DimensionedField<scalar, volMesh>&
199  );
200 
201  //- Construct and return a clone setting internal field reference
202  virtual tmp<fvPatchField<scalar>> clone
203  (
205  ) const
206  {
208  (
209  new porousBafflePressureFvPatchField(*this, iF)
210  );
211  }
212 
213 
214  // Member Functions
215 
216  // Evaluation
217 
218  //- Update the coefficients associated with the patch field
219  virtual void updateCoeffs();
220 
221  // I-O
222 
223  //- Write
224  virtual void write(Ostream&) const;
225 };
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
TypeName("porousBafflePressure")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual tmp< fvPatchField< scalar > > clone() const
Construct and return a clone.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
porousBafflePressureFvPatchField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.