BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / specie / transport / polynomial / polynomialTransportI.H
blob5482ef56488f33fd937c6cdbef2a1057579d2249
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.
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.
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.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "specie.H"
28 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
30 template<class Thermo, int PolySize>
31 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
33     const polynomialTransport& pt
36     Thermo(pt),
37     muCoeffs_(pt.muCoeffs_),
38     kappaCoeffs_(pt.kappaCoeffs_)
42 template<class Thermo, int PolySize>
43 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
45     const Thermo& t,
46     const Polynomial<PolySize>& muCoeffs,
47     const Polynomial<PolySize>& kappaCoeffs
50     Thermo(t),
51     muCoeffs_(muCoeffs),
52     kappaCoeffs_(kappaCoeffs)
56 template<class Thermo, int PolySize>
57 inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
59     const word& name,
60     const polynomialTransport& pt
63     Thermo(name, pt),
64     muCoeffs_(pt.muCoeffs_),
65     kappaCoeffs_(pt.kappaCoeffs_)
69 template<class Thermo, int PolySize>
70 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
71 Foam::polynomialTransport<Thermo, PolySize>::clone() const
73     return autoPtr<polynomialTransport<Thermo, PolySize> >
74     (
75         new polynomialTransport<Thermo, PolySize>(*this)
76     );
80 template<class Thermo, int PolySize>
81 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
82 Foam::polynomialTransport<Thermo, PolySize>::New(Istream& is)
84     return autoPtr<polynomialTransport<Thermo, PolySize> >
85     (
86         new polynomialTransport<Thermo, PolySize>(is)
87     );
91 template<class Thermo, int PolySize>
92 inline Foam::autoPtr<Foam::polynomialTransport<Thermo, PolySize> >
93 Foam::polynomialTransport<Thermo, PolySize>::New(const dictionary& dict)
95     return autoPtr<polynomialTransport<Thermo, PolySize> >
96     (
97         new polynomialTransport<Thermo, PolySize>(dict)
98     );
102 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
104 template<class Thermo, int PolySize>
105 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
107     const scalar T
108 ) const
110     return muCoeffs_.value(T)/this->W();
114 template<class Thermo, int PolySize>
115 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
117     const scalar T
118 ) const
120     return kappaCoeffs_.value(T)/this->W();
124 template<class Thermo, int PolySize>
125 inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alpha
127     const scalar T
128 ) const
130     scalar deltaT = T - specie::Tstd;
131     scalar CpBar =
132         (deltaT*(this->H(T) - this->H(specie::Tstd)) + this->Cp(T))
133        /(sqr(deltaT) + 1);
135     return kappa(T)/CpBar;
139 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
141 template<class Thermo, int PolySize>
142 inline Foam::polynomialTransport<Thermo, PolySize>&
143 Foam::polynomialTransport<Thermo, PolySize>::operator=
145     const polynomialTransport<Thermo, PolySize>& pt
148     Thermo::operator=(pt);
150     muCoeffs_ = pt.muCoeffs_;
151     kappaCoeffs_ = pt.kappaCoeffs_;
153     return *this;
157 template<class Thermo, int PolySize>
158 inline void Foam::polynomialTransport<Thermo, PolySize>::operator+=
160     const polynomialTransport<Thermo, PolySize>& pt
163     scalar molr1 = this->nMoles();
165     Thermo::operator+=(pt);
167     molr1 /= this->nMoles();
168     scalar molr2 = pt.nMoles()/this->nMoles();
170     muCoeffs_ = molr1*muCoeffs_ + molr2*pt.muCoeffs_;
171     kappaCoeffs_ = molr1*kappaCoeffs_ + molr2*pt.kappaCoeffs_;
175 template<class Thermo, int PolySize>
176 inline void Foam::polynomialTransport<Thermo, PolySize>::operator-=
178     const polynomialTransport<Thermo, PolySize>& pt
181     scalar molr1 = this->nMoles();
183     Thermo::operator-=(pt);
185     molr1 /= this->nMoles();
186     scalar molr2 = pt.nMoles()/this->nMoles();
188     muCoeffs_ = molr1*muCoeffs_ - molr2*pt.muCoeffs_;
189     kappaCoeffs_ = molr1*kappaCoeffs_ - molr2*pt.kappaCoeffs_;
193 template<class Thermo, int PolySize>
194 inline void Foam::polynomialTransport<Thermo, PolySize>::operator*=
196     const scalar s
199     Thermo::operator*=(s);
203 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
205 template<class Thermo, int PolySize>
206 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
208     const polynomialTransport<Thermo, PolySize>& pt1,
209     const polynomialTransport<Thermo, PolySize>& pt2
212     Thermo t
213     (
214         static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
215     );
217     scalar molr1 = pt1.nMoles()/t.nMoles();
218     scalar molr2 = pt2.nMoles()/t.nMoles();
220     return polynomialTransport<Thermo, PolySize>
221     (
222         t,
223         molr1*pt1.muCoeffs_ + molr2*pt2.muCoeffs_,
224         molr1*pt1.kappaCoeffs_ + molr2*pt2.kappaCoeffs_
225     );
229 template<class Thermo, int PolySize>
230 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator-
232     const polynomialTransport<Thermo, PolySize>& pt1,
233     const polynomialTransport<Thermo, PolySize>& pt2
236     Thermo t
237     (
238         static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
239     );
241     scalar molr1 = pt1.nMoles()/t.nMoles();
242     scalar molr2 = pt2.nMoles()/t.nMoles();
244     return polynomialTransport<Thermo, PolySize>
245     (
246         t,
247         molr1*pt1.muCoeffs_ - molr2*pt2.muCoeffs_,
248         molr1*pt1.kappaCoeffs_ - molr2*pt2.kappaCoeffs_
249     );
253 template<class Thermo, int PolySize>
254 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator*
256     const scalar s,
257     const polynomialTransport<Thermo, PolySize>& pt
260     return polynomialTransport<Thermo, PolySize>
261     (
262         s*static_cast<const Thermo&>(pt),
263         pt.muCoeffs_,
264         pt.kappaCoeffs_
265     );
269 template<class Thermo, int PolySize>
270 inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator==
272     const polynomialTransport<Thermo, PolySize>& pt1,
273     const polynomialTransport<Thermo, PolySize>& pt2
276     return pt2 - pt1;
280 // ************************************************************************* //