rhoConst.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) 2012-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::rhoConst
28
29Group
30 grpSpecieEquationOfState
31
32Description
33 RhoConst (rho = const) of state.
34
35SourceFiles
36 rhoConstI.H
37 rhoConst.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef rhoConst_H
42#define rhoConst_H
43
44#include "autoPtr.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward declaration of friend functions and operators
52
53template<class Specie> class rhoConst;
54
55template<class Specie>
56inline rhoConst<Specie> operator+
57(
58 const rhoConst<Specie>&,
59 const rhoConst<Specie>&
60);
61
62template<class Specie>
63inline rhoConst<Specie> operator*
64(
65 const scalar,
66 const rhoConst<Specie>&
67);
68
69template<class Specie>
70inline rhoConst<Specie> operator==
71(
72 const rhoConst<Specie>&,
73 const rhoConst<Specie>&
74);
75
76template<class Specie>
77Ostream& operator<<
78(
79 Ostream&,
80 const rhoConst<Specie>&
81);
82
83
84/*---------------------------------------------------------------------------*\
85 Class rhoConst Declaration
86\*---------------------------------------------------------------------------*/
87
88template<class Specie>
89class rhoConst
90:
91 public Specie
92{
93 // Private data
94
95 //- Density
96 scalar rho_;
97
98
99public:
100
101 // Constructors
102
103 //- Construct from components
104 inline rhoConst(const Specie& sp, const scalar rho);
105
106 //- Construct from dictionary
107 rhoConst(const dictionary& dict);
108
109 //- Construct as named copy
110 inline rhoConst(const word& name, const rhoConst&);
111
112 //- Construct and return a clone
113 inline autoPtr<rhoConst> clone() const;
114
115
116 // Member functions
117
118 //- Return the instantiated type name
119 static word typeName()
120 {
121 return "rhoConst<" + word(Specie::typeName_()) + '>';
122 }
123
124
125 // Fundamental properties
126
127 //- Is the equation of state is incompressible i.e. rho != f(p)
128 static const bool incompressible = true;
129
130 //- Is the equation of state is isochoric i.e. rho = const
131 static const bool isochoric = true;
132
133 //- Return density [kg/m^3]
134 inline scalar rho(scalar p, scalar T) const;
135
136 //- Return enthalpy departure [J/kg]
137 inline scalar H(const scalar p, const scalar T) const;
138
139 //- Return Cp departure [J/(kg K]
140 inline scalar Cp(scalar p, scalar T) const;
141
142 //- Return internal energy departure [J/kg]
143 inline scalar E(const scalar p, const scalar T) const;
144
145 //- Return Cv departure [J/(kg K]
146 inline scalar Cv(scalar p, scalar T) const;
147
148 //- Return entropy [J/(kg K)]
149 inline scalar S(const scalar p, const scalar T) const;
150
151 //- Return compressibility rho/p [s^2/m^2]
152 inline scalar psi(scalar p, scalar T) const;
153
154 //- Return compression factor []
155 inline scalar Z(scalar p, scalar T) const;
156
157 //- Return (Cp - Cv) [J/(kg K]
158 inline scalar CpMCv(scalar p, scalar T) const;
159
160
161 // IO
162
163 //- Write to Ostream
164 void write(Ostream& os) const;
165
166
167 // Member operators
168
169 inline void operator+=(const rhoConst&);
170 inline void operator*=(const scalar);
171
172
173 // Friend operators
175 friend rhoConst operator+ <Specie>
176 (
177 const rhoConst&,
178 const rhoConst&
179 );
181 friend rhoConst operator* <Specie>
182 (
183 const scalar s,
184 const rhoConst&
185 );
187 friend rhoConst operator== <Specie>
188 (
189 const rhoConst&,
190 const rhoConst&
191 );
192
193
194 // Ostream Operator
196 friend Ostream& operator<< <Specie>
197 (
198 Ostream&,
199 const rhoConst&
200 );
201};
202
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206} // End namespace Foam
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210#include "rhoConstI.H"
211
212#ifdef NoRepository
213 #include "rhoConst.C"
214#endif
215
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218#endif
219
220// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
RhoConst (rho = const) of state.
Definition: rhoConst.H:91
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: rhoConstI.H:90
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: rhoConstI.H:76
static word typeName()
Return the instantiated type name.
Definition: rhoConst.H:118
rhoConst(const word &name, const rhoConst &)
Construct as named copy.
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Definition: rhoConstI.H:104
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: rhoConstI.H:125
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: rhoConst.H:130
autoPtr< rhoConst > clone() const
Construct and return a clone.
Definition: rhoConstI.H:60
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: rhoConst.H:127
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: rhoConstI.H:118
void operator*=(const scalar)
Definition: rhoConstI.H:150
void operator+=(const rhoConst &)
Definition: rhoConstI.H:134
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
const volScalarField & psi
const volScalarField & T
const volScalarField & Cv
Definition: EEqn.H:8
const volScalarField & Cp
Definition: EEqn.H:7
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
runTime write()
dictionary dict