prghPermeableAlphaTotalPressureFvPatchScalarField.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) 2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::prghPermeableAlphaTotalPressureFvPatchScalarField
28 
29 Description
30  The \c prghPermeableAlphaTotalPressure is a mixed boundary condition
31  for the \c p_rgh variable in multiphase flows.
32 
33  It switches between an open boundary using the \c prghTotalPressure
34  boundary condition and a wall condition using the \c fixedFluxPressure
35  boundary condition.
36 
37  In the \c prghPermeableAlphaTotalPressure, an open condition is
38  applied when \c alpha is under a user-defined \c alphaMin value and a wall
39  condition is applied when \c alpha is larger than the \c alphaMin.
40 
41  This boundary condition can be used in conjunction with
42  \c pressurePermeableAlphaInletOutletVelocity for the \c U variable.
43 
44 Usage
45  Example of the boundary condition specification:
46  \verbatim
47  <patchName>
48  {
49  // Mandatory entries
50  type prghPermeableAlphaTotalPressure;
51  p uniform 0;
52 
53  // Optional entries
54  phi phi;
55  rho rho;
56  U U;
57  alphaName alpha.water;
58  alphaMin 0.01;
59 
60  // Inherited entries
61  value uniform 0;
62  ...
63  }
64  \endverbatim
65 
66  where the entries mean:
67  \table
68  Property | Description | Type | Reqd | Deflt
69  p | Total pressure | PatchFunction1<scalar> | yes | -
70  phi | Name of flux field | word | no | phi
71  rho | Name of density field | word | no | rho
72  U | Name of velocity field | word | no | U
73  alpha | Name of mixture field | word | no | none
74  alphaMin | Minimum alpha | scalar | no | 1
75  \endtable
76 
77  The inherited entries are elaborated in:
78  - \link mixedFvPatchFields.H \endlink
79  - \link PatchFunction1.H \endlink
80 
81 See also
82  - Foam::pressurePermeableAlphaInletOutletVelocityFvPatchVectorField
83  - Foam::mixedFvPatchVectorField
84  - Foam::prghTotalPressureFvPatchScalarField
85 
86 SourceFiles
87  prghPermeableAlphaTotalPressureFvPatchScalarField.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef prghPermeableAlphaTotalPressureFvPatchScalarField_H
92 #define prghPermeableAlphaTotalPressureFvPatchScalarField_H
93 
94 #include "mixedFvPatchField.H"
95 #include "volFields.H"
96 #include "surfaceFields.H"
97 #include "updateableSnGrad.H"
98 #include "PatchFunction1.H"
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 namespace Foam
103 {
104 
105 /*---------------------------------------------------------------------------*\
106  Class prghPermeableAlphaTotalPressureFvPatchScalarField Declaration
107 \*---------------------------------------------------------------------------*/
108 
109 class prghPermeableAlphaTotalPressureFvPatchScalarField
110 :
111  public mixedFvPatchField<scalar>,
112  public updateablePatchTypes::updateableSnGrad
113 {
114  // Private Data
115 
116  //- Total pressure field
117  autoPtr<PatchFunction1<scalar>> p0_;
118 
119  //- Name of the flux transporting the field
120  word phiName_;
121 
122  //- Name of the density field used to normalise the mass flux
123  word rhoName_;
124 
125  //- Name of the velocity field
126  word UName_;
127 
128  //- Name of the mixture VOF field (if used)
129  word alphaName_;
130 
131  //- Minimum alpha value to outlet blockage
132  scalar alphaMin_;
133 
134  //- Current time index (used for updating)
135  label curTimeIndex_;
136 
137 
138 public:
139 
140  //- Runtime type information
141  TypeName("prghPermeableAlphaTotalPressure");
142 
143 
144  // Constructors
145 
146  //- Construct from patch and internal field
148  (
149  const fvPatch&,
151  );
152 
153  //- Construct from patch, internal field and dictionary
155  (
156  const fvPatch&,
158  const dictionary&
159  );
160 
161  //- Construct by mapping given
162  //- prghPermeableAlphaTotalPressureFvPatchScalarField
163  //- onto a new patch
165  (
167  const fvPatch&,
169  const fvPatchFieldMapper&
170  );
171 
172  //- Construct as copy
174  (
176  );
177 
178  //- Construct and return a clone
179  virtual tmp<fvPatchField<scalar>> clone() const
180  {
182  (
183  new
185  );
186  }
187 
188  //- Construct as copy setting internal field reference
190  (
193  );
194 
195  //- Construct and return a clone setting internal field reference
197  (
199  ) const
200  {
202  (
203  new
205  (
206  *this,
207  iF
208  )
209  );
210  }
211 
212 
213  // Member Functions
214 
215  // Mapping
216 
217  //- Map (and resize as needed) from self given a mapping object
218  virtual void autoMap
219  (
221  );
222 
223  //- Reverse map the given fvPatchField onto this fvPatchField
224  virtual void rmap
225  (
226  const fvPatchScalarField&,
227  const labelList&
228  );
229 
230 
231  // Evaluation
232 
233  //- Update the coefficients associated with the patch field
234  virtual void updateCoeffs();
235 
236  //- Update the patch pressure gradient field from the given snGradp
237  virtual void updateSnGrad(const scalarField& snGradp);
238 
239 
240  //- Write
241  virtual void write(Ostream&) const;
242 };
243 
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 } // End namespace Foam
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 
252 #endif
253 
254 // ************************************************************************* //
Foam::fvPatchField< scalar >
volFields.H
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
PatchFunction1.H
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::updateSnGrad
virtual void updateSnGrad(const scalarField &snGradp)
Update the patch pressure gradient field from the given snGradp.
Definition: prghPermeableAlphaTotalPressureFvPatchScalarField.C:182
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField
The prghPermeableAlphaTotalPressure is a mixed boundary condition for the p_rgh variable in multiphas...
Definition: prghPermeableAlphaTotalPressureFvPatchScalarField.H:150
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::prghPermeableAlphaTotalPressureFvPatchScalarField
prghPermeableAlphaTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: prghPermeableAlphaTotalPressureFvPatchScalarField.C:37
surfaceFields.H
Foam::surfaceFields.
mixedFvPatchField.H
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: prghPermeableAlphaTotalPressureFvPatchScalarField.C:164
Foam::updateablePatchTypes::updateableSnGrad
Definition: updateableSnGrad.H:55
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: prghPermeableAlphaTotalPressureFvPatchScalarField.C:251
Foam::Field< scalar >
updateableSnGrad.H
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::clone
virtual tmp< fvPatchField< scalar > > clone() const
Construct and return a clone.
Definition: prghPermeableAlphaTotalPressureFvPatchScalarField.H:220
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::mixedFvPatchField
This boundary condition provides a base class for 'mixed' type boundary conditions,...
Definition: mixedFvPatchField.H:123
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::TypeName
TypeName("prghPermeableAlphaTotalPressure")
Runtime type information.
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: prghPermeableAlphaTotalPressureFvPatchScalarField.C:150
Foam::List< label >
Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: prghPermeableAlphaTotalPressureFvPatchScalarField.C:269
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