00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::phaseProperties 00026 00027 Description 00028 Helper class to manage multi-component phase properties 00029 00030 SourceFiles 00031 phaseProperties.C 00032 phasePropertiesIO.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef phaseProperties_H 00037 #define phaseProperties_H 00038 00039 #include <OpenFOAM/NamedEnum.H> 00040 #include <OpenFOAM/Tuple2.H> 00041 #include <OpenFOAM/PtrList.H> 00042 #include <finiteVolume/volFields.H> 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 /*---------------------------------------------------------------------------*\ 00050 Class phaseProperties Declaration 00051 \*---------------------------------------------------------------------------*/ 00052 00053 class phaseProperties 00054 { 00055 public: 00056 00057 // Public data 00058 00059 //- Phase type enumeration 00060 enum phaseType 00061 { 00062 GAS, 00063 LIQUID, 00064 SOLID, 00065 UNKNOWN 00066 }; 00067 00068 //- Corresponding word representations for phase type enumerations 00069 static const NamedEnum<phaseType, 4> phaseTypeNames_; 00070 00071 00072 private: 00073 00074 // Private data 00075 00076 //- Phase type 00077 phaseType phase_; 00078 00079 //- State label (s), (l), (g) etc. 00080 word stateLabel_; 00081 00082 //- List of component names 00083 List<word> names_; 00084 00085 //- List of component mass fractions 00086 scalarField Y_; 00087 00088 //- Global ids 00089 labelList globalIds_; 00090 00091 //- Map to carrier global id 00092 labelList globalCarrierIds_; 00093 00094 00095 // Private member functions 00096 00097 //- Set global ids 00098 void setGlobalIds(const wordList& globalNames); 00099 00100 //- Set global carrier ids - attempts to map component names to global 00101 // carrier species 00102 void setGlobalCarrierIds(const wordList& carrierNames); 00103 00104 //- Check the total mass fraction 00105 void checkTotalMassFraction() const; 00106 00107 //- Set the state label 00108 word phaseToStateLabel(const phaseType pt) const; 00109 00110 00111 public: 00112 00113 // Constructors 00114 00115 //- Null constructor 00116 phaseProperties(); 00117 00118 //- Construct from Istream 00119 phaseProperties(Istream&); 00120 00121 //- Construct as copy 00122 phaseProperties(const phaseProperties&); 00123 00124 00125 //- Destructor 00126 ~phaseProperties(); 00127 00128 00129 // Public member functions 00130 00131 //- Initialise the global ids 00132 void initialiseGlobalIds 00133 ( 00134 const wordList& gasNames, 00135 const wordList& liquidNames, 00136 const wordList& solidNames 00137 ); 00138 00139 00140 // Access 00141 00142 //- Return const access to the phase type 00143 phaseType phase() const; 00144 00145 //- Return const access to the phase state label 00146 const word& stateLabel() const; 00147 00148 //- Return word representation of the phase type 00149 word phaseTypeName() const; 00150 00151 //- Return the list of component names 00152 const List<word>& names() const; 00153 00154 //- Return const access to a component name 00155 const word& name(const label cmptI) const; 00156 00157 //- Return const access to all component mass fractions 00158 const scalarField& Y() const; 00159 00160 //- Return non-const access to a component mass fraction 00161 scalar& Y(const label cmptI); 00162 00163 //- Return const access to the global ids 00164 const labelList& globalIds() const; 00165 00166 //- Return const access to the map to the carrier global ids 00167 const labelList& globalCarrierIds() const; 00168 00169 //- Return the global id of a component in the local list by name 00170 // Returns -1 if not found 00171 label globalId(const word& cmptName) const; 00172 00173 //- Return the id of a component in the local list by name 00174 // Returns -1 if not found 00175 label id(const word& cmptName) const; 00176 00177 00178 // IOstream Operators 00179 00180 friend Istream& operator>>(Istream&, phaseProperties&); 00181 friend Ostream& operator<<(Ostream&, const phaseProperties&); 00182 }; 00183 00184 00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00186 00187 } // End namespace Foam 00188 00189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00190 00191 #endif 00192 00193 // ************************ vim: set sw=4 sts=4 et: ************************ //