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 {
98  // Private data
99 
100  //- Transfer coefficient
101  const scalar c_;
102 
103  //- Name of the flux field
104  const word phiName_;
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("semiPermeableBaffleMassFraction");
111 
112 
113  // Constructors
114 
115  //- Construct from patch and internal field
117  (
118  const fvPatch&,
119  const DimensionedField<scalar, volMesh>&
120  );
121 
122  //- Construct from patch, internal field and dictionary
124  (
125  const fvPatch&,
127  const dictionary&
128  );
129 
130  //- Construct by mapping given fixedValueTypeFvPatchField
131  // onto a new patch
133  (
135  const fvPatch&,
137  const fvPatchFieldMapper&
138  );
139 
140  //- Construct as copy
142  (
144  );
145 
146  //- Construct as copy setting internal field reference
148  (
151  );
152 
153  //- Return a clone
154  virtual tmp<fvPatchField<scalar>> clone() const
155  {
156  return fvPatchField<scalar>::Clone(*this);
157  }
158 
159  //- Clone with an internal field reference
161  (
163  ) const
164  {
165  return fvPatchField<scalar>::Clone(*this, iF);
166  }
167 
168 
169  // Member functions
170 
171  // Evaluation functions
172 
173  //- Return the flux of this species through the baffle
174  tmp<scalarField> phiY() const;
175 
176  //- Update the coefficients associated with the patch field
177  virtual void updateCoeffs();
178 
179 
180  //- Write
181  virtual void write(Ostream&) const;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 
192 #endif
193 
194 // ************************************************************************* //
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:129
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:597
A FieldMapper for finite-volume patch fields.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
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.