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  //- Construct from mesh, dictionary and phase name
162  implementation(const fvMesh&, const dictionary&, const word& phaseName);
163 
164  //- Disallow default bitwise copy construction
165  implementation(const implementation&) = delete;
166 
167 
168  //- Destructor
169  virtual ~implementation();
170 
171 
172  // Member Functions
173 
174  // Fields derived from thermodynamic state variables
175 
176  //- Density [kg/m^3]
177  virtual tmp<volScalarField> rho() const;
178 
179  //- Density for patch [kg/m^3]
180  virtual tmp<scalarField> rho(const label patchi) const;
181 
182  //- Return non-const access to the local density field [kg/m^3]
183  virtual volScalarField& rho();
184 
185  //- Old-time density [kg/m^3]
186  virtual tmp<volScalarField> rho0() const;
187 
188  //- Add the given density correction to the density field.
189  // Used to update the density field following pressure solution
190  virtual void correctRho(const volScalarField& deltaRho);
191 
192  //- Compressibility [s^2/m^2]
193  virtual const volScalarField& psi() const;
194 
195 
196  // Access to transport state variables
197 
198  //- Dynamic viscosity of mixture [kg/m/s]
199  virtual tmp<volScalarField> mu() const;
200 
201  //- Dynamic viscosity of mixture for patch [kg/m/s]
202  virtual tmp<scalarField> mu(const label patchi) const;
203 
204 
205  // Member Operators
206 
207  //- Disallow default bitwise assignment
208  void operator=(const implementation&) = delete;
209 };
210 
211 
212 /*---------------------------------------------------------------------------*\
213  Class rhoThermo::composite Declaration
214 \*---------------------------------------------------------------------------*/
217 :
221 {
222 public:
223 
224  // Constructors
225 
226  //- Construct from mesh and phase name
228  (
229  const fvMesh& mesh,
230  const word& phaseName
231  )
232  :
233  basicThermo::implementation(mesh, phaseName),
234  fluidThermo::implementation(mesh, phaseName),
235  rhoThermo::implementation(mesh, phaseName)
236  {}
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #endif
247 
248 // ************************************************************************* //
virtual void correctRho(const volScalarField &deltaRho)=0
Add the given density correction to the density field.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:77
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual tmp< volScalarField > rho() const =0
Density [kg/m^3].
static autoPtr< rhoThermo > New(const fvMesh &, const word &phaseName=word::null)
Standard selection based on fvMesh.
Definition: rhoThermo.C:143
TypeName("rhoThermo")
Runtime type information.
void operator=(const dynamicTransportModel &)=delete
Disallow default bitwise assignment.
virtual const word & phaseName() const =0
Return the phase name.
dynamicFvMesh & mesh
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:154
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
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.