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-2017 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 scalar, const specie&);
57 inline specie operator==(const specie&, const specie&);
58 
59 Ostream& operator<<(Ostream&, const specie&);
60 
61 
62 /*---------------------------------------------------------------------------*\
63  Class specie Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class specie
67 {
68  // Private data
69 
70  //- Name of specie
71  word name_;
72 
73  //- Number of moles of this component in the mixture
74  scalar Y_;
75 
76  //- Molecular weight of specie [kg/kmol]
77  scalar molWeight_;
78 
79 
80 public:
81 
82  //- Runtime type information
83  ClassName("specie");
84 
85 
86  // Constructors
87 
88  //- Construct from components without name
89  inline specie(const scalar Y, const scalar molWeight);
90 
91  //- Construct from components with name
92  inline specie
93  (
94  const word& name,
95  const scalar Y,
96  const scalar molWeight
97  );
98 
99  //- Construct as named copy
100  inline specie(const word& name, const specie&);
101 
102  //- Construct from dictionary
103  specie(const dictionary& dict);
104 
105 
106  // Member Functions
107 
108  // Access
109 
110  //- Name
111  inline const word& name() const;
112 
113  //- Molecular weight [kg/kmol]
114  inline scalar W() const;
115 
116  //- No of moles of this species in mixture
117  inline scalar Y() const;
118 
119  //- Gas constant [J/(kg K)]
120  inline scalar R() const;
121 
122 
123  // I-O
124 
125  //- Write to Ostream
126  void write(Ostream& os) const;
127 
128 
129  // Member operators
130 
131  inline void operator=(const specie&);
132  inline void operator+=(const specie&);
133  inline void operator*=(const scalar);
134 
135 
136  // Friend operators
137 
138  inline friend specie operator+(const specie&, const specie&);
139  inline friend specie operator*(const scalar, const specie&);
140  inline friend specie operator==(const specie&, const specie&);
141 
142 
143  // Ostream Operator
144 
145  friend Ostream& operator<<(Ostream&, const specie&);
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #include "specieI.H"
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Thermodynamic scalar constants.
Base class of the thermophysical property types.
Definition: specie.H:65
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:65
void write(Ostream &, const label, const dictionary &)
Write with dictionary lookup.
tmp< fvMatrix< Type > > operator*(const volScalarField::Internal &, const fvMatrix< Type > &)
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 > &, 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)
PtrList< volScalarField > & Y
Ostream & operator<<(Ostream &, const ensightPart &)
Namespace for OpenFOAM.