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 // ************************************************************************* //
Foam::dictionaryName::dictName
const word dictName() const
Return the local dictionary name (final part of scoped name)
Definition: dictionary.H:115
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::polynomialTransport::write
void write(Ostream &os) const
Write to Ostream.
Definition: polynomialTransport.C:73
Foam::polynomialTransport::kappaCoeffs_
Polynomial< PolySize > kappaCoeffs_
Thermal conductivity polynomial coefficients.
Definition: polynomialTransport.H:102
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::incrIndent
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:228
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::decrIndent
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:235
Foam::indent
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
Foam::tab
static const char tab
Definition: Ostream.H:259
Foam::polynomialTransport::muCoeffs_
Polynomial< PolySize > muCoeffs_
Dynamic viscosity polynomial coefficients.
Definition: polynomialTransport.H:98
Foam::token::END_BLOCK
@ END_BLOCK
Definition: token.H:105
Foam::polynomialTransport::polynomialTransport
polynomialTransport(const Thermo &t, const Polynomial< PolySize > &muPoly, const Polynomial< PolySize > &kappaPoly)
Construct from components.
Foam::polynomialTransport
Transport package using polynomial functions for mu and kappa.
Definition: polynomialTransport.H:47
PolySize
const int PolySize
Definition: Test-Polynomial.C:37
Foam::token::BEGIN_BLOCK
@ BEGIN_BLOCK
Definition: token.H:104
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::dictionary::subDict
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:631
write
Tcoeff write()
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::dictionary::add
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:729
polynomialTransport.H