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