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-2019 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 an input variable across the baffle.
37  \f[
38  \phi_{Yi} = c A (\psi_i - \psi_{i,n})
39  \f]
40  where
41  \vartable
42  \phi_{Yi} | flux of the permeable species [kg/s]
43  c | transfer coefficient [kg/m^2/s/<input-dimensions>]
44  A | patch face area [m^2]
45  \psi_i | input variable on the patch []
46  \psi_{i,n} | input variable 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  input | Input variable used to drive the transfer; massFraction, \\
63  moleFraction or partialPressure | if c is non-zero | none
64  phi | Name of the flux field | no | phi
65  p | Name of the pressure field | no | p
66  \endtable
67 
68 See also
69  Foam::semiPermeableBaffleVelocityFvPatchVectorField
70 
71 SourceFiles
72  semiPermeableBaffleMassFractionFvPatchScalarField.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef semiPermeableBaffleMassFractionFvPatchScalarField_H
77 #define semiPermeableBaffleMassFractionFvPatchScalarField_H
78 
79 #include "mappedPatchBase.H"
80 #include "mixedFvPatchFields.H"
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 namespace Foam
85 {
86 
87 class basicSpecieMixture;
88 
89 /*---------------------------------------------------------------------------*\
90  Class semiPermeableBaffleMassFractionFvPatchScalarField Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 class semiPermeableBaffleMassFractionFvPatchScalarField
94 :
95  public mappedPatchBase,
96  public mixedFvPatchScalarField
97 {
98 public:
99 
100  //- Enumeration for the input variable driving the transfer
101  enum input
102  {
103  none,
104  massFraction,
105  moleFraction,
107  };
108 
109  //- Input variable type names
110  static const NamedEnum<input, 4> inputNames_;
111 
112 
113 private:
114 
115  // Private Data
116 
117  //- Transfer coefficient
118  const scalar c_;
119 
120  //- Input variable driving the transfer
121  const input input_;
122 
123  //- Name of the flux field
124  const word phiName_;
125 
126  //- Name of the pressure field. Only needed if mode is pressure.
127  const word pName_;
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("semiPermeableBaffleMassFraction");
134 
135 
136  // Static member functions
137 
138  //- Access the composition for the given database
139  static const basicSpecieMixture& composition(const objectRegistry& db);
140 
141 
142  // Constructors
143 
144  //- Construct from patch and internal field
146  (
147  const fvPatch&,
149  );
150 
151  //- Construct from patch, internal field and dictionary
153  (
154  const fvPatch&,
156  const dictionary&
157  );
158 
159  //- Construct by mapping given fixedValueTypeFvPatchField
160  // onto a new patch
162  (
164  const fvPatch&,
166  const fvPatchFieldMapper&
167  );
168 
169  //- Copy constructor
171  (
173  );
174 
175  //- Construct and return a clone
176  virtual tmp<fvPatchScalarField> clone() const
177  {
179  (
181  );
182  }
183 
184  //- Copy constructor setting internal field reference
186  (
189  );
190 
191  //- Construct and return a clone setting internal field reference
193  (
195  ) const
196  {
198  (
200  (
201  *this,
202  iF
203  )
204  );
205  }
206 
207 
208  // Member Functions
209 
210  // Evaluation functions
211 
212  //- Return the flux of this species through the baffle
213  tmp<scalarField> phiY() const;
214 
215  //- Update the coefficients associated with the patch field
216  virtual void updateCoeffs();
217 
218 
219  //- Write
220  virtual void write(Ostream&) const;
221 };
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 
231 #endif
232 
233 // ************************************************************************* //
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:158
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.
Specialization of basicMultiComponentMixture for a mixture consisting of a number for molecular speci...
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.
static const NamedEnum< input, 4 > inputNames_
Input variable type names.
static const basicSpecieMixture & composition(const objectRegistry &db)
Access the composition for the given database.
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
Registry of regIOobjects.
Namespace for OpenFOAM.