semiPermeableBaffleMassFractionFvPatchScalarField.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) 2017 OpenFOAM Foundation
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::semiPermeableBaffleMassFractionFvPatchScalarField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
33  This is a mass-fraction boundary condition for a semi-permeable baffle.
34 
35  This condition models a baffle which is permeable to a some species and
36  impermeable to others. It must be used in conjunction with the
37  corresponding velocity condition,
38  semiPermeableBaffleVelocityFvPatchVectorField.
39 
40  The mass flux of a species is calculated as a coefficient multiplied by the
41  difference in mass fraction across the baffle.
42  \f[
43  \phi_{Yi} = c A (Y_i - Y_{i,n})
44  \f]
45  where
46  \vartable
47  \phi_{Yi} | flux of the permeable species [kg/s]
48  c | transfer coefficient [kg/m2/s]
49  A | patch face area [m2]
50  Y_i | mass fraction on the patch []
51  Y_{i,n} | mass fraction on the neighbour patch []
52  \endvartable
53 
54  A species that the baffle is permable to will, therefore, have a
55  coefficient greater than zero, whilst a species that does not transfer will
56  have a coefficient equal to zero.
57 
58  This condition calculates the species flux. The fluxes are summed up by the
59  velocity consition to generate the net mass transfer across the baffle.
60  This mass-fraction condition then generates a corrective diffusive flux to
61  ensure that the correct amounts of the permeable species are transferred.
62 
63 Usage
64  \table
65  Property | Description | Req'd? | Default
66  c | Transfer coefficient | no | 0
67  phi | Name of the flux field | no | phi
68  \endtable
69 
70 See also
71  Foam::semiPermeableBaffleVelocityFvPatchVectorField
72 
73 SourceFiles
74  semiPermeableBaffleMassFractionFvPatchScalarField.C
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef semiPermeableBaffleMassFractionFvPatchScalarField_H
79 #define semiPermeableBaffleMassFractionFvPatchScalarField_H
80 
81 #include "mappedPatchBase.H"
82 #include "mixedFvPatchFields.H"
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 namespace Foam
87 {
88 
89 /*---------------------------------------------------------------------------*\
90  Class semiPermeableBaffleMassFractionFvPatchScalarField Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 class semiPermeableBaffleMassFractionFvPatchScalarField
94 :
95  public mappedPatchBase,
96  public mixedFvPatchScalarField
97 {
99  typedef mixedFvPatchScalarField parent_bctype;
100 
101  // Private Data
102 
103  //- Transfer coefficient
104  const scalar c_;
105 
106  //- Name of the flux field
107  const word phiName_;
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("semiPermeableBaffleMassFraction");
114 
115 
116  // Constructors
117 
118  //- Construct from patch and internal field
120  (
121  const fvPatch&,
122  const DimensionedField<scalar, volMesh>&
123  );
124 
125  //- Construct from patch, internal field and dictionary
127  (
128  const fvPatch&,
130  const dictionary&
131  );
132 
133  //- Construct by mapping onto a new patch
135  (
136  const this_bctype&,
137  const fvPatch&,
139  const fvPatchFieldMapper&
140  );
141 
142  //- Construct as copy setting internal field reference
144  (
145  const this_bctype&,
147  );
148 
149  //- No copy without an internal field
151  (
152  const this_bctype&
153  ) = delete;
154 
155  //- Clone with an internal field reference
157  (
159  ) const
160  {
161  return fvPatchField<scalar>::Clone(*this, iF);
162  }
163 
164 
165  // Member functions
166 
167  // Evaluation functions
168 
169  //- Return the flux of this species through the baffle
170  tmp<scalarField> phiY() const;
171 
172  //- Update the coefficients associated with the patch field
173  virtual void updateCoeffs();
174 
175 
176  //- Write
177  virtual void write(Ostream&) const;
178 
179 
180  // Member Operators
181 
182  //- Inherit assignment
183  using parent_bctype::operator=;
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 
194 #endif
195 
196 // ************************************************************************* //
semiPermeableBaffleMassFractionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
This is a mass-fraction boundary condition for a semi-permeable baffle.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:635
A FieldMapper for finite-volume patch fields.
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
tmp< scalarField > phiY() const
Return the flux of this species through the baffle.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
TypeName("semiPermeableBaffleMassFraction")
Runtime type information.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.