rhoConst.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) 2012-2018 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::rhoConst
26 
27 Description
28  RhoConst (rho = const) of state.
29 
30 SourceFiles
31  rhoConstI.H
32  rhoConst.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef rhoConst_H
37 #define rhoConst_H
38 
39 #include "autoPtr.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of friend functions and operators
47 
48 template<class Specie> class rhoConst;
49 
50 template<class Specie>
51 inline rhoConst<Specie> operator+
52 (
53  const rhoConst<Specie>&,
54  const rhoConst<Specie>&
55 );
56 
57 template<class Specie>
58 inline rhoConst<Specie> operator*
59 (
60  const scalar,
61  const rhoConst<Specie>&
62 );
63 
64 template<class Specie>
65 inline rhoConst<Specie> operator==
66 (
67  const rhoConst<Specie>&,
68  const rhoConst<Specie>&
69 );
70 
71 template<class Specie>
72 Ostream& operator<<
73 (
74  Ostream&,
75  const rhoConst<Specie>&
76 );
77 
78 
79 /*---------------------------------------------------------------------------*\
80  Class rhoConst Declaration
81 \*---------------------------------------------------------------------------*/
82 
83 template<class Specie>
84 class rhoConst
85 :
86  public Specie
87 {
88  // Private data
89 
90  //- Density
91  scalar rho_;
92 
93 
94 public:
95 
96  // Constructors
97 
98  //- Construct from components
99  inline rhoConst(const Specie& sp, const scalar rho);
100 
101  //- Construct from dictionary
102  rhoConst(const dictionary& dict);
103 
104  //- Construct as named copy
105  inline rhoConst(const word& name, const rhoConst&);
106 
107  //- Construct and return a clone
108  inline autoPtr<rhoConst> clone() const;
109 
110 
111  // Member functions
112 
113  //- Return the instantiated type name
114  static word typeName()
115  {
116  return "rhoConst<" + word(Specie::typeName_()) + '>';
117  }
118 
119 
120  // Fundamental properties
121 
122  //- Is the equation of state is incompressible i.e. rho != f(p)
123  static const bool incompressible = true;
124 
125  //- Is the equation of state is isochoric i.e. rho = const
126  static const bool isochoric = true;
127 
128  //- Return density [kg/m^3]
129  inline scalar rho(scalar p, scalar T) const;
130 
131  //- Return enthalpy departure [J/kg]
132  inline scalar H(const scalar p, const scalar T) const;
133 
134  //- Return Cp departure [J/(kg K]
135  inline scalar Cp(scalar p, scalar T) const;
136 
137  //- Return entropy [J/(kg K)]
138  inline scalar S(const scalar p, const scalar T) const;
139 
140  //- Return compressibility rho/p [s^2/m^2]
141  inline scalar psi(scalar p, scalar T) const;
142 
143  //- Return compression factor []
144  inline scalar Z(scalar p, scalar T) const;
145 
146  //- Return (Cp - Cv) [J/(kg K]
147  inline scalar CpMCv(scalar p, scalar T) const;
148 
149 
150  // IO
151 
152  //- Write to Ostream
153  void write(Ostream& os) const;
154 
155 
156  // Member operators
157 
158  inline void operator+=(const rhoConst&);
159  inline void operator*=(const scalar);
160 
161 
162  // Friend operators
163 
164  friend rhoConst operator+ <Specie>
165  (
166  const rhoConst&,
167  const rhoConst&
168  );
169 
170  friend rhoConst operator* <Specie>
171  (
172  const scalar s,
173  const rhoConst&
174  );
175 
176  friend rhoConst operator== <Specie>
177  (
178  const rhoConst&,
179  const rhoConst&
180  );
181 
182 
183  // Ostream Operator
184 
185  friend Ostream& operator<< <Specie>
186  (
187  Ostream&,
188  const rhoConst&
189  );
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #include "rhoConstI.H"
200 
201 #ifdef NoRepository
202  #include "rhoConst.C"
203 #endif
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
dictionary dict
void operator+=(const rhoConst &)
Definition: rhoConstI.H:118
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: rhoConst.H:122
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
scalar psi(scalar p, scalar T) const
Return compressibility rho/p [s^2/m^2].
Definition: rhoConstI.H:95
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: rhoConstI.H:74
void write(Ostream &os) const
Write to Ostream.
Definition: rhoConst.C:42
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: rhoConstI.H:102
rhoConst(const Specie &sp, const scalar rho)
Construct from components.
Definition: rhoConstI.H:32
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: rhoConstI.H:109
scalar S(const scalar p, const scalar T) const
Return entropy [J/(kg K)].
Definition: rhoConstI.H:88
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
Definition: rhoConstI.H:81
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: rhoConstI.H:67
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
A class for handling words, derived from string.
Definition: word.H:59
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: rhoConst.H:125
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
autoPtr< rhoConst > clone() const
Construct and return a clone.
Definition: rhoConstI.H:58
static word typeName()
Return the instantiated type name.
Definition: rhoConst.H:113
void operator*=(const scalar)
Definition: rhoConstI.H:134
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
RhoConst (rho = const) of state.
Definition: rhoConst.H:47
volScalarField & p
Namespace for OpenFOAM.