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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::specie
29
30Description
31 Base class of the thermophysical property types.
32
33SourceFiles
34 specieI.H
35 specie.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef specie_H
40#define specie_H
41
42#include "word.H"
43#include "scalar.H"
44#include "dictionary.H"
45
47using namespace Foam::constant::thermodynamic;
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward Declarations
55class specie;
56
57inline specie operator+(const specie&, const specie&);
58inline specie operator*(const scalar, const specie&);
59inline specie operator==(const specie&, const specie&);
60
62
63
64/*---------------------------------------------------------------------------*\
65 Class specie Declaration
66\*---------------------------------------------------------------------------*/
68class specie
69{
70 // Private Data
71
72 //- Name of specie
73 word name_;
74
75 //- Number of moles of this component in the mixture
76 scalar Y_;
77
78 //- Molecular weight of specie [kg/kmol]
79 scalar molWeight_;
80
81
82public:
83
84 //- Declare type-name (with debug switch)
85 ClassName("specie");
86
87
88 // Generated Methods
89
90 //- Copy construct
91 specie(const specie&) = default;
92
93
94 // Constructors
95
96 //- Construct from components without name
97 inline specie(const scalar Y, const scalar molWeight);
98
99 //- Construct from components with name
100 inline specie
101 (
102 const word& name,
103 const scalar Y,
104 const scalar molWeight
105 );
106
107 //- Construct as named copy
108 inline specie(const word& name, const specie&);
109
110 //- Construct from dictionary
111 explicit 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 Y() const;
126
127 //- Gas constant [J/(kg K)]
128 inline scalar R() const;
129
130
131 // IO
132
133 //- Write to Ostream
134 void write(Ostream& os) const;
135
136
137 // Member Operators
138
139 //- Copy assignment, preserve original name
140 inline void operator=(const specie&);
141
142 inline void operator+=(const specie&);
143 inline void operator*=(const scalar);
144
145
146 // Friend Operators
148 inline friend specie operator+(const specie&, const specie&);
149 inline friend specie operator*(const scalar, const specie&);
150 inline friend specie operator==(const specie&, const specie&);
151
152
153 // IOstream Operators
155 friend Ostream& operator<<(Ostream&, const specie&);
156};
157
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161} // End namespace Foam
162
163// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164
165#include "specieI.H"
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169#endif
170
171// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Base class of the thermophysical property types.
Definition: specie.H:68
specie(const specie &)=default
Copy construct.
void operator=(const specie &)
Copy assignment, preserve original name.
Definition: specieI.H:95
friend specie operator+(const specie &, const specie &)
friend Ostream & operator<<(Ostream &, const specie &)
void operator+=(const specie &)
Definition: specieI.H:103
friend specie operator==(const specie &, const specie &)
ClassName("specie")
Declare type-name (with debug switch)
scalar W() const
Molecular weight [kg/kmol].
Definition: specieI.H:75
friend specie operator*(const scalar, const specie &)
scalar Y() const
No of moles of this species in mixture.
Definition: specieI.H:81
scalar R() const
Gas constant [J/(kg K)].
Definition: specieI.H:87
const word & name() const
Name.
Definition: specieI.H:69
void operator*=(const scalar)
Definition: specieI.H:115
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
OBJstream os(runTime.globalPath()/outputName)
Thermodynamic scalar constants.
Namespace for OpenFOAM.
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
runTime write()
dictionary dict