linear.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) 2013-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::linear
28
29Group
30 grpSpecieEquationOfState
31
32Description
33 Linear equation of state with constant compressibility
34
35 \verbatim
36 rho = rho0 + psi*p
37 \endverbatim
38
39SourceFiles
40 linearI.H
41 linear.C
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef linearEOS_H
46#define linearEOS_H
47
48#include "autoPtr.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55// Forward declaration of friend functions and operators
56
57template<class Specie> class linear;
58
59template<class Specie>
60inline linear<Specie> operator+
61(
62 const linear<Specie>&,
63 const linear<Specie>&
64);
65
66template<class Specie>
67inline linear<Specie> operator*
68(
69 const scalar,
70 const linear<Specie>&
71);
72
73template<class Specie>
74inline linear<Specie> operator==
75(
76 const linear<Specie>&,
77 const linear<Specie>&
78);
79
80template<class Specie>
81Ostream& operator<<
82(
83 Ostream&,
84 const linear<Specie>&
85);
86
87
88/*---------------------------------------------------------------------------*\
89 Class linear Declaration
90\*---------------------------------------------------------------------------*/
91
92template<class Specie>
93class linear
94:
95 public Specie
96{
97 // Private data
98
99 //- Compressibility
100 scalar psi_;
101
102 //- The reference density
103 scalar rho0_;
104
105
106public:
107
108 // Constructors
109
110 //- Construct from components
111 inline linear
112 (
113 const Specie& sp,
114 const scalar psi,
115 const scalar rho0
116 );
117
118 //- Construct from dictionary
119 linear(const dictionary& dict);
120
121 //- Construct as named copy
122 inline linear(const word& name, const linear&);
123
124 //- Construct and return a clone
125 inline autoPtr<linear> clone() const;
126
127 // Selector from dictionary
128 inline static autoPtr<linear> New(const dictionary& dict);
129
130
131 // Member functions
132
133 //- Return the instantiated type name
134 static word typeName()
135 {
136 return "linear<" + word(Specie::typeName_()) + '>';
137 }
138
139
140 // Fundamental properties
141
142 //- Is the equation of state is incompressible i.e. rho != f(p)
143 static const bool incompressible = false;
144
145 //- Is the equation of state is isochoric i.e. rho = const
146 static const bool isochoric = false;
147
148 //- Return density [kg/m^3]
149 inline scalar rho(scalar p, scalar T) const;
150
151 //- Return enthalpy departure [J/kg]
152 inline scalar H(const scalar p, const scalar T) const;
153
154 //- Return Cp departure [J/(kg K]
155 inline scalar Cp(scalar p, scalar T) const;
156
157 //- Return internal energy departure [J/kg]
158 inline scalar E(const scalar p, const scalar T) const;
159
160 //- Return Cv departure [J/(kg K]
161 inline scalar Cv(scalar p, scalar T) const;
162
163 //- Return entropy [J/(kg K)]
164 inline scalar S(const scalar p, const scalar T) const;
165
166 //- Return compressibility rho/p [s^2/m^2]
167 inline scalar psi(scalar p, scalar T) const;
168
169 //- Return compression factor []
170 inline scalar Z(scalar p, scalar T) const;
171
172 //- Return (Cp - Cv) [J/(kg K]
173 inline scalar CpMCv(scalar p, scalar T) const;
174
175
176 // IO
177
178 //- Write to Ostream
179 void write(Ostream& os) const;
180
181
182 // Member operators
183
184 inline void operator+=(const linear&);
185 inline void operator*=(const scalar);
186
187
188 // Friend operators
190 friend linear operator+ <Specie>
191 (
192 const linear&,
193 const linear&
194 );
196 friend linear operator* <Specie>
197 (
198 const scalar s,
199 const linear&
200 );
202 friend linear operator== <Specie>
203 (
204 const linear&,
205 const linear&
206 );
207
208
209 // Ostream Operator
211 friend Ostream& operator<< <Specie>
212 (
213 Ostream&,
214 const linear&
215 );
216};
217
218
219// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220
221} // End namespace Foam
222
223// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224
225#include "linearI.H"
226
227#ifdef NoRepository
228 #include "linear.C"
229#endif
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233#endif
234
235// ************************************************************************* //
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
Central-differencing interpolation scheme class.
Definition: linear.H:58
void operator+=(const linear &)
Definition: linearI.H:148
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: linearI.H:103
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: linearI.H:90
static word typeName()
Return the instantiated type name.
Definition: linear.H:133
linear(const word &name, const linear &)
Construct as named copy.
static autoPtr< linear > New(const dictionary &dict)
Definition: linearI.H:72
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Definition: linearI.H:117
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: linearI.H:138
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: linear.H:145
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: linear.H:142
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: linearI.H:131
autoPtr< linear > clone() const
Construct and return a clone.
Definition: linearI.H:63
void operator*=(const scalar)
Definition: linearI.H:167
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()
scalar rho0
dictionary dict