polynomialTransport.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 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 "polynomialTransport.H"
27 #include "IOstreams.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Thermo, int PolySize>
33 :
34  Thermo(is),
35  muCoeffs_("muCoeffs<" + Foam::name(PolySize) + '>', is),
36  kappaCoeffs_("kappaCoeffs<" + Foam::name(PolySize) + '>', is)
37 {
38  muCoeffs_ *= this->W();
39  kappaCoeffs_ *= this->W();
40 }
41 
42 
43 template<class Thermo, int PolySize>
45 (
46  const dictionary& dict
47 )
48 :
49  Thermo(dict),
50  muCoeffs_
51  (
52  dict.subDict("transport").lookup
53  (
54  "muCoeffs<" + Foam::name(PolySize) + '>'
55  )
56  ),
57  kappaCoeffs_
58  (
59  dict.subDict("transport").lookup
60  (
61  "kappaCoeffs<" + Foam::name(PolySize) + '>'
62  )
63  )
64 {
65  muCoeffs_ *= this->W();
66  kappaCoeffs_ *= this->W();
67 }
68 
69 
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 
72 template<class Thermo, int PolySize>
74 {
75  os << this->name() << endl;
76  os << token::BEGIN_BLOCK << incrIndent << nl;
77 
78  Thermo::write(os);
79 
80  dictionary dict("transport");
81  dict.add
82  (
83  word("muCoeffs<" + Foam::name(PolySize) + '>'),
84  muCoeffs_/this->W()
85  );
86  dict.add
87  (
88  word("kappaCoeffs<" + Foam::name(PolySize) + '>'),
89  kappaCoeffs_/this->W()
90  );
91  os << indent << dict.dictName() << dict;
92 
93  os << decrIndent << token::END_BLOCK << nl;
94 }
95 
96 
97 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
98 
99 template<class Thermo, int PolySize>
100 Foam::Ostream& Foam::operator<<
101 (
102  Ostream& os,
104 )
105 {
106  os << static_cast<const Thermo&>(pt) << tab
107  << "muCoeffs<" << Foam::name(PolySize) << '>' << tab
108  << pt.muCoeffs_/pt.W() << tab
109  << "kappaCoeffs<" << Foam::name(PolySize) << '>' << tab
110  << pt.kappaCoeffs_/pt.W();
111 
112  os.check
113  (
114  "Ostream& operator<<"
115  "("
116  "Ostream&, "
117  "const polynomialTransport<Thermo, PolySize>&"
118  ")"
119  );
120 
121  return os;
122 }
123 
124 
125 // ************************************************************************* //
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
const word dictName() const
Return the local dictionary name (final part of scoped name)
Definition: dictionary.H:115
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:633
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...
void write(Ostream &os) const
Write to Ostream.
A class for handling words, derived from string.
Definition: word.H:59
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
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:230
Transport package using polynomial functions for mu and kappa.
runTime write()
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:451