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&,
126  const DimensionedField<scalar, volMesh>&,
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 and return a clone
147  virtual tmp<fvPatchScalarField> clone() const
148  {
150  (
152  );
153  }
154 
155  //- Construct as copy setting internal field reference
157  (
160  );
161 
162  //- Construct and return a clone setting internal field reference
164  (
166  ) const
167  {
169  (
171  (
172  *this,
173  iF
174  )
175  );
176  }
177 
178 
179  // Member functions
180 
181  // Evaluation functions
182 
183  //- Return the flux of this species through the baffle
184  tmp<scalarField> phiY() const;
185 
186  //- Update the coefficients associated with the patch field
187  virtual void updateCoeffs();
188 
189 
190  //- Write
191  virtual void write(Ostream&) const;
192 };
193 
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 
202 #endif
203 
204 // ************************************************************************* //
Foam::semiPermeableBaffleMassFractionFvPatchScalarField
This is a mass-fraction boundary condition for a semi-permeable baffle.
Definition: semiPermeableBaffleMassFractionFvPatchScalarField.H:127
Foam::semiPermeableBaffleMassFractionFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: semiPermeableBaffleMassFractionFvPatchScalarField.C:170
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::semiPermeableBaffleMassFractionFvPatchScalarField::phiY
tmp< scalarField > phiY() const
Return the flux of this species through the baffle.
Definition: semiPermeableBaffleMassFractionFvPatchScalarField.C:123
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::mappedPatchBase
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
Definition: mappedPatchBase.H:112
Foam::semiPermeableBaffleMassFractionFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: semiPermeableBaffleMassFractionFvPatchScalarField.C:144
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::semiPermeableBaffleMassFractionFvPatchScalarField::semiPermeableBaffleMassFractionFvPatchScalarField
semiPermeableBaffleMassFractionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: semiPermeableBaffleMassFractionFvPatchScalarField.C:40
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::semiPermeableBaffleMassFractionFvPatchScalarField::TypeName
TypeName("semiPermeableBaffleMassFraction")
Runtime type information.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
mixedFvPatchFields.H
Foam::semiPermeableBaffleMassFractionFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: semiPermeableBaffleMassFractionFvPatchScalarField.H:181
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
mappedPatchBase.H