porousBafflePressureFvPatchField.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::porousBafflePressureFvPatchField
26 
27 Description
28  This boundary condition provides a jump condition, using the \c cyclic
29  condition as a base.
30 
31  The porous baffle introduces a pressure jump defined by:
32 
33  \f[
34  \Delta p = -(D \mu U + 0.5 I \rho |U|^2 )L
35  \f]
36 
37  where
38 
39  \vartable
40  p | pressure [Pa]
41  \rho | density [kg/m^3]
42  \mu | laminar viscosity [Pa s]
43  D | Darcy coefficient
44  I | inertial coefficient
45  L | porous media length in the flow direction
46  \endvartable
47 
48 
49 Usage
50  \table
51  Property | Description | Required | Default value
52  patchType | underlying patch type should be \c cyclic| yes |
53  phi | flux field name | no | phi
54  rho | density field name | no | rho
55  D | Darcy coefficient | yes |
56  I | inertial coefficient | yes |
57  length | porous media length in the flow direction | yes |
58  relaxation | Relaxation factor for pressure jump | no | 1
59  \endtable
60 
61  Example of the boundary condition specification:
62  \verbatim
63  <patchName>
64  {
65  type porousBafflePressure;
66  patchType cyclic;
67  jump uniform 0;
68  D 0.001;
69  I 1000000;
70  length 0.1;
71  relaxation 0.2;
72  value uniform 0;
73  }
74  \endverbatim
75 
76  Note:
77  The underlying \c patchType should be set to \c cyclic
78 
79 SourceFiles
80  porousBafflePressureFvPatchField.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef porousBafflePressureFvPatchField_H
85 #define porousBafflePressureFvPatchField_H
86 
87 #include "fixedJumpFvPatchField.H"
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 namespace Foam
92 {
93 
94 /*---------------------------------------------------------------------------*\
95  Class porousBafflePressureFvPatchField Declaration
96 \*---------------------------------------------------------------------------*/
97 
98 class porousBafflePressureFvPatchField
99 :
100  public fixedJumpFvPatchField<scalar>
101 {
102  // Private Data
103 
104  //- Name of flux field (default = phi)
105  const word phiName_;
106 
107  //- Name of density field (default = rho)
108  const word rhoName_;
109 
110  //- Darcy pressure loss coefficient
111  scalar D_;
112 
113  //- Inertia pressure lost coefficient
114  scalar I_;
115 
116  //- Porous media length
117  scalar length_;
118 
119  //- Relaxation for pressure jump
120  scalar relaxation_;
121 
122  //- Previous iteration "jump" field for relaxation
123  scalarField jump0_;
124 
125 
126 public:
127 
128  //- Runtime type information
129  TypeName("porousBafflePressure");
130 
131 
132  // Constructors
133 
134  //- Construct from patch, internal field and dictionary
136  (
137  const fvPatch&,
138  const DimensionedField<scalar, volMesh>&,
139  const dictionary&
140  );
141 
142  //- Construct by mapping given porousBafflePressureFvPatchField
143  // onto a new patch
145  (
147  const fvPatch&,
148  const DimensionedField<scalar, volMesh>&,
149  const fvPatchFieldMapper&
150  );
151 
152  //- Disallow copy without setting internal field reference
154  (
156  ) = delete;
157 
158  //- Copy constructor setting internal field reference
160  (
163  );
164 
165  //- Construct and return a clone setting internal field reference
167  (
169  ) const
170  {
172  (
173  new porousBafflePressureFvPatchField(*this, iF)
174  );
175  }
176 
177 
178  // Member Functions
179 
180 
181  // Evaluation functions
182 
183  //- Update the coefficients associated with the patch field
184  virtual void updateCoeffs();
185 
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
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:203
This boundary condition provides a jump condition, using the cyclic condition as a base.
TypeName("porousBafflePressure")
Runtime type information.
porousBafflePressureFvPatchField(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.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.