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