1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Helper class to manage multi-component phase properties
35 \*---------------------------------------------------------------------------*/
37 #ifndef phaseProperties_H
38 #define phaseProperties_H
40 #include "NamedEnum.H"
43 #include "volFields.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class phaseProperties Declaration
52 \*---------------------------------------------------------------------------*/
60 //- Phase type enumeration
69 //- Corresponding word representations for phase type enumerations
70 static const NamedEnum<phaseType, 4> phaseTypeNames_;
80 //- State label (s), (l), (g) etc.
83 //- List of component names
86 //- List of component mass fractions
92 //- Map to carrier global id
93 labelList globalCarrierIds_;
96 // Private member functions
99 void setGlobalIds(const wordList& globalNames);
101 //- Set global carrier ids - attempts to map component names to global
103 void setGlobalCarrierIds(const wordList& carrierNames);
105 //- Check the total mass fraction
106 void checkTotalMassFraction() const;
108 //- Set the state label
109 word phaseToStateLabel(const phaseType pt) const;
119 //- Construct from Istream
120 phaseProperties(Istream&);
122 //- Construct as copy
123 phaseProperties(const phaseProperties&);
130 // Public member functions
132 //- Initialise the global ids
133 void initialiseGlobalIds
135 const wordList& gasNames,
136 const wordList& liquidNames,
137 const wordList& solidNames
143 //- Return const access to the phase type
144 phaseType phase() const;
146 //- Return const access to the phase state label
147 const word& stateLabel() const;
149 //- Return word representation of the phase type
150 word phaseTypeName() const;
152 //- Return the list of component names
153 const List<word>& names() const;
155 //- Return const access to a component name
156 const word& name(const label cmptI) const;
158 //- Return const access to all component mass fractions
159 const scalarField& Y() const;
161 //- Return non-const access to a component mass fraction
162 scalar& Y(const label cmptI);
164 //- Return const access to the global ids
165 const labelList& globalIds() const;
167 //- Return const access to the map to the carrier global ids
168 const labelList& globalCarrierIds() const;
170 //- Return the global id of a component in the local list by name
171 // Returns -1 if not found
172 label globalId(const word& cmptName) const;
174 //- Return the id of a component in the local list by name
175 // Returns -1 if not found
176 label id(const word& cmptName) const;
179 // IOstream Operators
181 friend Istream& operator>>(Istream&, phaseProperties&);
182 friend Ostream& operator<<(Ostream&, const phaseProperties&);
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 } // End namespace Foam
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 // ************************************************************************* //