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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::specie
29 
30 Description
31  Base class of the thermophysical property types.
32 
33 SourceFiles
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 
46 #include "thermodynamicConstants.H"
47 using namespace Foam::constant::thermodynamic;
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward Declarations
55 class specie;
56 
57 inline specie operator+(const specie&, const specie&);
58 inline specie operator*(const scalar, const specie&);
59 inline specie operator==(const specie&, const specie&);
60 
61 Ostream& operator<<(Ostream&, const specie&);
62 
63 
64 /*---------------------------------------------------------------------------*\
65  Class specie Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class 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 
82 public:
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
147 
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
154 
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 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
R
#define R(A, B, C, D, E, F, K, M)
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::constant::thermodynamic
Thermodynamic scalar constants.
Definition: thermodynamicConstants.C:37
specieI.H
Foam::specie
Base class of the thermophysical property types.
Definition: specie.H:67
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
scalar.H
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
thermodynamicConstants.H
ClassName
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
Foam::operator+
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::operator*
tmp< faMatrix< Type > > operator*(const areaScalarField &, const faMatrix< Type > &)
dictionary.H
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:36
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H