timeVaryingMassSorptionFvPatchScalarField.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) 2021 OpenCFD Ltd.
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::timeVaryingMassSorptionFvPatchScalarField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
33  This boundary condition provides a first order fixed-value condition
34  for a given scalar field to model time-dependent adsorption-desoprtion
35  processes to be used with the \c interfaceOxideRate mass model
36 
37  \f[
38  \frac{d c}{d t} =
39  k_{abs} w (c_{int} - c_{p_{w}}) + k_{des} (c_{p_{w}} - c_{int})
40  \f]
41 
42  \f[
43  w = \max(1 - c_{p_{w}}/max, 0)
44  \f]
45 
46  where
47  \vartable
48  c_{int} | Concentration at cell
49  c_{p_{w}} | Concentration at wall
50  k_{abs} | Adsorption rate constant [1/s]
51  k_{des} | Desorption rate constant [1/s]
52  w | Weight function
53  max | Max concentration at wall
54  \endvartable
55 
56 Usage
57  Example of the boundary condition specification:
58  \verbatim
59  <patchName>
60  {
61  // Mandatory entries
62  type timeVaryingMassSorption;
63  kbas <scalar>;
64  max <scalar>;
65 
66  // Optional entries
67  kdes <scalar>;
68 
69  // Inherited entries
70  ...
71  }
72  \endverbatim
73 
74  where the entries mean:
75  \table
76  Property | Description | Type | Reqd | Deflt
77  type | Type name: timeVaryingAdsorption | word | yes | -
78  kbas | Adsorption rate constant | scalar | yes | -
79  max | Maximum concentation at wall | scalar | yes | -
80  kdes | Desorption rate constant | scalar | no | 0
81  \endtable
82 
83  The inherited entries are elaborated in:
84  - \link fixedValueFvPatchFields.H \endlink
85 
86 SourceFiles
87  timeVaryingMassSorptionFvPatchScalarField.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef timeVaryingMassSorptionFvPatchScalarField_H
92 #define timeVaryingMassSorptionFvPatchScalarField_H
93 
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class timeVaryingMassSorptionFvPatchScalarField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class timeVaryingMassSorptionFvPatchScalarField
106 :
107  public fixedValueFvPatchScalarField
108 {
109  typedef timeVaryingMassSorptionFvPatchScalarField this_bctype;
110  typedef fixedValueFvPatchScalarField parent_bctype;
111 
112 public:
113 
114  // Public Enumeration
115 
116  //- Enumeration defining the available ddt schemes
117  enum ddtSchemeType
118  {
119  tsEuler,
121  tsBackward
122  };
123 
124 
125 private:
126 
127  // Private Data
128 
129  //- Time scheme type names
130  static const Enum<ddtSchemeType> ddtSchemeTypeNames_;
131 
132  //- Adsorption rate constant
133  scalar kabs_;
134 
135  //- Maximum level of adsorption of a given substance on patch
136  scalar max_;
137 
138  //- Desorption rate constant
139  scalar kdes_;
140 
141 
142 public:
143 
144  //- Runtime type information
145  TypeName("timeVaryingMassSorption");
146 
147 
148  // Constructors
149 
150  //- Construct from patch and internal field
152  (
153  const fvPatch&,
155  );
156 
157  //- Construct from patch, internal field and dictionary
159  (
160  const fvPatch&,
162  const dictionary&
163  );
164 
165  //- Construct by mapping onto a new patch
167  (
168  const this_bctype&,
169  const fvPatch&,
172  );
173 
174  //- Construct as copy setting internal field reference
176  (
177  const this_bctype&,
179  );
180 
181  //- No copy without an internal field
183 
184  //- Clone with an internal field reference
186  (
188  ) const
189  {
190  return fvPatchField<scalar>::Clone(*this, iF);
191  }
192 
193 
194  // Member Functions
195 
196  // Mapping
197 
198  //- Map (and resize as needed) from self given a mapping object
199  virtual void autoMap
200  (
201  const fvPatchFieldMapper&
202  );
203 
204  //- Reverse map the given fvPatchField onto this fvPatchField
205  virtual void rmap
206  (
207  const fvPatchScalarField&,
208  const labelList&
209  );
210 
211  // Help
212 
213  //- Return source rate
214  tmp<scalarField> source() const;
215 
216 
217  // Evaluation
218 
219  //- Update the coefficients associated with the patch field
220  virtual void updateCoeffs();
221 
222 
223  //- Write
224  virtual void write(Ostream&) const;
225 
226 
227  // Member Operators
228 
229  //- Inherit assignment
230  using parent_bctype::operator=;
231 };
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 } // End namespace Foam
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
timeVaryingMassSorptionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
TypeName("timeVaryingMassSorption")
Runtime type information.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:635
ddtSchemeType
Enumeration defining the available ddt schemes.
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
This boundary condition provides a first order fixed-value condition for a given scalar field to mode...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Namespace for OpenFOAM.