Loading...
Searching...
No Matches
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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2018-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::solidProperties
29
30Description
31 The thermophysical, mechanical properties of a solid
32
33SourceFiles
34 solidProperties.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_solidProperties_H
39#define Foam_solidProperties_H
40
41#include "typeInfo.H"
42#include "autoPtr.H"
44#include "dictionary.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
51/*---------------------------------------------------------------------------*\
52 Class solidProperties Declaration
53\*---------------------------------------------------------------------------*/
54
56{
57 // Private Data
58
59 //- Density [kg/m3]
60 scalar rho_;
61
62 //- Specific heat capacity [J/(kg.K)]
63 scalar Cp_;
64
65 //- Thermal conductivity [W/(m.K)]
66 scalar kappa_;
67
68 //- Heat of formation [J/kg]
69 scalar Hf_;
70
71 //- Emissivity
72 scalar emissivity_;
73
74 //- Molar weight [Kg/Kmol]
75 scalar W_;
76
77 //- Poisson ratio
78 scalar nu_;
79
80 //- Young Modulus [N/m2]
81 scalar E_;
82
83
84public:
85
86 // Public Data Types
87
88 //- Simple categories of solid properties.
89 // Can be leveraged eg, for mechanical-only vs thermal-only etc
90 enum categories
91 {
93 MECHANICAL = (1),
95 THERMAL = (2),
97 REGULAR = 0xFF
98 };
99
100
101 //- Runtime type information
102 TypeName("solid");
103
105 // Declare run-time constructor selection tables
106
108 (
112 (),
113 ()
114 );
115
117 (
121 (const dictionary& dict),
122 (dict)
123 );
124
125
126 // Constructors
127
128 //- Default construct
130
131 //- Construct from components
133 (
134 scalar rho,
135 scalar Cp,
136 scalar kappa,
137 scalar Hf,
138 scalar emissivity,
139 scalar W,
140 scalar nu,
141 scalar E
142 ) noexcept;
143
144 //- Construct from dictionary
145 explicit solidProperties(const dictionary& dict);
146
147 //- Construct from dictionary with category-specific handling
148 solidProperties(const dictionary& dict, categories category);
149
150
151 //- Construct and return clone
152 virtual autoPtr<solidProperties> clone() const
153 {
154 return autoPtr<solidProperties>::New(*this);
155 }
156
157
158 // Factory Methods
159
160 //- Clone solidProperties
161 template<class Derived>
162 static autoPtr<solidProperties> Clone(const Derived& prop)
163 {
164 return autoPtr<solidProperties>(new Derived(prop));
165 }
166
167 //- Return a pointer to a new solidProperties created from name
168 static autoPtr<solidProperties> New(const word& name);
169
170 //- Return a pointer to a new solidProperties created from dictionary
171 static autoPtr<solidProperties> New(const dictionary& dict);
172
173
174 //- Destructor
175 virtual ~solidProperties() = default;
176
177
178 // Member Functions
179
180 // Physical constants which define the solidProperties
181
182 //- Density [kg/m3]
183 scalar rho() const noexcept { return rho_; }
184
185 //- Specific heat capacity [J/(kg.K)]
186 scalar Cp() const { return Cp_; }
187
188 //- Thermal conductivity [W/(m.K)]
189 scalar kappa() const noexcept { return kappa_; }
191 //- Heat of formation [J/kg]
192 scalar Hf() const noexcept { return Hf_; }
193
194 //- Sensible enthalpy - reference to Tstd [J/kg]
195 inline scalar Hs(const scalar T) const;
196
197 //- Emissivity []
198 scalar emissivity() const noexcept { return emissivity_;}
199
200 //- Molar weight [Kg/Kmol]
201 scalar W() const noexcept { return W_; }
202
203 //- Poisson ratio
204 scalar nu() const noexcept { return nu_; }
205
206 //- Young modulus [N/m2]
207 scalar E() const noexcept { return E_; }
208
210 // I-O
211
212 //- Read and set the properties if present in the given dictionary
213 void readIfPresent(const dictionary& dict);
214
215 //- Write the solidProperties properties
216 virtual void writeData(Ostream& os) const;
217
218 //- Ostream Operator
220};
221
222
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228} // End namespace Foam
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#include "solidPropertiesI.H"
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#endif
237
238// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
The thermophysical, mechanical properties of a solid.
static autoPtr< solidProperties > Clone(const Derived &prop)
Clone solidProperties.
solidProperties() noexcept
Default construct.
virtual ~solidProperties()=default
Destructor.
static autoPtr< solidProperties > New(const word &name)
Return a pointer to a new solidProperties created from name.
scalar Hs(const scalar T) const
Sensible enthalpy - reference to Tstd [J/kg].
virtual void writeData(Ostream &os) const
Write the solidProperties properties.
scalar kappa() const noexcept
Thermal conductivity [W/(m.K)].
scalar E() const noexcept
Young modulus [N/m2].
TypeName("solid")
Runtime type information.
categories
Simple categories of solid properties.
@ MECHANICAL
Needs mechanical only [E, nu].
@ THERMAL
Needs thermal only [Cp, kappa, emissivity?].
@ REGULAR
thermal: mandatory, mechanical: optional
scalar Cp() const
Specific heat capacity [J/(kg.K)].
declareRunTimeSelectionTable(autoPtr, solidProperties, dictionary,(const dictionary &dict),(dict))
scalar W() const noexcept
Molar weight [Kg/Kmol].
friend Ostream & operator<<(Ostream &os, const solidProperties &s)
Ostream Operator.
virtual autoPtr< solidProperties > clone() const
Construct and return clone.
scalar nu() const noexcept
Poisson ratio.
scalar rho() const noexcept
Density [kg/m3].
scalar emissivity() const noexcept
Emissivity [].
declareRunTimeSelectionTable(autoPtr, solidProperties,,(),())
scalar Hf() const noexcept
Heat of formation [J/kg].
void readIfPresent(const dictionary &dict)
Read and set the properties if present in the given dictionary.
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
auto & name
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
const direction noexcept
Definition scalarImpl.H:265
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
dictionary dict
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68