FreeFOAM The Cross-Platform CFD Toolkit
specie.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) 1991-2010 OpenCFD Ltd.
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::specie
26 
27 Description
28  Base class of the thermophysical property types.
29 
30 SourceFiles
31  specieI.H
32  specie.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef specie_H
37 #define specie_H
38 
39 #include <OpenFOAM/word.H>
40 #include <OpenFOAM/scalar.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class Istream;
48 class Ostream;
49 
50 /*---------------------------------------------------------------------------*\
51  Class specie Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class specie
55 {
56  // Private data
57 
58  //- Name of specie
59  word name_;
60 
61  //- Number of moles of this component in the mixture
62  scalar nMoles_;
63 
64  //- Molecular weight of specie [kg/kmol]
65  scalar molWeight_;
66 
67 
68  // Private member functions
69 
70  //- Construct from components without name
71  inline specie
72  (
73  const scalar nMoles,
74  const scalar molWeight
75  );
76 
77 
78 public:
79 
80  // Public constants
81 
82  // Thermodynamic constants
83 
84  //- Universal gas constant [J/(kmol K)]
85  static const scalar RR;
86 
87  //- Standard pressure [Pa]
88  static const scalar Pstd;
89 
90  //- Standard temperature [K]
91  static const scalar Tstd;
92 
93 
94  // Constructors
95 
96  //- Construct from components with name
97  inline specie
98  (
99  const word& name,
100  const scalar nMoles,
101  const scalar molWeight
102  );
103 
104  //- Construct as copy
105  inline specie(const specie&);
106 
107  //- Construct as named copy
108  inline specie(const word& name, const specie&);
109 
110  //- Construct from Istream
111  specie(Istream&);
112 
113 
114  // Member Functions
115 
116  // Access
117 
118  //- Molecular weight [kg/kmol]
119  inline scalar W() const;
120 
121  //- No of moles of this species in mixture
122  inline scalar nMoles() const;
123 
124  //- Gas constant [J/(kg K)]
125  inline scalar R() const;
126 
127 
128  // Member operators
129 
130  inline void operator=(const specie&);
131 
132  inline void operator+=(const specie&);
133  inline void operator-=(const specie&);
134 
135  inline void operator*=(const scalar);
136 
137 
138  // Friend operators
139 
140  inline friend specie operator+(const specie&, const specie&);
141  inline friend specie operator-(const specie&, const specie&);
142 
143  inline friend specie operator*(const scalar, const specie&);
144 
145  inline friend specie operator==(const specie&, const specie&);
146 
147 
148  // Ostream Operator
149 
150  friend Ostream& operator<<(Ostream&, const specie&);
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #include <specie/specieI.H>
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************ vim: set sw=4 sts=4 et: ************************ //