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-2024 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 
29  This boundary condition provides a porous baffle pressure jump condition,
30  using the \c cyclic condition as a base. The jump in pressure is defined
31  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 SourceFiles
77  porousBafflePressureFvPatchField.C
78 
79 \*---------------------------------------------------------------------------*/
80 
81 #ifndef porousBafflePressureFvPatchField_H
82 #define porousBafflePressureFvPatchField_H
83 
84 #include "fixedJumpFvPatchFields.H"
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 namespace Foam
89 {
90 
91 /*---------------------------------------------------------------------------*\
92  Class porousBafflePressureFvPatchField Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 class porousBafflePressureFvPatchField
96 :
97  public fixedJumpFvPatchScalarField
98 {
99  // Private Data
100 
101  //- Name of flux field (default = phi)
102  const word phiName_;
103 
104  //- Name of density field (default = rho)
105  const word rhoName_;
106 
107  //- Darcy pressure loss coefficient
108  const scalar D_;
109 
110  //- Inertia pressure lost coefficient
111  const scalar I_;
112 
113  //- Porous media length
114  const scalar length_;
115 
116  //- Relaxation for pressure jump
117  const scalar relaxation_;
118 
119  //- Previous iteration "jump" field for relaxation
120  scalarField jump0_;
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("porousBafflePressure");
127 
128 
129  // Constructors
130 
131  //- Construct from patch, internal field and dictionary
133  (
134  const fvPatch&,
135  const DimensionedField<scalar, volMesh>&,
136  const dictionary&
137  );
138 
139  //- Construct by mapping given porousBafflePressureFvPatchField
140  // onto a new patch
142  (
144  const fvPatch&,
145  const DimensionedField<scalar, volMesh>&,
146  const fieldMapper&
147  );
148 
149  //- Disallow copy without setting internal field reference
151  (
153  ) = delete;
154 
155  //- Copy constructor setting internal field reference
157  (
160  );
161 
162  //- Construct and return a clone setting internal field reference
164  (
166  ) const
167  {
169  (
170  new porousBafflePressureFvPatchField(*this, iF)
171  );
172  }
173 
174 
175  // Member Functions
176 
177 
178  // Evaluation functions
179 
180  //- Update the coefficients associated with the patch field
181  virtual void updateCoeffs();
182 
183 
184  //- Write
185  virtual void write(Ostream&) const;
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
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
This boundary condition provides a porous baffle pressure jump condition, using the cyclic condition ...
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.
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.