solidProperties.C
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-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "solidProperties.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(solidProperties, 0);
36  defineRunTimeSelectionTable(solidProperties,);
37  defineRunTimeSelectionTable(solidProperties, dictionary);
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  scalar rho,
46  scalar Cp,
47  scalar kappa,
48  scalar Hf,
49  scalar emissivity,
50  scalar W,
51  scalar nu,
52  scalar E
53 )
54 :
55  rho_(rho),
56  Cp_(Cp),
57  kappa_(kappa),
58  Hf_(Hf),
59  emissivity_(emissivity),
60  W_(W),
61  nu_(nu),
62  E_(E)
63 {}
64 
65 
67 :
68  rho_(dict.get<scalar>("rho")),
69  Cp_(dict.get<scalar>("Cp")),
70  kappa_(dict.getCompat<scalar>("kappa", {{"K", 1612}})),
71  Hf_(dict.get<scalar>("Hf")),
72  emissivity_(dict.get<scalar>("emissivity")),
73  W_(dict.get<scalar>("W")),
74  nu_(dict.getOrDefault<scalar>("nu", 0.0)),
75  E_(dict.getOrDefault<scalar>("E", 0.0))
76 {}
77 
78 
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 
82 {
83  dict.readIfPresent("rho", rho_);
84  dict.readIfPresent("Cp", Cp_);
85  dict.readIfPresentCompat("kappa", {{"K", 1612}}, kappa_);
86  dict.readIfPresent("Hf", Hf_);
87  dict.readIfPresent("emissivity", emissivity_);
88  dict.readIfPresent("W", W_);
89  dict.readIfPresent("nu", nu_);
90  dict.readIfPresent("E", E_);
91 }
92 
93 
95 {
96  os << rho_ << token::SPACE
97  << Cp_ << token::SPACE
98  << kappa_ << token::SPACE
99  << Hf_ << token::SPACE
100  << emissivity_ << token::SPACE
101  << W_ << token::SPACE
102  << nu_ << token::SPACE
103  << E_;
104 }
105 
106 
107 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
108 
110 {
111  s.writeData(os);
112  return os;
113 }
114 
115 
116 // ************************************************************************* //
s
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))
Definition: gmvOutputSpray.H:25
Foam::solidProperties::writeData
virtual void writeData(Ostream &os) const
Write the solidProperties properties.
Definition: solidProperties.C:94
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::solidProperties
The thermophysical properties of a solid.
Definition: solidProperties.H:54
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:107
Foam::constant::electromagnetic::kappa
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
rho
rho
Definition: readInitialConditions.H:88
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::solidProperties::readIfPresent
void readIfPresent(const dictionary &dict)
Read and set the properties if present in the given dictionary.
Definition: solidProperties.C:81
Foam::dictionary::readIfPresentCompat
bool readIfPresentCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, T &val, enum keyType::option=keyType::REGEX) const
Definition: dictionaryTemplates.C:463
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::solidProperties::solidProperties
solidProperties(scalar rho, scalar Cp, scalar kappa, scalar Hf, scalar emissivity, scalar W, scalar nu, scalar E)
Construct from components.
Definition: solidProperties.C:44
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
Cp
const volScalarField & Cp
Definition: EEqn.H:7
Foam::PtrListOps::get
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:148
solidProperties.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:405