phaseProperties.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 | Copyright (C) 2011-2015 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::phaseProperties
26 
27 Description
28  Helper class to manage multi-specie phase properties
29 
30 SourceFiles
31  phaseProperties.C
32  phasePropertiesIO.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef phaseProperties_H
37 #define phaseProperties_H
38 
39 #include "NamedEnum.H"
40 #include "Tuple2.H"
41 #include "PtrList.H"
42 #include "volFields.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class phaseProperties Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class phaseProperties
54 {
55 public:
56 
57  // Public data
58 
59  //- Phase type enumeration
60  enum phaseType
61  {
62  GAS,
65  UNKNOWN
66  };
67 
68  //- Corresponding word representations for phase type enumerations
70 
71 
72 private:
73 
74  // Private data
75 
76  //- Phase type
78 
79  //- State label (s), (l), (g) etc.
81 
82  //- List of specie names
84 
85  //- List of specie mass fractions
87 
88  //- Map to carrier id
90 
91 
92  // Private Member Functions
93 
94  //- Reorder species to be consistent with the given specie name list
95  void reorder(const wordList& specieNames);
96 
97  //- Set carrier ids
98  void setCarrierIds(const wordList& carrierNames);
99 
100  //- Check the total mass fraction
101  void checkTotalMassFraction() const;
102 
103  //- Set the state label
104  word phaseToStateLabel(const phaseType pt) const;
105 
106 
107 public:
108 
109  // Constructors
110 
111  //- Null constructor
112  phaseProperties();
113 
114  //- Construct from Istream
116 
117  //- Construct as copy
119 
120 
121  //- Destructor
123 
124 
125  // Public Member Functions
126 
127  //- Reorder species to be consistent with the corresponding
128  // phase specie name list
129  void reorder
130  (
131  const wordList& gasNames,
132  const wordList& liquidNames,
133  const wordList& solidNames
134  );
135 
136 
137  // Access
138 
139  //- Return const access to the phase type
140  phaseType phase() const;
141 
142  //- Return const access to the phase state label
143  const word& stateLabel() const;
144 
145  //- Return word representation of the phase type
146  word phaseTypeName() const;
147 
148  //- Return the list of specie names
149  const List<word>& names() const;
150 
151  //- Return const access to a specie name
152  const word& name(const label speciei) const;
153 
154  //- Return const access to all specie mass fractions
155  const scalarField& Y() const;
156 
157  //- Return non-const access to a specie mass fraction
158  scalar& Y(const label speciei);
159 
160  //- Return const access to the map to the carrier ids
161  const labelList& carrierIds() const;
162 
163  //- Return the id of a specie in the local list by name
164  // Returns -1 if not found
165  label id(const word& specieName) const;
166 
167 
168  // IOstream Operators
169 
171  friend Ostream& operator<<(Ostream&, const phaseProperties&);
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
volFields.H
Foam::phaseProperties::~phaseProperties
~phaseProperties()
Destructor.
Definition: phaseProperties.C:208
Foam::phaseProperties::operator>>
friend Istream & operator>>(Istream &, phaseProperties &)
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::phaseProperties::LIQUID
@ LIQUID
Definition: phaseProperties.H:62
Foam::phaseProperties::names_
List< word > names_
List of specie names.
Definition: phaseProperties.H:82
Foam::phaseProperties::phaseTypeName
word phaseTypeName() const
Return word representation of the phase type.
Definition: phaseProperties.C:273
Tuple2.H
NamedEnum.H
Foam::phaseProperties::GAS
@ GAS
Definition: phaseProperties.H:61
Foam::phaseProperties::setCarrierIds
void setCarrierIds(const wordList &carrierNames)
Set carrier ids.
Definition: phaseProperties.C:104
Foam::phaseProperties
Helper class to manage multi-specie phase properties.
Definition: phaseProperties.H:52
Foam::phaseProperties::id
label id(const word &specieName) const
Return the id of a specie in the local list by name.
Definition: phaseProperties.C:325
Foam::phaseProperties::phaseToStateLabel
word phaseToStateLabel(const phaseType pt) const
Set the state label.
Definition: phaseProperties.C:151
Foam::phaseProperties::phase_
phaseType phase_
Phase type.
Definition: phaseProperties.H:76
Foam::phaseProperties::carrierIds
const labelList & carrierIds() const
Return const access to the map to the carrier ids.
Definition: phaseProperties.C:319
Foam::phaseProperties::names
const List< word > & names() const
Return the list of specie names.
Definition: phaseProperties.C:279
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::phaseProperties::Y_
scalarField Y_
List of specie mass fractions.
Definition: phaseProperties.H:85
Foam::phaseProperties::operator<<
friend Ostream & operator<<(Ostream &, const phaseProperties &)
Foam::phaseProperties::stateLabel_
word stateLabel_
State label (s), (l), (g) etc.
Definition: phaseProperties.H:79
Foam::phaseProperties::checkTotalMassFraction
void checkTotalMassFraction() const
Check the total mass fraction.
Definition: phaseProperties.C:132
Foam::phaseProperties::phaseTypeNames
static const NamedEnum< phaseType, 4 > phaseTypeNames
Corresponding word representations for phase type enumerations.
Definition: phaseProperties.H:68
Foam::phaseProperties::carrierIds_
labelList carrierIds_
Map to carrier id.
Definition: phaseProperties.H:88
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::phaseProperties::phaseProperties
phaseProperties()
Null constructor.
Definition: phaseProperties.C:186
Foam::phaseProperties::phaseType
phaseType
Phase type enumeration.
Definition: phaseProperties.H:59
Foam::List< word >
Foam::phaseProperties::UNKNOWN
@ UNKNOWN
Definition: phaseProperties.H:64
PtrList.H
Foam::phaseProperties::reorder
void reorder(const wordList &specieNames)
Reorder species to be consistent with the given specie name list.
Definition: phaseProperties.C:52
Foam::phaseProperties::stateLabel
const word & stateLabel() const
Return const access to the phase state label.
Definition: phaseProperties.C:267
Foam::phaseProperties::phase
phaseType phase() const
Return const access to the phase type.
Definition: phaseProperties.C:261
Foam::phaseProperties::SOLID
@ SOLID
Definition: phaseProperties.H:63
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::phaseProperties::name
const word & name(const label speciei) const
Return const access to a specie name.
Definition: phaseProperties.C:285
Foam::phaseProperties::Y
const scalarField & Y() const
Return const access to all specie mass fractions.
Definition: phaseProperties.C:299
Foam::NamedEnum< phaseType, 4 >