constSolidThermo.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) 2022-2023 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::constSolidThermo
26 
27 Description
28  Uniform or non-uniform constant solid thermodynamic properties
29 
30  Each physical property can specified as either \c uniform in which case the
31  value entry is read, \c zonal in which case the value entry and zone list
32  are read or \c file in which case the field file in read from the constant
33  directory.
34 
35 Usage
36  Example of uniform constant solid properties specification:
37  \verbatim
38  thermoType constSolidThermo;
39 
40  rho
41  {
42  type uniform;
43  value 8940;
44  }
45 
46  Cv
47  {
48  type uniform;
49  value 385;
50  }
51 
52  kappa
53  {
54  type uniform;
55  value 380;
56  }
57  \endverbatim
58 
59  Example of zonal constant solid properties specification where kappa is
60  different in different zones:
61  \verbatim
62  thermoType constSolidThermo;
63 
64  rho
65  {
66  type uniform;
67  value 8940;
68  }
69 
70  Cv
71  {
72  type uniform;
73  value 385;
74  }
75 
76  kappa
77  {
78  type zonal;
79  value 380;
80 
81  zones
82  {
83  heater 560;
84  insulation 100;
85  }
86  }
87  \endverbatim
88 
89  Example of non-uniform constant solid properties specification:
90  \verbatim
91  thermoType constSolidThermo;
92 
93  rho
94  {
95  type file;
96  }
97 
98  Cv
99  {
100  type file;
101  }
102 
103  kappa
104  {
105  type file;
106  }
107  \endverbatim
108  where each of the field files are read from the constant directory.
109 
110 SourceFiles
111  constSolidThermo.C
112 
113 \*---------------------------------------------------------------------------*/
114 
115 #ifndef constSolidThermo_H
116 #define constSolidThermo_H
117 
119 #include "solidThermo.H"
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 namespace Foam
124 {
125 
126 /*---------------------------------------------------------------------------*\
127  Class constSolidThermo Declaration
128 \*---------------------------------------------------------------------------*/
129 
130 class constSolidThermo
131 :
132  public PhysicalPropertiesThermo<solidThermo::composite>
133 {
134  // Private data
135 
136  //- Heat capacity at constant volume [J/kg/K]
137  volScalarField Cv_;
138 
139  //- Internal energy [J/kg]
140  volScalarField e_;
141 
142 
143 protected:
144 
145  // Protected constructors
146 
147  //- Construct from mesh and phase name
149  (
150  const fvMesh&,
151  const bool readKappa,
152  const word& phaseName = word::null
153  );
154 
155 
156  // Protected Member Functions
157 
158  template<class Type>
160  (
161  const word& name,
162  const dimensionSet& dimensions
163  ) const;
164 
165 
166 public:
167 
168  //- Runtime type information
169  TypeName("constSolidThermo");
170 
171 
172  // Constructors
173 
174  //- Construct from mesh and phase name
176  (
177  const fvMesh&,
178  const word& phaseName = word::null
179  );
180 
181 
182  //- Destructor
183  virtual ~constSolidThermo();
184 
185 
186  // Member Functions
187 
188  //- Return the name of the thermo physics
189  virtual word thermoName() const
190  {
191  return type();
192  }
193 
194  //- Return true if the equation of state is incompressible
195  // i.e. rho != f(p)
196  virtual bool incompressible() const
197  {
198  return true;
199  }
200 
201  //- Return true if the equation of state is isochoric
202  // i.e. rho = const
203  virtual bool isochoric() const
204  {
205  return true;
206  }
207 
208 
209  // Molecular properties
210 
211  //- Molecular weight [kg/kmol]
212  virtual tmp<volScalarField> W() const;
213 
214  //- Molecular weight for patch [kg/kmol]
215  virtual tmp<scalarField> W(const label patchi) const;
216 
217 
218  // Thermodynamic state
219 
220  //- Enthalpy/Internal energy [J/kg]
221  virtual const volScalarField& he() const;
222 
223  //- Enthalpy/Internal energy [J/kg]
224  // Non-const access allowed for transport equations
225  virtual volScalarField& he();
226 
227  //- Heat capacity at constant pressure [J/kg/K]
228  virtual const volScalarField& Cp() const;
229 
230  //- Heat capacity at constant volume [J/kg/K]
231  virtual const volScalarField& Cv() const;
232 
233  //- Heat capacity at constant pressure/volume [J/kg/K]
234  virtual const volScalarField& Cpv() const;
235 
236 
237  // Derived thermodynamic properties
238 
239  //- Enthalpy/Internal energy
240  // for given pressure and temperature [J/kg]
241  virtual tmp<volScalarField> he
242  (
243  const volScalarField& p,
244  const volScalarField& T
245  ) const;
246 
247  //- Enthalpy/Internal energy for cell-set [J/kg]
248  virtual tmp<scalarField> he
249  (
250  const scalarField& T,
251  const labelList& cells
252  ) const;
253 
254  //- Enthalpy/Internal energy for patch [J/kg]
255  virtual tmp<scalarField> he
256  (
257  const scalarField& T,
258  const label patchi
259  ) const;
260 
261  //- Enthalpy/Internal energy for source [J/kg]
262  virtual tmp<scalarField> he
263  (
264  const scalarField& T,
265  const fvSource& source
266  ) const;
267 
268  //- Sensible enthalpy [J/kg]
269  virtual tmp<volScalarField> hs() const;
270 
271  //- Sensible enthalpy
272  // for given pressure and temperature [J/kg]
273  virtual tmp<volScalarField> hs
274  (
275  const volScalarField& p,
276  const volScalarField& T
277  ) const;
278 
279  //- Sensible enthalpy for cell-set [J/kg]
280  virtual tmp<scalarField> hs
281  (
282  const scalarField& T,
283  const labelList& cells
284  ) const;
285 
286  //- Sensible enthalpy for patch [J/kg]
287  virtual tmp<scalarField> hs
288  (
289  const scalarField& T,
290  const label patchi
291  ) const;
292 
293  //- Absolute enthalpy [J/kg/K]
294  virtual tmp<volScalarField> ha() const;
295 
296  //- Absolute enthalpy
297  // for given pressure and temperature [J/kg]
298  virtual tmp<volScalarField> ha
299  (
300  const volScalarField& p,
301  const volScalarField& T
302  ) const;
303 
304  //- Absolute enthalpy for patch [J/kg/K]
305  virtual tmp<scalarField> ha
306  (
307  const scalarField& T,
308  const label patchi
309  ) const;
310 
311  //- Absolute enthalpy for cell-set [J/kg]
312  virtual tmp<scalarField> ha
313  (
314  const scalarField& T,
315  const labelList& cells
316  ) const;
317 
318  //- Heat capacity at constant pressure for patch [J/kg/K]
319  virtual tmp<scalarField> Cp
320  (
321  const scalarField& T,
322  const label patchi
323  ) const;
324 
325  //- Heat capacity at constant volume for patch [J/kg/K]
326  virtual tmp<scalarField> Cv
327  (
328  const scalarField& T,
329  const label patchi
330  ) const;
331 
332  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
333  virtual tmp<scalarField> Cpv
334  (
335  const scalarField& T,
336  const label patchi
337  ) const;
338 
339 
340  // Temperature-energy inversion functions
341 
342  //- Temperature from enthalpy/internal energy
343  virtual tmp<volScalarField> The
344  (
345  const volScalarField& h,
346  const volScalarField& p,
347  const volScalarField& T0 // starting temperature
348  ) const;
349 
350  //- Temperature from enthalpy/internal energy for cell-set
351  virtual tmp<scalarField> The
352  (
353  const scalarField& he,
354  const scalarField& T0, // starting temperature
355  const labelList& cells
356  ) const;
357 
358  //- Temperature from enthalpy/internal energy for patch
359  virtual tmp<scalarField> The
360  (
361  const scalarField& he,
362  const scalarField& T0, // starting temperature
363  const label patchi
364  ) const;
365 
366 
367  // Transport state
368 
369  //- Return true as the thermal conductivity is isotropic
370  virtual bool isotropic() const
371  {
372  return true;
373  }
374 
375  //- Anisotropic thermal conductivity [W/m/K]
376  // Not implemented
377  virtual const volVectorField& Kappa() const;
378 
379 
380  //- Update properties
381  virtual void correct();
382 };
383 
384 
385 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
386 
387 } // End namespace Foam
388 
389 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
390 
391 #ifdef NoRepository
392  #include "constSolidThermoTemplates.C"
393 #endif
394 
395 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
396 
397 #endif
398 
399 // ************************************************************************* //
Generic GeometricField class.
Wrapper around a thermo which also constructs the physical properties dictionary.
virtual const volScalarField & T() const
Temperature [K].
Definition: basicThermo.C:363
virtual const word & phaseName() const
Phase name.
Definition: basicThermo.H:502
Uniform or non-uniform constant solid thermodynamic properties.
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
virtual word thermoName() const
Return the name of the thermo physics.
virtual bool incompressible() const
Return true if the equation of state is incompressible.
virtual void correct()
Update properties.
virtual tmp< volScalarField > ha() const
Absolute enthalpy [J/kg/K].
virtual ~constSolidThermo()
Destructor.
virtual const volScalarField & Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
VolField< Type > readProperty(const word &name, const dimensionSet &dimensions) const
virtual const volScalarField & he() const
Enthalpy/Internal energy [J/kg].
virtual tmp< volScalarField > hs() const
Sensible enthalpy [J/kg].
constSolidThermo(const fvMesh &, const bool readKappa, const word &phaseName=word::null)
Construct from mesh and phase name.
virtual const volScalarField & Cv() const
Heat capacity at constant volume [J/kg/K].
virtual bool isotropic() const
Return true as the thermal conductivity is isotropic.
virtual const volScalarField & Cp() const
Heat capacity at constant pressure [J/kg/K].
TypeName("constSolidThermo")
Runtime type information.
virtual const volVectorField & Kappa() const
Anisotropic thermal conductivity [W/m/K].
virtual tmp< volScalarField > The(const volScalarField &h, const volScalarField &p, const volScalarField &T0) const
Temperature from enthalpy/internal energy.
virtual bool isochoric() const
Return true if the equation of state is isochoric.
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:111
Dimension set for the base types.
Definition: dimensionSet.H:125
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Base class for finite volume sources.
Definition: fvSource.H:52
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
const cellShapeList & cells
const dimensionedScalar h
Planck constant.
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
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Definition: dimensionSets.C:96
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
volScalarField & p
scalar T0
Definition: createFields.H:22