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) 2011-2016 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::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 "word.H"
40 #include "scalar.H"
41 #include "dictionary.H"
42 
43 #include "thermodynamicConstants.H"
44 using namespace Foam::constant::thermodynamic;
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of friend functions and operators
52 
53 class specie;
54 
55 inline specie operator+(const specie&, const specie&);
56 inline specie operator-(const specie&, const specie&);
57 inline specie operator*(const scalar, const specie&);
58 inline specie operator==(const specie&, const specie&);
59 
60 Ostream& operator<<(Ostream&, const specie&);
61 
62 
63 /*---------------------------------------------------------------------------*\
64  Class specie Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class specie
68 {
69  // Private data
70 
71  //- Name of specie
72  word name_;
73 
74  //- Number of moles of this component in the mixture
75  scalar nMoles_;
76 
77  //- Molecular weight of specie [kg/kmol]
78  scalar molWeight_;
79 
80 
81 public:
82 
83  //- Runtime type information
84  ClassName("specie");
85 
86 
87  // Constructors
88 
89 
90  //- Construct from components without name
91  inline specie(const scalar nMoles, const scalar molWeight);
92 
93  //- Construct from components with name
94  inline specie
95  (
96  const word& name,
97  const scalar nMoles,
98  const scalar molWeight
99  );
100 
101  //- Construct as copy
102  inline specie(const specie&);
103 
104  //- Construct as named copy
105  inline specie(const word& name, const specie&);
106 
107  //- Construct from Istream
108  specie(Istream&);
109 
110  //- Construct from dictionary
111  specie(const dictionary& dict);
112 
113 
114  // Member Functions
115 
116  // Access
117 
118  //- Name
119  inline const word& name() const;
120 
121  //- Molecular weight [kg/kmol]
122  inline scalar W() const;
123 
124  //- No of moles of this species in mixture
125  inline scalar nMoles() const;
126 
127  //- Gas constant [J/(kg K)]
128  inline scalar R() const;
129 
130 
131  // I-O
132 
133  //- Write to Ostream
134  void write(Ostream& os) const;
135 
136 
137  // Member operators
138 
139  inline void operator=(const specie&);
140 
141  inline void operator+=(const specie&);
142  inline void operator-=(const specie&);
143 
144  inline void operator*=(const scalar);
145 
146 
147  // Friend operators
148 
149  inline friend specie operator+(const specie&, const specie&);
150  inline friend specie operator-(const specie&, const specie&);
151 
152  inline friend specie operator*(const scalar, const specie&);
153 
154  inline friend specie operator==(const specie&, const specie&);
155 
156 
157  // Ostream Operator
158 
159  friend Ostream& operator<<(Ostream&, const specie&);
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #include "specieI.H"
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Thermodynamic scalar constants.
tmp< fvMatrix< Type > > operator*(const DimensionedField< scalar, volMesh > &, const fvMatrix< Type > &)
Base class of the thermophysical property types.
Definition: specie.H:66
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:65
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
Definition: word.H:59
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
tmp< fvMatrix< Type > > operator+(const fvMatrix< Type > &, const fvMatrix< Type > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
#define R(A, B, C, D, E, F, K, M)
Ostream & operator<<(Ostream &, const ensightPart &)
runTime write()
Namespace for OpenFOAM.