polynomialSolidTransportI.H
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) 2013 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 "specie.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Thermo, int PolySize>
33 (
34  const polynomialSolidTransport& pt
35 )
36 :
37  Thermo(pt),
38  kappaCoeffs_(pt.kappaCoeffs_)
39 {}
40 
41 
42 template<class Thermo, int PolySize>
45 (
46  const Thermo& t,
47  const Polynomial<PolySize>& kappaCoeffs
48 )
49 :
50  Thermo(t),
51  kappaCoeffs_(kappaCoeffs)
52 {}
53 
54 
55 template<class Thermo, int PolySize>
58 (
59  const word& name,
60  const polynomialSolidTransport& pt
61 )
62 :
63  Thermo(name, pt),
64  kappaCoeffs_(pt.kappaCoeffs_)
65 {}
66 
67 
68 template<class Thermo, int PolySize>
71 {
73  (
75  );
76 }
77 
78 
79 template<class Thermo, int PolySize>
82 {
84  (
86  );
87 }
88 
89 
90 template<class Thermo, int PolySize>
93 {
95  (
97  );
98 }
99 
100 
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 
103 template<class Thermo, int PolySize>
105 (
106  const scalar p,
107  const scalar T
108 ) const
109 {
111  (
112  "Foam::scalar Foam::polynomialSolidTransport<thermo, PolySize>mu::"
113  "("
114  " const scalar p, const scalar T"
115  ") const"
116  );
117  return scalar(0);
118 }
119 
120 
121 template<class Thermo, int PolySize>
123 (
124  const scalar p,
125  const scalar T
126 ) const
127 {
128  return kappaCoeffs_.value(T);
129 }
130 
131 
132 template<class Thermo, int PolySize>
134 (
135  const scalar p,
136  const scalar T
137 ) const
138 {
139  const scalar kappa(kappaCoeffs_.value(T));
140  return vector(kappa, kappa, kappa);
141 }
142 
143 
144 template<class Thermo, int PolySize>
146 (
147  const scalar p, const scalar T
148 ) const
149 {
150  return kappa(p, T)/this->Cpv(p, T);
151 }
152 
153 
154 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
155 
156 template<class Thermo, int PolySize>
158 Foam::polynomialSolidTransport<Thermo, PolySize>::operator=
159 (
161 )
162 {
163  Thermo::operator=(pt);
164 
165  kappaCoeffs_ = pt.kappaCoeffs_;
166 
167  return *this;
168 }
169 
170 
171 template<class Thermo, int PolySize>
172 inline void Foam::polynomialSolidTransport<Thermo, PolySize>::operator+=
173 (
175 )
176 {
177  scalar molr1 = this->nMoles();
178 
179  Thermo::operator+=(pt);
180 
181  molr1 /= this->nMoles();
182  scalar molr2 = pt.nMoles()/this->nMoles();
183 
184  kappaCoeffs_ = molr1*kappaCoeffs_ + molr2*pt.kappaCoeffs_;
185 }
186 
187 
188 template<class Thermo, int PolySize>
189 inline void Foam::polynomialSolidTransport<Thermo, PolySize>::operator-=
190 (
192 )
193 {
194  scalar molr1 = this->nMoles();
195 
196  Thermo::operator-=(pt);
197 
198  molr1 /= this->nMoles();
199  scalar molr2 = pt.nMoles()/this->nMoles();
200 
201  kappaCoeffs_ = molr1*kappaCoeffs_ - molr2*pt.kappaCoeffs_;
202 }
203 
204 
205 template<class Thermo, int PolySize>
206 inline void Foam::polynomialSolidTransport<Thermo, PolySize>::operator*=
207 (
208  const scalar s
209 )
210 {
211  Thermo::operator*=(s);
212 }
213 
214 
215 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
216 
217 template<class Thermo, int PolySize>
219 (
222 )
223 {
224  Thermo t
225  (
226  static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
227  );
228 
229  scalar molr1 = pt1.nMoles()/t.nMoles();
230  scalar molr2 = pt2.nMoles()/t.nMoles();
231 
233  (
234  t,
235  molr1*pt1.kappaCoeffs_ + molr2*pt2.kappaCoeffs_
236  );
237 }
238 
239 
240 template<class Thermo, int PolySize>
242 (
245 )
246 {
247  Thermo t
248  (
249  static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
250  );
251 
252  scalar molr1 = pt1.nMoles()/t.nMoles();
253  scalar molr2 = pt2.nMoles()/t.nMoles();
254 
256  (
257  t,
258  molr1*pt1.kappaCoeffs_ - molr2*pt2.kappaCoeffs_
259  );
260 }
261 
262 
263 template<class Thermo, int PolySize>
265 (
266  const scalar s,
268 )
269 {
271  (
272  s*static_cast<const Thermo&>(pt),
273  pt.kappaCoeffs_
274  );
275 }
276 
277 
278 template<class Thermo, int PolySize>
280 (
283 )
284 {
285  return pt2 - pt1;
286 }
287 
288 
289 // ************************************************************************* //
Polynomial templated on size (order):
Definition: Polynomial.H:63
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject( name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
Transport package using polynomial functions for solid kappa.
autoPtr< polynomialSolidTransport > clone() const
Construct and return a clone.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A class for handling words, derived from string.
Definition: word.H:59
scalar kappa(const scalar p, const scalar T) const
Thermal conductivity [W/mK].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dictionary dict
scalar mu(const scalar p, const scalar T) const
Dynamic viscosity [kg/ms].
static autoPtr< polynomialSolidTransport > New(Istream &is)
vector Kappa(const scalar p, const scalar T) const
Thermal conductivity [W/mK].
scalar alphah(const scalar p, const scalar T) const
Thermal diffusivity of enthalpy [kg/ms].
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:356
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117