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-2026 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 mixture
189  virtual word mixtureName() const
190  {
191  return type();
192  }
193 
194  //- Return the name of the thermo physics
195  virtual word thermoName() const
196  {
197  return type();
198  }
199 
200  //- Return true if the equation of state is incompressible
201  // i.e. rho != f(p)
202  virtual bool incompressible() const
203  {
204  return true;
205  }
206 
207  //- Return true if the equation of state is isochoric
208  // i.e. rho = const
209  virtual bool isochoric() const
210  {
211  return true;
212  }
213 
214 
215  // Molecular properties
216 
217  //- Molecular weight [kg/kmol]
218  virtual tmp<volScalarField> W() const;
219 
220  //- Molecular weight for patch [kg/kmol]
221  virtual tmp<scalarField> W(const label patchi) const;
222 
223 
224  // Thermodynamic state
225 
226  //- Enthalpy/Internal energy [J/kg]
227  virtual const volScalarField& he() const;
228 
229  //- Enthalpy/Internal energy [J/kg]
230  // Non-const access allowed for transport equations
231  virtual volScalarField& he();
232 
233  //- Heat capacity at constant pressure [J/kg/K]
234  virtual const volScalarField& Cp() const;
235 
236  //- Heat capacity at constant volume [J/kg/K]
237  virtual const volScalarField& Cv() const;
238 
239  //- Heat capacity at constant pressure/volume [J/kg/K]
240  virtual const volScalarField& Cpv() const;
241 
242 
243  // Derived thermodynamic properties
244 
245  //- Enthalpy/Internal energy
246  // for given pressure and temperature [J/kg]
247  virtual tmp<volScalarField> he
248  (
249  const volScalarField& p,
250  const volScalarField& T
251  ) const;
252 
253  //- Enthalpy/Internal energy
254  // for given pressure and temperature [J/kg]
256  (
259  ) const;
260 
261  //- Enthalpy/Internal energy for cell-set [J/kg]
262  virtual tmp<scalarField> he
263  (
264  const scalarField& T,
265  const labelList& cells
266  ) const;
267 
268  //- Enthalpy/Internal energy for patch [J/kg]
269  virtual tmp<scalarField> he
270  (
271  const scalarField& T,
272  const label patchi
273  ) const;
274 
275  //- Enthalpy/Internal energy for source [J/kg]
277  (
279  const fvSource& model,
280  const volScalarField::Internal& source
281  ) const;
282 
283  //- Enthalpy/Internal energy for source [J/kg]
284  virtual tmp<scalarField> he
285  (
286  const scalarField& T,
287  const fvSource& model,
288  const scalarField& source,
289  const labelUList& cells
290  ) const;
291 
292  //- Sensible enthalpy [J/kg]
293  virtual tmp<volScalarField> hs() const;
294 
295  //- Sensible enthalpy
296  // for given pressure and temperature [J/kg]
297  virtual tmp<volScalarField> hs
298  (
299  const volScalarField& p,
300  const volScalarField& T
301  ) const;
302 
303  //- Sensible enthalpy
304  // for given pressure and temperature [J/kg]
306  (
309  ) const;
310 
311  //- Sensible enthalpy for cell-set [J/kg]
312  virtual tmp<scalarField> hs
313  (
314  const scalarField& T,
315  const labelList& cells
316  ) const;
317 
318  //- Sensible enthalpy for patch [J/kg]
319  virtual tmp<scalarField> hs
320  (
321  const scalarField& T,
322  const label patchi
323  ) const;
324 
325  //- Absolute enthalpy [J/kg/K]
326  virtual tmp<volScalarField> ha() const;
327 
328  //- Absolute enthalpy
329  // for given pressure and temperature [J/kg]
330  virtual tmp<volScalarField> ha
331  (
332  const volScalarField& p,
333  const volScalarField& T
334  ) const;
335 
336  //- Absolute enthalpy
337  // for given pressure and temperature [J/kg]
339  (
342  ) const;
343 
344  //- Absolute enthalpy for patch [J/kg/K]
345  virtual tmp<scalarField> ha
346  (
347  const scalarField& T,
348  const label patchi
349  ) const;
350 
351  //- Absolute enthalpy for cell-set [J/kg]
352  virtual tmp<scalarField> ha
353  (
354  const scalarField& T,
355  const labelList& cells
356  ) const;
357 
358  //- Heat capacity at constant pressure for patch [J/kg/K]
359  virtual tmp<scalarField> Cp
360  (
361  const scalarField& T,
362  const label patchi
363  ) const;
364 
365  //- Heat capacity at constant volume for patch [J/kg/K]
366  virtual tmp<scalarField> Cv
367  (
368  const scalarField& T,
369  const label patchi
370  ) const;
371 
372  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
373  virtual tmp<scalarField> Cpv
374  (
375  const scalarField& T,
376  const label patchi
377  ) const;
378 
379 
380  // Temperature-energy inversion functions
381 
382  //- Temperature from enthalpy/internal energy
383  virtual tmp<volScalarField> The
384  (
385  const volScalarField& h,
386  const volScalarField& p,
387  const volScalarField& T0 // starting temperature
388  ) const;
389 
390  //- Temperature from enthalpy/internal energy for cell-set
391  virtual tmp<scalarField> The
392  (
393  const scalarField& he,
394  const scalarField& T0, // starting temperature
395  const labelList& cells
396  ) const;
397 
398  //- Temperature from enthalpy/internal energy for patch
399  virtual tmp<scalarField> The
400  (
401  const scalarField& he,
402  const scalarField& T0, // starting temperature
403  const label patchi
404  ) const;
405 
406 
407  // Transport state
408 
409  //- Return true as the thermal conductivity is isotropic
410  virtual bool isotropic() const
411  {
412  return true;
413  }
414 
415  //- Anisotropic thermal conductivity [W/m/K]
416  // Not implemented
417  virtual const volVectorField& Kappa() const;
418 
419 
420  //- Update properties
421  virtual void correct();
422 };
423 
424 
425 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
426 
427 } // End namespace Foam
428 
429 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
430 
431 #ifdef NoRepository
432  #include "constSolidThermoTemplates.C"
433 #endif
434 
435 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
436 
437 #endif
438 
439 // ************************************************************************* //
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:376
virtual const word & phaseName() const
Phase name.
Definition: basicThermo.H:545
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 word mixtureName() const
Return the name of the mixture.
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:98
Base class for finite volume sources.
Definition: fvSource.H:53
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:78
const scalar T0
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
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