initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / intermediate / phaseProperties / phaseProperties / phaseProperties.H
blobeaa44b6afb59d4c0b90d2fd84c62738f739d1b16
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::phaseProperties
28 Description
29     Helper class to manage multi-component phase properties
31 SourceFiles
32     phaseProperties.C
33     phasePropertiesIO.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef phaseProperties_H
38 #define phaseProperties_H
40 #include "NamedEnum.H"
41 #include "Tuple2.H"
42 #include "PtrList.H"
43 #include "volFields.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                       Class phaseProperties Declaration
52 \*---------------------------------------------------------------------------*/
54 class phaseProperties
56 public:
58     // Public data
60         //- Phase type enumeration
61         enum phaseType
62         {
63             GAS,
64             LIQUID,
65             SOLID,
66             UNKNOWN
67         };
69         //- Corresponding word representations for phase type enumerations
70         static const NamedEnum<phaseType, 4> phaseTypeNames_;
73 private:
75    // Private data
77         //- Phase type
78         phaseType phase_;
80         //- State label (s), (l), (g) etc.
81         word stateLabel_;
83         //- List of component names
84         List<word> names_;
86         //- List of component mass fractions
87         scalarField Y_;
89         //- Global ids
90         labelList globalIds_;
92         //- Map to carrier global id
93         labelList globalCarrierIds_;
96     // Private member functions
98         //- Set global ids
99         void setGlobalIds(const wordList& globalNames);
101         //- Set global carrier ids - attempts to map component names to global
102         //  carrier species
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;
112 public:
114     // Constructors
116         //- Null constructor
117         phaseProperties();
119         //- Construct from Istream
120         phaseProperties(Istream&);
122         //- Construct as copy
123         phaseProperties(const phaseProperties&);
126     //- Destructor
127     ~phaseProperties();
130     // Public member functions
132         //- Initialise the global ids
133         void initialiseGlobalIds
134         (
135             const wordList& gasNames,
136             const wordList& liquidNames,
137             const wordList& solidNames
138         );
141         // Access
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #endif
194 // ************************************************************************* //