psiThermo.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) 2011-2021 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::psiThermo
26 
27 Description
28  Base-class for fluid thermodynamic properties based on compressibility.
29 
30 See also
31  Foam::basicThermo
32 
33 SourceFiles
34  psiThermo.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef psiThermo_H
39 #define psiThermo_H
40 
41 #include "fluidThermo.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class psiThermo Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class psiThermo
53 :
54  virtual public fluidThermo
55 {
56 public:
57 
58  // Public Classes
59 
60  //- Forward declare the implementation class
61  class implementation;
62 
63  //- Forward declare the composite class
64  class composite;
65 
66 
67  //- Runtime type information
68  TypeName("psiThermo");
69 
70 
71  //- Declare run-time constructor selection table
73  (
74  autoPtr,
75  psiThermo,
76  fvMesh,
77  (const fvMesh& mesh, const word& phaseName),
78  (mesh, phaseName)
79  );
80 
81 
82  // Selectors
83 
84  //- Standard selection based on fvMesh
85  static autoPtr<psiThermo> New
86  (
87  const fvMesh& mesh,
88  const word& phaseName=word::null
89  );
90 
91 
92  //- Destructor
93  virtual ~psiThermo();
94 
95 
96  // Member Functions
97 
98  // Fields derived from thermodynamic state variables
99 
100  //- Add the given density correction to the density field.
101  // Used to update the density field following pressure solution.
102  // For psiThermo does nothing.
103  virtual void correctRho(const volScalarField& deltaRho);
104 
105  //- Density [kg/m^3] - uses current value of pressure
106  virtual tmp<volScalarField> rho() const = 0;
107 
108  //- Density for patch [kg/m^3]
109  virtual tmp<scalarField> rho(const label patchi) const = 0;
110 
111  //- Old-time density [kg/m^3]
112  virtual tmp<volScalarField> rho0() const = 0;
113 
114  //- Compressibility [s^2/m^2]
115  virtual const volScalarField& psi() const = 0;
116 
117 
118  // Access to transport state variables
119 
120  //- Dynamic viscosity of mixture [kg/m/s]
121  virtual tmp<volScalarField> mu() const = 0;
122 
123  //- Dynamic viscosity of mixture for patch [kg/m/s]
124  virtual tmp<scalarField> mu(const label patchi) const = 0;
125 };
126 
127 
128 /*---------------------------------------------------------------------------*\
129  Class psiThermo::implementation Declaration
130 \*---------------------------------------------------------------------------*/
133 :
134  virtual public psiThermo
135 {
136 protected:
137 
138  // Protected data
139 
140  // Fields
141 
142  //- Compressibility [s^2/m^2]
143  volScalarField psi_;
144 
145  //- Dynamic viscosity [kg/m/s]
146  volScalarField mu_;
147 
148 
149 public:
150 
151  // Constructors
152 
153  //- Construct from mesh and phase name
154  implementation(const fvMesh&, const word& phaseName);
155 
156  //- Disallow default bitwise copy construction
157  implementation(const implementation&) = delete;
158 
159 
160  //- Destructor
161  virtual ~implementation();
162 
163 
164  // Member Functions
165 
166  // Fields derived from thermodynamic state variables
167 
168  //- Density [kg/m^3] - uses current value of pressure
169  virtual tmp<volScalarField> rho() const;
170 
171  //- Density for patch [kg/m^3]
172  virtual tmp<scalarField> rho(const label patchi) const;
173 
174  //- Old-time density [kg/m^3]
175  virtual tmp<volScalarField> rho0() const;
176 
177  //- Compressibility [s^2/m^2]
178  virtual const volScalarField& psi() const;
179 
180 
181  // Access to transport state variables
182 
183  //- Dynamic viscosity of mixture [kg/m/s]
184  virtual tmp<volScalarField> mu() const;
185 
186  //- Dynamic viscosity of mixture for patch [kg/m/s]
187  virtual tmp<scalarField> mu(const label patchi) const;
188 
189 
190  // Member Operators
191 
192  //- Disallow default bitwise assignment
193  void operator=(const implementation&) = delete;
194 };
195 
196 
197 /*---------------------------------------------------------------------------*\
198  Class psiThermo::composite Declaration
199 \*---------------------------------------------------------------------------*/
202 :
206 {
207 public:
208 
209  // Constructors
210 
211  //- Construct from mesh and phase name
213  (
214  const fvMesh& mesh,
215  const word& phaseName
216  )
217  :
218  basicThermo::implementation(mesh, phaseName),
219  fluidThermo::implementation(mesh, phaseName),
220  psiThermo::implementation(mesh, phaseName)
221  {}
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
Base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:77
TypeName("psiThermo")
Runtime type information.
virtual tmp< volScalarField > rho0() const =0
Old-time density [kg/m^3].
void operator=(const viscosity &)=delete
Disallow default bitwise assignment.
fvMesh & mesh
virtual ~psiThermo()
Destructor.
Definition: psiThermo.C:89
virtual tmp< volScalarField > rho() const =0
Density [kg/m^3] - uses current value of pressure.
virtual const word & phaseName() const =0
Phase name.
A class for handling words, derived from string.
Definition: word.H:59
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:53
declareRunTimeSelectionTable(autoPtr, psiThermo, fvMesh,(const fvMesh &mesh, const word &phaseName),(mesh, phaseName))
Declare run-time constructor selection table.
virtual tmp< volScalarField > mu() const =0
Dynamic viscosity of mixture [kg/m/s].
static const word null
An empty word.
Definition: word.H:77
virtual void correctRho(const volScalarField &deltaRho)
Add the given density correction to the density field.
Definition: psiThermo.C:99
static autoPtr< psiThermo > New(const fvMesh &mesh, const word &phaseName=word::null)
Standard selection based on fvMesh.
Definition: psiThermo.C:78
label patchi
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
virtual const volScalarField & psi() const =0
Compressibility [s^2/m^2].
Base-class for fluid thermodynamic properties based on compressibility.
Definition: psiThermo.H:51
Namespace for OpenFOAM.