sutherlandTransport.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 | Copyright (C) 2011-2015 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 
26 #include "sutherlandTransport.H"
27 #include "IOstreams.H"
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
31 template<class Thermo>
33 (
34  const word& coeffName,
35  const dictionary& dict
36 )
37 {
38  return readScalar(dict.subDict("transport").lookup(coeffName));
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
44 template<class Thermo>
46 :
47  Thermo(is),
48  As_(readScalar(is)),
49  Ts_(readScalar(is))
50 {
51  is.check("sutherlandTransport<Thermo>::sutherlandTransport(Istream&)");
52 }
53 
54 
55 template<class Thermo>
57 :
58  Thermo(dict),
59  As_(readCoeff("As", dict)),
60  Ts_(readCoeff("Ts", dict))
61 {}
62 
63 
64 template<class Thermo>
66 (
67  const Thermo& t,
68  const dictionary& dict
69 )
70 :
71  Thermo(t),
72  As_(readCoeff("As", dict)),
73  Ts_(readCoeff("Ts", dict))
74 {}
75 
76 
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 
79 template<class Thermo>
81 {
82  os << this->specie::name() << endl
84 
85  Thermo::write(os);
86 
87  dictionary dict("transport");
88  dict.add("As", As_);
89  dict.add("Ts", Ts_);
90 
91  os << indent << dict.dictName() << dict
93 }
94 
95 
96 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
97 
98 template<class Thermo>
99 Foam::Ostream& Foam::operator<<
100 (
101  Ostream& os,
103 )
104 {
105  os << static_cast<const Thermo&>(st) << tab << st.As_ << tab << st.Ts_;
106 
107  os.check
108  (
109  "Ostream& operator<<(Ostream&, const sutherlandTransport<Thermo>&)"
110  );
111 
112  return os;
113 }
114 
115 
116 // ************************************************************************* //
#define readScalar
Definition: doubleScalar.C:38
dictionary dict
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:223
static const char tab
Definition: Ostream.H:261
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void write(Ostream &os) const
Write to Ostream.
const word dictName() const
Return the local dictionary name (final part of scoped name)
Definition: dictionary.H:115
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:737
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
sutherlandTransport(const Thermo &t, const scalar As, const scalar Ts)
Construct from components.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
static const char nl
Definition: Ostream.H:262
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:237
Transport package using Sutherland&#39;s formula.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:230
runTime write()
const word & name() const
Name.
Definition: specieI.H:79