enthalpySorptionFvPatchScalarField.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) 2022 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::enthalpySorptionFvPatchScalarField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
33  This is a temperature boundary condition which works
34  in conjunction with the \c speciesSorption condition for species.
35 
36  This boundary condition substracts or adds enthalpy associated with the
37  adsorption provided by the \c speciesSorption condition.
38 
39  It can handle two enthalpy models:
40 
41  1) Estimate
42  2) Calculated
43 
44  On top of this, the enthalpy associated with the sensible enthalpy
45  corresponding with the species transport can be added using \c includeHs.
46 
47 Usage
48  Example of the boundary condition specification:
49  \verbatim
50  <patchName>
51  {
52  // Mandatory entries
53  type enthalpySorption;
54  enthalpyModel <word>;
55  species <word>;
56 
57  // Conditional mandatory entries
58 
59  // when enthalpyModel == calculated
60  enthalpyTable <Function1<scalar>>
61 
62  // enthalpyTable
63  // {
64  // type table;
65  // values ((0 0)(1 50));
66  // }
67 
68  // Optional entries
69  includeHs <bool>;
70  C <scalar>;
71  Hvap <scalar>;
72  dhdt <scalarField>;
73  p <word>;
74  T <word>;
75  }
76  \endverbatim
77 
78  where the entries mean:
79  \table
80  Property | Description | Type | Reqd | Deflt
81  type | Type name: enthalpySorption | word | yes | -
82  enthalpyModel | Adsorption enthalpy model | word | yes | -
83  species | Name of associated species | word | yes | -
84  enthalpyTable | Calculated enthalpy model table <!--
85  --> | Function1<scalar> | no | -
86  includeHs | Include sensible enthalpy | bool | no | true
87  C | Estimate enthalpy model constant | scalar | no | 0
88  Hvap | Evaporation heat for species | scalar | no | 0
89  p | Name of operand pressure field | word | no | p
90  T | Name of operand temperature field | word | no | T
91  dhdt | Enthalpy change on cells next to patch [J/kg] <!--
92  --> | scalarField | no | Zero
93  \endtable
94 
95  Options for the \c enthalpyModel entry:
96  \verbatim
97  estimated | Enthalpy is estimated
98  calculated | Enthalpy is calculated based on enthalpyTable
99  \endverbatim
100 
101  The inherited entries are elaborated in:
102  - \link zeroGradientFvPatchFields.H \endlink
103  - \link Function1.H \endlink
104 
105 SourceFiles
106  enthalpySorptionFvPatchScalarField.C
107 
108 \*---------------------------------------------------------------------------*/
109 
110 #ifndef Foam_enthalpySorptionFvPatchScalarField_H
111 #define Foam_enthalpySorptionFvPatchScalarField_H
112 
113 #include "boundarySourcePatch.H"
115 #include "Function1.H"
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 namespace Foam
120 {
121 
122 /*---------------------------------------------------------------------------*\
123  Class enthalpySorptionFvPatchScalarField Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 class enthalpySorptionFvPatchScalarField
127 :
128  public zeroGradientFvPatchField<scalar>,
129  public boundarySourcePatch
130 {
131  typedef enthalpySorptionFvPatchScalarField this_bctype;
132  typedef zeroGradientFvPatchField<scalar> parent_bctype;
133 
134  // Private Enumeration
135 
136  //- Options for the enthalpy model
137  enum enthalpyModelType : char
138  {
139  estimated,
140  calculated
141  };
142 
143  //- Names for enthalpyModelType
144  static const Enum<enthalpyModelType> enthalpyModelTypeNames;
145 
146 
147  // Private Data
148 
149  //- Enthalpy model
150  enum enthalpyModelType enthalpyModel_;
151 
152  //- Include sensible enthalpy of the species
153  bool includeHs_;
154 
155  //- Load enthalpy table for calculated model
156  autoPtr<Function1<scalar>> enthalpyMassLoadPtr_;
157 
158  //- Estimated enthalpy model constant
159  scalar C_;
160 
161  //- Heat of evaporation of species
162  scalar Hvap_;
163 
164  //- Name of operand species field
165  word speciesName_;
166 
167  //- Name of operand pressure field
168  word pName_;
169 
170  //- Name of operand temperature field
171  word TName_;
172 
173  //- Enthalpy change on cells next to patch [J/kg]
174  scalarField dhdt_;
175 
176 
177 public:
178 
179  //- Runtime type information
180  TypeName("enthalpySorption");
181 
182 
183  // Constructors
184 
185  //- Construct from patch and internal field
187  (
188  const fvPatch&,
189  const DimensionedField<scalar, volMesh>&
190  );
192  //- Construct from patch, internal field and dictionary
194  (
195  const fvPatch&,
197  const dictionary&
198  );
199 
200  //- Construct by mapping onto a new patch
202  (
203  const this_bctype&,
204  const fvPatch&,
206  const fvPatchFieldMapper&
207  );
208 
209  //- Construct as copy setting internal field reference
211  (
212  const this_bctype&,
214  );
215 
216  //- No copy without an internal field
218  (
219  const this_bctype&
220  ) = delete;
221 
222  //- Clone with an internal field reference
224  (
226  ) const
227  {
228  return fvPatchField<scalar>::Clone(*this, iF);
229  }
230 
231 
232  // Member Functions
233 
234  // Mapping
235 
236  //- Map (and resize as needed) from self given a mapping object
237  virtual void autoMap
238  (
239  const fvPatchFieldMapper&
240  );
241 
242  //- Reverse map the given fvPatchField onto this fvPatchField
243  virtual void rmap
244  (
245  const fvPatchScalarField&,
246  const labelList&
247  );
248 
249 
250  // Evaluation
251 
252  //- Source of cells next to the patch
253  virtual tmp<scalarField> patchSource() const;
254 
255  //- Update the coefficients associated with the patch field
256  virtual void updateCoeffs();
257 
258 
259  // I-O
260 
261  //- Write
262  virtual void write(Ostream&) const;
263 
264 
265  // Member Operators
266 
267  //- Inherit assignment
269 };
270 
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 } // End namespace Foam
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 #endif
279 
280 // ************************************************************************* //
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
This is a temperature boundary condition which works in conjunction with the speciesSorption conditio...
enthalpySorptionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
friend Ostream & operator(Ostream &, const fvPatchField< scalar > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
TypeName("enthalpySorption")
Runtime type information.
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:635
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< scalarField > patchSource() const
Source of cells next to the patch.
Namespace for OpenFOAM.
virtual tmp< fvPatchField< scalar > > clone() const
No clone without an internal field reference.
Definition: fvPatchField.H:610