All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
specie.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2021 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  //- Mass fraction of this specie in 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  //- Copy constructor
106  specie(const specie&) = default;
107 
108 
109  // Member Functions
110 
111  // Access
112 
113  //- Name
114  inline const word& name() const;
115 
116  //- Molecular weight [kg/kmol]
117  inline scalar W() const;
118 
119  //- Mass fraction of this specie in mixture
120  inline scalar Y() const;
121 
122  //- Gas constant [J/kg/K]
123  inline scalar R() const;
124 
125 
126  // I-O
127 
128  //- Write to Ostream
129  void write(Ostream& os) const;
130 
131 
132  // Member Operators
133 
134  inline void operator=(const specie&);
135  inline void operator+=(const specie&);
136  inline void operator*=(const scalar);
137 
138 
139  // Friend operators
140 
141  inline friend specie operator+(const specie&, const specie&);
142  inline friend specie operator*(const scalar, const specie&);
143  inline friend specie operator==(const specie&, const specie&);
144 
145 
146  // Ostream Operator
147 
148  friend Ostream& operator<<(Ostream&, const specie&);
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #include "specieI.H"
160 #define noCoefficientMixing(Type) \
161  static_assert \
162  ( \
163  False<Specie>, \
164  #Type " does not support coefficient mixing" \
165  )
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
dictionary dict
tmp< fvMatrix< Type > > operator*(const volScalarField::Internal &, const fvMatrix< Type > &)
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
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
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
Definition: word.H:59
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
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:54
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)
const scalarList W(::W(thermo))
PtrList< volScalarField > & Y
Ostream & operator<<(Ostream &, const ensightPart &)
Namespace for OpenFOAM.