thermophysicalProperties.C
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) 2017-2019 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 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(thermophysicalProperties, 0);
33  defineRunTimeSelectionTable(thermophysicalProperties,);
34  defineRunTimeSelectionTable(thermophysicalProperties, dictionary);
35 }
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 :
41  W_(W)
42 {}
43 
44 
46 :
47  W_(dict.lookup<scalar>("W"))
48 {}
49 
50 
51 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
52 
55 (
56  const word& name
57 )
58 {
59  if (debug)
60  {
61  InfoInFunction << "Constructing thermophysicalProperties" << endl;
62  }
63 
64  ConstructorTable::iterator cstrIter = ConstructorTablePtr_->find(name);
65 
66  if (cstrIter == ConstructorTablePtr_->end())
67  {
69  << "Unknown thermophysicalProperties type "
70  << name << nl << nl
71  << "Valid thermophysicalProperties types are:" << nl
72  << ConstructorTablePtr_->sortedToc()
73  << exit(FatalError);
74  }
75 
76  return autoPtr<thermophysicalProperties>(cstrIter()());
77 }
78 
79 
82 (
83  const dictionary& dict
84 )
85 {
86  if (debug)
87  {
88  InfoInFunction << "Constructing thermophysicalProperties" << endl;
89  }
90 
91  const word& thermophysicalPropertiesTypeName = dict.dictName();
92 
93  dictionaryConstructorTable::iterator cstrIter =
94  dictionaryConstructorTablePtr_->find(thermophysicalPropertiesTypeName);
95 
96  if (cstrIter == dictionaryConstructorTablePtr_->end())
97  {
99  << "Unknown thermophysicalProperties type "
100  << thermophysicalPropertiesTypeName << nl << nl
101  << "Valid thermophysicalProperties types are:" << nl
102  << dictionaryConstructorTablePtr_->sortedToc()
103  << exit(FatalError);
104  }
105 
106  return autoPtr<thermophysicalProperties>(cstrIter()(dict));
107 }
108 
109 
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 
113 {
114  dict.readIfPresent("W", W_);
115 }
116 
117 
119 {
120  writeEntry(os, "W", W_);
121 }
122 
123 
124 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
125 
127 {
128  l.write(os);
129  return os;
130 }
131 
132 
133 // ************************************************************************* //
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
dictionary dict
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
const word dictName() const
Return the local dictionary name (final part of scoped name)
Definition: dictionary.H:121
stressControl lookup("compactNormalStress") >> compactNormalStress
static autoPtr< thermophysicalProperties > New(const word &name)
Return a pointer to a new thermophysicalProperties created from name.
A class for handling words, derived from string.
Definition: word.H:59
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static const char nl
Definition: Ostream.H:260
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
virtual void write(Ostream &os) const =0
Write the function coefficients.
defineTypeNameAndDebug(combustionModel, 0)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
const scalarList W(::W(thermo))
Ostream & operator<<(Ostream &, const ensightPart &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
thermophysicalProperties(scalar W)
Construct from molecular weight.
Namespace for OpenFOAM.
#define InfoInFunction
Report an information message using Foam::Info.