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-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::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&,
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  //- Rename and return the thermodynamic density field [kg/m^3]
108  // This is used by solvers which create a separate continuity rho
109  virtual tmp<volScalarField> renameRho() = 0;
110 
111  //- Return non-const access to the local density field [kg/m^3]
112  virtual volScalarField& rho() = 0;
113 
114  //- Add the given density correction to the density field.
115  // Used to update the density field following pressure solution
116  virtual void correctRho(const volScalarField& deltaRho) = 0;
117 };
118 
119 
120 /*---------------------------------------------------------------------------*\
121  Class rhoThermo::implementation Declaration
122 \*---------------------------------------------------------------------------*/
123 
125 :
126  virtual public rhoThermo
127 {
128 protected:
129 
130  // Protected data
131 
132  //- Density field [kg/m^3]
133  // Named 'rho' to avoid (potential) conflict with solver density
135 
136 
137 public:
138 
139  // Constructors
140 
141  //- Construct from mesh and phase name
142  implementation(const fvMesh&, const word& phaseName);
143 
144  //- Disallow default bitwise copy construction
145  implementation(const implementation&) = delete;
146 
147 
148  //- Destructor
149  virtual ~implementation();
150 
151 
152  // Member Functions
153 
154  // Fields derived from thermodynamic state variables
155 
156  //- Density [kg/m^3]
157  virtual tmp<volScalarField> rho() const;
158 
159  //- Density for patch [kg/m^3]
160  virtual tmp<scalarField> rho(const label patchi) const;
161 
162  //- Rename and return the thermodynamic density field [kg/m^3]
163  // This is used by solvers which create a separate continuity rho
164  virtual tmp<volScalarField> renameRho();
165 
166  //- Return non-const access to the local density field [kg/m^3]
167  virtual volScalarField& rho();
168 
169  //- Add the given density correction to the density field.
170  // Used to update the density field following pressure solution
171  virtual void correctRho(const volScalarField& deltaRho);
172 
173 
174  // Member Operators
175 
176  //- Disallow default bitwise assignment
177  void operator=(const implementation&) = delete;
178 };
179 
180 
181 /*---------------------------------------------------------------------------*\
182  Class rhoThermo::composite Declaration
183 \*---------------------------------------------------------------------------*/
184 
186 :
190 {
191 public:
192 
193  // Constructors
194 
195  //- Construct from mesh and phase name
196  composite
197  (
198  const fvMesh& mesh,
199  const word& phaseName
200  )
201  :
205  {}
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
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
virtual const fvMesh & mesh() const
Return const access to the mesh.
Definition: basicThermo.H:484
virtual const word & phaseName() const
Phase name.
Definition: basicThermo.H:490
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 word & phaseName() const =0
Phase name.
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
composite(const fvMesh &mesh, const word &phaseName)
Construct from mesh and phase name.
Definition: rhoThermo.H:196
volScalarField rho_
Density field [kg/m^3].
Definition: rhoThermo.H:133
virtual tmp< volScalarField > renameRho()
Rename and return the thermodynamic density field [kg/m^3].
Definition: rhoThermo.C:100
virtual void correctRho(const volScalarField &deltaRho)
Add the given density correction to the density field.
Definition: rhoThermo.C:113
implementation(const fvMesh &, const word &phaseName)
Construct from mesh and phase name.
Definition: rhoThermo.C:40
virtual ~implementation()
Destructor.
Definition: rhoThermo.C:79
void operator=(const implementation &)=delete
Disallow default bitwise assignment.
virtual tmp< volScalarField > rho() const
Density [kg/m^3].
Definition: rhoThermo.C:85
Base-class for fluid thermodynamic properties based on density.
Definition: rhoThermo.H:55
virtual tmp< volScalarField > renameRho()=0
Rename and return the thermodynamic density field [kg/m^3].
virtual ~rhoThermo()
Destructor.
Definition: rhoThermo.C:75
virtual void correctRho(const volScalarField &deltaRho)=0
Add the given density correction to the density field.
declareRunTimeSelectionTable(autoPtr, rhoThermo, fvMesh,(const fvMesh &mesh, const word &phaseName),(mesh, phaseName))
Declare run-time constructor selection table.
static autoPtr< rhoThermo > New(const fvMesh &, const word &phaseName=word::null)
Standard selection based on fvMesh.
Definition: rhoThermo.C:64
TypeName("rhoThermo")
Runtime type information.
virtual tmp< volScalarField > rho() const =0
Density [kg/m^3].
A class for managing temporary objects.
Definition: tmp.H:55
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
Macros to ease declaration of run-time selection tables.