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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::linear
28 
29 Group
30  grpSpecieEquationOfState
31 
32 Description
33  Linear equation of state with constant compressibility
34 
35  \verbatim
36  rho = rho0 + psi*p
37  \endverbatim
38 
39 SourceFiles
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 
52 namespace Foam
53 {
54 
55 // Forward declaration of friend functions and operators
56 
57 template<class Specie> class linear;
58 
59 template<class Specie>
60 inline linear<Specie> operator+
61 (
62  const linear<Specie>&,
63  const linear<Specie>&
64 );
65 
66 template<class Specie>
67 inline linear<Specie> operator*
68 (
69  const scalar,
70  const linear<Specie>&
71 );
72 
73 template<class Specie>
74 inline linear<Specie> operator==
75 (
76  const linear<Specie>&,
77  const linear<Specie>&
78 );
79 
80 template<class Specie>
81 Ostream& operator<<
82 (
83  Ostream&,
84  const linear<Specie>&
85 );
86 
87 
88 /*---------------------------------------------------------------------------*\
89  Class linear Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 template<class Specie>
93 class 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 
106 public:
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
189 
190  friend linear operator+ <Specie>
191  (
192  const linear&,
193  const linear&
194  );
195 
196  friend linear operator* <Specie>
197  (
198  const scalar s,
199  const linear&
200  );
201 
202  friend linear operator== <Specie>
203  (
204  const linear&,
205  const linear&
206  );
207 
208 
209  // Ostream Operator
210 
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 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::linear::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: linearI.H:131
Foam::linear::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: linearI.H:83
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::linear::write
void write(Ostream &os) const
Write to Ostream.
Definition: linear.C:45
s
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))
Definition: gmvOutputSpray.H:25
Foam::linear::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: linearI.H:124
Foam::linear::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: linear.H:142
Foam::linear::operator*=
void operator*=(const scalar)
Definition: linearI.H:167
Foam::linear::S
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Definition: linearI.H:117
Foam::linear::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: linear.H:145
linearI.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::linear::clone
autoPtr< linear > clone() const
Construct and return a clone.
Definition: linearI.H:63
dict
dictionary dict
Definition: searchingEngine.H:14
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
rho0
scalar rho0
Definition: readInitialConditions.H:89
Foam::linear::CpMCv
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: linearI.H:138
Foam::linear::E
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: linearI.H:103
Foam::linear::linear
linear(const fvMesh &mesh)
Construct from mesh.
Definition: linear.H:74
Foam::linear::Cp
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
Definition: linearI.H:97
Foam::linear::New
static autoPtr< linear > New(const dictionary &dict)
Definition: linearI.H:72
Foam::linear::operator+=
void operator+=(const linear &)
Definition: linearI.H:148
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::linear
Central-differencing interpolation scheme class.
Definition: linear.H:55
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::linear::H
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: linearI.H:90
Foam::linear::Cv
scalar Cv(scalar p, scalar T) const
Return Cv departure [J/(kg K].
Definition: linearI.H:110
Foam::linear::typeName
static word typeName()
Return the instantiated type name.
Definition: linear.H:133
autoPtr.H