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 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 
118 #include "solidThermo.H"
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 namespace Foam
123 {
124 
125 /*---------------------------------------------------------------------------*\
126  Class constSolidThermo Declaration
127 \*---------------------------------------------------------------------------*/
128 
129 class constSolidThermo
130 :
132 {
133  // Private data
134 
135  //- Heat capacity at constant volume [J/kg/K]
136  volScalarField Cv_;
137 
138  //- Internal energy [J/kg]
139  volScalarField e_;
140 
141 
142 protected:
143 
144  // Protected constructors
145 
146  //- Construct from mesh and phase name
148  (
149  const fvMesh&,
150  const bool readKappa,
151  const word& phaseName = word::null
152  );
153 
154 
155  // Protected Member Functions
156 
157  template<class Type>
159  (
160  const word& name,
161  const dimensionSet& dimensions
162  ) const;
163 
164 
165 public:
166 
167  //- Runtime type information
168  TypeName("constSolidThermo");
169 
170 
171  // Constructors
172 
173  //- Construct from mesh and phase name
175  (
176  const fvMesh&,
177  const word& phaseName = word::null
178  );
179 
180 
181  //- Destructor
182  virtual ~constSolidThermo();
183 
184 
185  // Member Functions
186 
187  //- Return the name of the thermo physics
188  virtual word thermoName() const
189  {
190  return type();
191  }
192 
193  //- Return true if the equation of state is incompressible
194  // i.e. rho != f(p)
195  virtual bool incompressible() const
196  {
197  return true;
198  }
199 
200  //- Return true if the equation of state is isochoric
201  // i.e. rho = const
202  virtual bool isochoric() const
203  {
204  return true;
205  }
206 
207 
208  // Access to thermophysical state variables
209 
210  //- Enthalpy/Internal energy [J/kg]
211  // Non-const access allowed for transport equations
212  virtual volScalarField& he();
213 
214  //- Enthalpy/Internal energy [J/kg]
215  virtual const volScalarField& he() const;
216 
217  //- Heat capacity at constant pressure [J/kg/K]
218  virtual const volScalarField& Cp() const;
219 
220  //- Heat capacity at constant volume [J/kg/K]
221  virtual const volScalarField& Cv() const;
222 
223  //- Heat capacity at constant pressure/volume [J/kg/K]
224  virtual const volScalarField& Cpv() const;
225 
226 
227  // Access to transport state variables
228 
229  //- Return true as the thermal conductivity is isotropic
230  virtual bool isotropic() const
231  {
232  return true;
233  }
234 
235  //- Anisotropic thermal conductivity [W/m/K]
236  // Not implemented
237  virtual const volVectorField& Kappa() const;
238 
239 
240  // Fields derived from thermodynamic state variables
241 
242  //- Enthalpy/Internal energy
243  // for given pressure and temperature [J/kg]
244  virtual tmp<volScalarField> he
245  (
246  const volScalarField& p,
247  const volScalarField& T
248  ) const;
249 
250  //- Enthalpy/Internal energy for cell-set [J/kg]
251  virtual tmp<scalarField> he
252  (
253  const scalarField& T,
254  const labelList& cells
255  ) const;
256 
257  //- Enthalpy/Internal energy for patch [J/kg]
258  virtual tmp<scalarField> he
259  (
260  const scalarField& T,
261  const label patchi
262  ) const;
263 
264  //- Sensible enthalpy [J/kg]
265  virtual tmp<volScalarField> hs() const;
266 
267  //- Sensible enthalpy
268  // for given pressure and temperature [J/kg]
269  virtual tmp<volScalarField> hs
270  (
271  const volScalarField& p,
272  const volScalarField& T
273  ) const;
274 
275  //- Sensible enthalpy for cell-set [J/kg]
276  virtual tmp<scalarField> hs
277  (
278  const scalarField& T,
279  const labelList& cells
280  ) const;
281 
282  //- Sensible enthalpy for patch [J/kg]
283  virtual tmp<scalarField> hs
284  (
285  const scalarField& T,
286  const label patchi
287  ) const;
288 
289  //- Absolute enthalpy [J/kg/K]
290  virtual tmp<volScalarField> ha() const;
291 
292  //- Absolute enthalpy
293  // for given pressure and temperature [J/kg]
294  virtual tmp<volScalarField> ha
295  (
296  const volScalarField& p,
297  const volScalarField& T
298  ) const;
299 
300  //- Absolute enthalpy for patch [J/kg/K]
301  virtual tmp<scalarField> ha
302  (
303  const scalarField& T,
304  const label patchi
305  ) const;
306 
307  //- Absolute enthalpy for cell-set [J/kg]
308  virtual tmp<scalarField> ha
309  (
310  const scalarField& T,
311  const labelList& cells
312  ) const;
313 
314  //- Enthalpy of formation [J/kg]
315  virtual tmp<volScalarField> hc() const;
316 
317  //- Temperature from enthalpy/internal energy
318  virtual tmp<volScalarField> THE
319  (
320  const volScalarField& h,
321  const volScalarField& p,
322  const volScalarField& T0 // starting temperature
323  ) const;
324 
325  //- Temperature from enthalpy/internal energy for cell-set
326  virtual tmp<scalarField> THE
327  (
328  const scalarField& he,
329  const scalarField& T0, // starting temperature
330  const labelList& cells
331  ) const;
332 
333  //- Temperature from enthalpy/internal energy for patch
334  virtual tmp<scalarField> THE
335  (
336  const scalarField& he,
337  const scalarField& T0, // starting temperature
338  const label patchi
339  ) const;
340 
341  //- Heat capacity at constant pressure for patch [J/kg/K]
342  virtual tmp<scalarField> Cp
343  (
344  const scalarField& T,
345  const label patchi
346  ) const;
347 
348  //- Heat capacity at constant volume for patch [J/kg/K]
349  virtual tmp<scalarField> Cv
350  (
351  const scalarField& T,
352  const label patchi
353  ) const;
354 
355  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
356  virtual tmp<scalarField> Cpv
357  (
358  const scalarField& T,
359  const label patchi
360  ) const;
361 
362 
363  //- Update properties
364  virtual void correct();
365 
366 
367  // I-O
368 
369  //- Read thermophysicalProperties dictionary
370  virtual bool read();
371 };
372 
373 
374 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
375 
376 } // End namespace Foam
377 
378 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
379 
380 #ifdef NoRepository
381  #include "constSolidThermoTemplates.C"
382 #endif
383 
384 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
385 
386 #endif
387 
388 // ************************************************************************* //
Generic GeometricField class.
virtual const volScalarField & T() const
Temperature [K].
Definition: basicThermo.C:369
virtual const word & phaseName() const
Phase name.
Definition: basicThermo.H:490
Uniform or non-uniform constant solid thermodynamic properties.
virtual volScalarField & he()
Enthalpy/Internal energy [J/kg].
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 tmp< volScalarField > hc() const
Enthalpy of formation [J/kg].
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 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 tmp< volScalarField > THE(const volScalarField &h, const volScalarField &p, const volScalarField &T0) const
Temperature from enthalpy/internal energy.
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 bool read()
Read thermophysicalProperties dictionary.
virtual bool isochoric() const
Return true if the equation of state is isochoric.
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:109
Dimension set for the base types.
Definition: dimensionSet.H:122
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
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
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