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 -------------------------------------------------------------------------------
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::rhoConst
28 
29 Group
30  grpSpecieEquationOfState
31 
32 Description
33  RhoConst (rho = const) of state.
34 
35 SourceFiles
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 
48 namespace Foam
49 {
50 
51 // Forward declaration of friend functions and operators
52 
53 template<class Specie> class rhoConst;
54 
55 template<class Specie>
56 inline rhoConst<Specie> operator+
57 (
58  const rhoConst<Specie>&,
59  const rhoConst<Specie>&
60 );
61 
62 template<class Specie>
63 inline rhoConst<Specie> operator*
64 (
65  const scalar,
66  const rhoConst<Specie>&
67 );
68 
69 template<class Specie>
70 inline rhoConst<Specie> operator==
71 (
72  const rhoConst<Specie>&,
73  const rhoConst<Specie>&
74 );
75 
76 template<class Specie>
77 Ostream& operator<<
78 (
79  Ostream&,
80  const rhoConst<Specie>&
81 );
82 
83 
84 /*---------------------------------------------------------------------------*\
85  Class rhoConst Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 template<class Specie>
89 class rhoConst
90 :
91  public Specie
92 {
93  // Private data
94 
95  //- Density
96  scalar rho_;
97 
98 
99 public:
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
174 
175  friend rhoConst operator+ <Specie>
176  (
177  const rhoConst&,
178  const rhoConst&
179  );
180 
181  friend rhoConst operator* <Specie>
182  (
183  const scalar s,
184  const rhoConst&
185  );
186 
187  friend rhoConst operator== <Specie>
188  (
189  const rhoConst&,
190  const rhoConst&
191  );
192 
193 
194  // Ostream Operator
195 
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 // ************************************************************************* //
Foam::rhoConst::E
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: rhoConstI.H:90
Foam::rhoConst::CpMCv
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: rhoConstI.H:125
Foam::rhoConst::operator*=
void operator*=(const scalar)
Definition: rhoConstI.H:150
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
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::rhoConst::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: rhoConst.H:127
Foam::rhoConst::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: rhoConst.H:130
Foam::rhoConst::Cp
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
Definition: rhoConstI.H:83
Foam::rhoConst::H
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: rhoConstI.H:76
Foam::rhoConst::typeName
static word typeName()
Return the instantiated type name.
Definition: rhoConst.H:118
Foam::rhoConst::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: rhoConstI.H:118
Foam::rhoConst::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: rhoConstI.H:69
Foam::rhoConst::Cv
scalar Cv(scalar p, scalar T) const
Return Cv departure [J/(kg K].
Definition: rhoConstI.H:97
rhoConstI.H
Foam::rhoConst::S
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Definition: rhoConstI.H:104
Foam::rhoConst::rhoConst
rhoConst(const Specie &sp, const scalar rho)
Construct from components.
Definition: rhoConstI.H:34
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
rhoConst.C
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
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::rhoConst::write
void write(Ostream &os) const
Write to Ostream.
Definition: rhoConst.C:44
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::rhoConst::clone
autoPtr< rhoConst > clone() const
Construct and return a clone.
Definition: rhoConstI.H:60
Foam::rhoConst::operator+=
void operator+=(const rhoConst &)
Definition: rhoConstI.H:134
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::rhoConst::psi
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: rhoConstI.H:111
Foam::rhoConst
RhoConst (rho = const) of state.
Definition: rhoConst.H:52
autoPtr.H