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-2025 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
248  // for given pressure and temperature [J/kg]
250  (
253  ) const;
254 
255  //- Enthalpy/Internal energy for cell-set [J/kg]
256  virtual tmp<scalarField> he
257  (
258  const scalarField& T,
259  const labelList& cells
260  ) const;
261 
262  //- Enthalpy/Internal energy for patch [J/kg]
263  virtual tmp<scalarField> he
264  (
265  const scalarField& T,
266  const label patchi
267  ) const;
268 
269  //- Enthalpy/Internal energy for source [J/kg]
271  (
273  const fvSource& model,
274  const volScalarField::Internal& source
275  ) const;
276 
277  //- Enthalpy/Internal energy for source [J/kg]
278  virtual tmp<scalarField> he
279  (
280  const scalarField& T,
281  const fvSource& model,
282  const scalarField& source,
283  const labelUList& cells
284  ) const;
285 
286  //- Sensible enthalpy [J/kg]
287  virtual tmp<volScalarField> hs() const;
288 
289  //- Sensible enthalpy
290  // for given pressure and temperature [J/kg]
291  virtual tmp<volScalarField> hs
292  (
293  const volScalarField& p,
294  const volScalarField& T
295  ) const;
296 
297  //- Sensible enthalpy
298  // for given pressure and temperature [J/kg]
300  (
303  ) const;
304 
305  //- Sensible enthalpy for cell-set [J/kg]
306  virtual tmp<scalarField> hs
307  (
308  const scalarField& T,
309  const labelList& cells
310  ) const;
311 
312  //- Sensible enthalpy for patch [J/kg]
313  virtual tmp<scalarField> hs
314  (
315  const scalarField& T,
316  const label patchi
317  ) const;
318 
319  //- Absolute enthalpy [J/kg/K]
320  virtual tmp<volScalarField> ha() const;
321 
322  //- Absolute enthalpy
323  // for given pressure and temperature [J/kg]
324  virtual tmp<volScalarField> ha
325  (
326  const volScalarField& p,
327  const volScalarField& T
328  ) const;
329 
330  //- Absolute enthalpy
331  // for given pressure and temperature [J/kg]
333  (
336  ) const;
337 
338  //- Absolute enthalpy for patch [J/kg/K]
339  virtual tmp<scalarField> ha
340  (
341  const scalarField& T,
342  const label patchi
343  ) const;
344 
345  //- Absolute enthalpy for cell-set [J/kg]
346  virtual tmp<scalarField> ha
347  (
348  const scalarField& T,
349  const labelList& cells
350  ) const;
351 
352  //- Heat capacity at constant pressure for patch [J/kg/K]
353  virtual tmp<scalarField> Cp
354  (
355  const scalarField& T,
356  const label patchi
357  ) const;
358 
359  //- Heat capacity at constant volume for patch [J/kg/K]
360  virtual tmp<scalarField> Cv
361  (
362  const scalarField& T,
363  const label patchi
364  ) const;
365 
366  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
367  virtual tmp<scalarField> Cpv
368  (
369  const scalarField& T,
370  const label patchi
371  ) const;
372 
373 
374  // Temperature-energy inversion functions
375 
376  //- Temperature from enthalpy/internal energy
377  virtual tmp<volScalarField> The
378  (
379  const volScalarField& h,
380  const volScalarField& p,
381  const volScalarField& T0 // starting temperature
382  ) const;
383 
384  //- Temperature from enthalpy/internal energy for cell-set
385  virtual tmp<scalarField> The
386  (
387  const scalarField& he,
388  const scalarField& T0, // starting temperature
389  const labelList& cells
390  ) const;
391 
392  //- Temperature from enthalpy/internal energy for patch
393  virtual tmp<scalarField> The
394  (
395  const scalarField& he,
396  const scalarField& T0, // starting temperature
397  const label patchi
398  ) const;
399 
400 
401  // Transport state
402 
403  //- Return true as the thermal conductivity is isotropic
404  virtual bool isotropic() const
405  {
406  return true;
407  }
408 
409  //- Anisotropic thermal conductivity [W/m/K]
410  // Not implemented
411  virtual const volVectorField& Kappa() const;
412 
413 
414  //- Update properties
415  virtual void correct();
416 };
417 
418 
419 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
420 
421 } // End namespace Foam
422 
423 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
424 
425 #ifdef NoRepository
426  #include "constSolidThermoTemplates.C"
427 #endif
428 
429 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
430 
431 #endif
432 
433 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
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:536
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:96
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