solidProperties.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2017 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::solidProperties
26 
27 Description
28  The thermophysical properties of a solid
29 
30 SourceFiles
31  solidProperties.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef solidProperties_H
36 #define solidProperties_H
37 
38 #include "typeInfo.H"
39 #include "autoPtr.H"
40 #include "runTimeSelectionTables.H"
41 #include "dictionary.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class solidProperties Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class solidProperties
53 {
54  // Private data
55 
56  //- Density [kg/m3]
57  scalar rho_;
58 
59  //- Specific heat capacity [J/(kg.K)]
60  scalar Cp_;
61 
62  //- Thermal conductivity [W/(m.K)]
63  scalar kappa_;
64 
65  //- Heat of formation [J/kg]
66  scalar Hf_;
67 
68  //- Emissivity
69  scalar emissivity_;
70 
71 
72 public:
73 
74  //- Runtime type information
75  TypeName("solid");
76 
77 
78  // Declare run-time constructor selection tables
79 
81  (
82  autoPtr,
84  ,
85  (),
86  ()
87  );
88 
90  (
91  autoPtr,
93  dictionary,
94  (const dictionary& dict),
95  (dict)
96  );
97 
98 
99  // Constructors
100 
101  //- Construct from components
103  (
104  scalar rho,
105  scalar Cp,
106  scalar kappa,
107  scalar Hf,
108  scalar emissivity
109  );
110 
111  //- Construct from dictionary
112  solidProperties(const dictionary& dict);
113 
114  //- Construct and return clone
115  virtual autoPtr<solidProperties> clone() const
116  {
117  return autoPtr<solidProperties>(new solidProperties(*this));
118  }
119 
120 
121  // Selectors
122 
123  //- Return a pointer to a new solidProperties created from name
124  static autoPtr<solidProperties> New(const word& name);
125 
126  //- Return a pointer to a new solidProperties created from dictionary
127  static autoPtr<solidProperties> New(const dictionary& dict);
128 
129 
130  //- Destructor
131  virtual ~solidProperties()
132  {}
133 
134 
135  // Member Functions
136 
137  // Physical constants which define the solidProperties
138 
139  //- Density [kg/m3]
140  inline scalar rho() const;
141 
142  //- Specific heat capacity [J/(kg.K)]
143  inline scalar Cp() const;
144 
145  //- Thermal conductivity [W/(m.K)]
146  inline scalar kappa() const;
147 
148  //- Heat of formation [J/kg]
149  inline scalar Hf() const;
150 
151  //- Sensible enthalpy - reference to Tstd [J/kg]
152  inline scalar Hs(const scalar T) const;
153 
154  //- Emissivity []
155  inline scalar emissivity() const;
156 
157 
158  // I-O
159 
160  //- Read and set the properties present it the given dictionary
161  void readIfPresent(const dictionary& dict);
162 
163  //- Write the solidProperties properties
164  virtual void writeData(Ostream& os) const;
165 
166  //- Ostream Operator
167  friend Ostream& operator<<(Ostream& os, const solidProperties& s);
168 };
169 
170 
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #include "solidPropertiesI.H"
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
solidProperties(scalar rho, scalar Cp, scalar kappa, scalar Hf, scalar emissivity)
Construct from components.
dictionary dict
scalar Cp() const
Specific heat capacity [J/(kg.K)].
scalar rho() const
Density [kg/m3].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual ~solidProperties()
Destructor.
scalar emissivity() const
Emissivity [].
virtual void writeData(Ostream &os) const
Write the solidProperties properties.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A class for handling words, derived from string.
Definition: word.H:59
scalar Hf() const
Heat of formation [J/kg].
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
friend Ostream & operator<<(Ostream &os, const solidProperties &s)
Ostream Operator.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual autoPtr< solidProperties > clone() const
Construct and return clone.
scalar kappa() const
Thermal conductivity [W/(m.K)].
scalar Hs(const scalar T) const
Sensible enthalpy - reference to Tstd [J/kg].
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
TypeName("solid")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, solidProperties,,(),())
The thermophysical properties of a solid.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
static autoPtr< solidProperties > New(const word &name)
Return a pointer to a new solidProperties created from name.
Namespace for OpenFOAM.