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