CompositionModel.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::CompositionModel
29
30Group
31 grpLagrangianIntermediateCompositionSubModels
32
33Description
34 Templated reacting parcel composition model class
35 Consists of carrier species (via thermo package), and additional liquids
36 and solids
37
38SourceFiles
39 CompositionModel.C
40 CompositionModelNew.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef CompositionModel_H
45#define CompositionModel_H
46
47#include "CloudSubModelBase.H"
48#include "IOdictionary.H"
49#include "autoPtr.H"
51
52#include "PtrList.H"
53#include "SLGThermo.H"
54
55#include "phasePropertiesList.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62/*---------------------------------------------------------------------------*\
63 Class CompositionModel Declaration
64\*---------------------------------------------------------------------------*/
65
66template<class CloudType>
68:
69 public CloudSubModelBase<CloudType>
70{
71 // Private data
72
73 //- Reference to the thermo database
74 const SLGThermo& thermo_;
75
76 //- List of phase properties
77 phasePropertiesList phaseProps_;
78
79
80public:
81
82 //- Runtime type information
83 TypeName("compositionModel");
84
85 //- Declare runtime constructor selection table
87 (
88 autoPtr,
91 (
92 const dictionary& dict,
94 ),
95 (dict, owner)
96 );
97
98
99 // Constructors
100
101 //- Construct null from owner
103
104 //- Construct from dictionary
106 (
107 const dictionary& dict,
109 const word& type
110 );
111
112 //- Construct copy
114
115 //- Construct and return a clone
116 virtual autoPtr<CompositionModel<CloudType>> clone() const = 0;
117
118
119 //- Destructor
120 virtual ~CompositionModel();
121
122
123 //- Selector
125 (
126 const dictionary& dict,
128 );
129
130
131 // Member Functions
132
133 // Access
134
135 //- Return the thermo database
136 const SLGThermo& thermo() const;
137
138
139 // Composition lists
140
141 //- Return the carrier components (wrapper function)
142 const basicSpecieMixture& carrier() const;
143
144 //- Return the global (additional) liquids
145 const liquidMixtureProperties& liquids() const;
146
147 //- Return the global (additional) solids
148 const solidMixtureProperties& solids() const;
149
150 //- Return the list of phase properties
151 const phasePropertiesList& phaseProps() const;
152
153 //- Return the number of phases
154 label nPhase() const;
155
156
157 // Phase properties
158
159 //- Return the list of phase type names
160 // If only 1 phase, return the component names of that phase
161 const wordList& phaseTypes() const;
162
163 //- Return the list of state labels (s), (l), (g) etc.
164 const wordList& stateLabels() const;
165
166 //- Return the list of component names for phaseI
167 const wordList& componentNames(const label phaseI) const;
168
169 //- Return global id of component cmptName in carrier thermo
170 label carrierId
171 (
172 const word& cmptName,
173 const bool allowNotFound = false
174 ) const;
175
176 //- Return local id of component cmptName in phase phaseI
177 label localId
178 (
179 const label phaseI,
180 const word& cmptName,
181 const bool allowNotFound = false
182 ) const;
183
184 //- Return carrier id of component given local id
185 label localToCarrierId
186 (
187 const label phaseI,
188 const label id,
189 const bool allowNotFound = false
190 ) const;
191
192 //- Return the list of phase phaseI mass fractions
193 const scalarField& Y0(const label phaseI) const;
194
195 //- Return the list of phase phaseI volume fractions fractions
196 // based on supplied mass fractions Y
198 (
199 const label phaseI,
200 const scalarField& Y
201 ) const;
202
203
204 // Mixture properties
205
206 //- Return the list of mixture mass fractions
207 // If only 1 phase, return component fractions of that phase
208 virtual const scalarField& YMixture0() const = 0;
209
210 // Indices of gas, liquid and solid phases in phase properties
211 // list - returns -1 if not applicable
212
213 //- Gas id
214 virtual label idGas() const = 0;
215
216 //- Liquid id
217 virtual label idLiquid() const = 0;
218
219 //- Solid id
220 virtual label idSolid() const = 0;
221
222
223 // Evaluation
224
225 //- Return total enthalpy for the phase phaseI
226 virtual scalar H
227 (
228 const label phaseI,
229 const scalarField& Y,
230 const scalar p,
231 const scalar T
232 ) const;
233
234 //- Return sensible enthalpy for the phase phaseI
235 virtual scalar Hs
236 (
237 const label phaseI,
238 const scalarField& Y,
239 const scalar p,
240 const scalar T
241 ) const;
242
243 //- Return chemical enthalpy for the phase phaseI
244 virtual scalar Hc
245 (
246 const label phaseI,
247 const scalarField& Y,
248 const scalar p,
249 const scalar T
250 ) const;
251
252 //- Return specific heat capacity for the phase phaseI
253 virtual scalar Cp
254 (
255 const label phaseI,
256 const scalarField& Y,
257 const scalar p,
258 const scalar T
259 ) const;
260
261 //- Return latent heat for the phase phaseI
262 virtual scalar L
263 (
264 const label phaseI,
265 const scalarField& Y,
266 const scalar p,
267 const scalar T
268 ) const;
269
270 //- Return rho of the full composition
271 virtual scalar rho
272 (
273 const scalarField& Ygas,
274 const scalarField& Yliq,
275 const scalarField& Ysol,
276 const scalar T,
277 const scalar p
278 ) const;
279};
280
281
282// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283
284} // End namespace Foam
285
286// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288#define makeCompositionModel(CloudType) \
289 \
290 typedef Foam::CloudType::reactingCloudType reactingCloudType; \
291 defineNamedTemplateTypeNameAndDebug \
292 ( \
293 Foam::CompositionModel<reactingCloudType>, \
294 0 \
295 ); \
296 namespace Foam \
297 { \
298 defineTemplateRunTimeSelectionTable \
299 ( \
300 CompositionModel<reactingCloudType>, \
301 dictionary \
302 ); \
303 }
304
306#define makeCompositionModelType(SS, CloudType) \
307 \
308 typedef Foam::CloudType::reactingCloudType reactingCloudType; \
309 defineNamedTemplateTypeNameAndDebug(Foam::SS<reactingCloudType>, 0); \
310 \
311 Foam::CompositionModel<reactingCloudType>:: \
312 adddictionaryConstructorToTable<Foam::SS<reactingCloudType>> \
313 add##SS##CloudType##reactingCloudType##ConstructorToTable_;
314
315
316// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317
318#ifdef NoRepository
319 #include "CompositionModel.C"
320#endif
321
322// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
323
324#endif
325
326// ************************************************************************* //
Base class for cloud sub-models.
const CloudType & owner() const
Return const access to the owner cloud.
Templated reacting parcel composition model class Consists of carrier species (via thermo package),...
const liquidMixtureProperties & liquids() const
Return the global (additional) liquids.
virtual label idLiquid() const =0
Liquid id.
TypeName("compositionModel")
Runtime type information.
virtual scalar H(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return total enthalpy for the phase phaseI.
const wordList & stateLabels() const
Return the list of state labels (s), (l), (g) etc.
virtual const scalarField & YMixture0() const =0
Return the list of mixture mass fractions.
const phasePropertiesList & phaseProps() const
Return the list of phase properties.
virtual autoPtr< CompositionModel< CloudType > > clone() const =0
Construct and return a clone.
tmp< scalarField > X(const label phaseI, const scalarField &Y) const
Return the list of phase phaseI volume fractions fractions.
const basicSpecieMixture & carrier() const
Return the carrier components (wrapper function)
const SLGThermo & thermo() const
Return the thermo database.
virtual ~CompositionModel()
Destructor.
const wordList & componentNames(const label phaseI) const
Return the list of component names for phaseI.
label nPhase() const
Return the number of phases.
virtual scalar Hc(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return chemical enthalpy for the phase phaseI.
declareRunTimeSelectionTable(autoPtr, CompositionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
label localToCarrierId(const label phaseI, const label id, const bool allowNotFound=false) const
Return carrier id of component given local id.
virtual scalar Hs(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return sensible enthalpy for the phase phaseI.
virtual label idSolid() const =0
Solid id.
virtual label idGas() const =0
Gas id.
static autoPtr< CompositionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
const solidMixtureProperties & solids() const
Return the global (additional) solids.
label localId(const label phaseI, const word &cmptName, const bool allowNotFound=false) const
Return local id of component cmptName in phase phaseI.
label carrierId(const word &cmptName, const bool allowNotFound=false) const
Return global id of component cmptName in carrier thermo.
const scalarField & Y0(const label phaseI) const
Return the list of phase phaseI mass fractions.
const wordList & phaseTypes() const
Return the list of phase type names.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: SLGThermo.H:67
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Specialization of basicMultiComponentMixture for a mixture consisting of a number for molecular speci...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Simple container for a list of phase properties.
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
PtrList< volScalarField > & Y
const volScalarField & Cp
Definition: EEqn.H:7
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
const vector L(dict.get< vector >("L"))