BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / specie / thermo / eConst / eConstThermoI.H
blob31bd392b5dddb039a70898c3e7f0d23035553035
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 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
28 template<class EquationOfState>
29 inline Foam::eConstThermo<EquationOfState>::eConstThermo
31     const EquationOfState& st,
32     const scalar cv,
33     const scalar hf
36     EquationOfState(st),
37     Cv_(cv),
38     Hf_(hf)
42 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
44 template<class EquationOfState>
45 inline Foam::eConstThermo<EquationOfState>::eConstThermo
47     const word& name,
48     const eConstThermo<EquationOfState>& ct
51     EquationOfState(name, ct),
52     Cv_(ct.Cv_),
53     Hf_(ct.Hf_)
57 template<class EquationOfState>
58 inline Foam::autoPtr<Foam::eConstThermo<EquationOfState> >
59 Foam::eConstThermo<EquationOfState>::clone() const
61     return autoPtr<eConstThermo<EquationOfState> >
62     (
63         new eConstThermo<EquationOfState>(*this)
64     );
68 template<class EquationOfState>
69 inline Foam::autoPtr<Foam::eConstThermo<EquationOfState> >
70 Foam::eConstThermo<EquationOfState>::New(Istream& is)
72     return autoPtr<eConstThermo<EquationOfState> >
73     (
74         new eConstThermo<EquationOfState>(is)
75     );
79 template<class EquationOfState>
80 inline Foam::autoPtr<Foam::eConstThermo<EquationOfState> >
81 Foam::eConstThermo<EquationOfState>::New(const dictionary& dict)
83     return autoPtr<eConstThermo<EquationOfState> >
84     (
85         new eConstThermo<EquationOfState>(dict)
86     );
90 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
92 template<class EquationOfState>
93 inline Foam::scalar Foam::eConstThermo<EquationOfState>::limit
95     const scalar T
96 ) const
98     return T;
102 template<class EquationOfState>
103 inline Foam::scalar Foam::eConstThermo<EquationOfState>::cp
105     const scalar
106 ) const
108     return Cv_*this->W() + specie::RR;
112 template<class EquationOfState>
113 inline Foam::scalar Foam::eConstThermo<EquationOfState>::h
115     const scalar T
116 ) const
118     return cp(T)*T + Hf_*this->W();
122 template<class EquationOfState>
123 inline Foam::scalar Foam::eConstThermo<EquationOfState>::hs
125     const scalar T
126 ) const
128     return cp(T)*T;
132 template<class EquationOfState>
133 inline Foam::scalar Foam::eConstThermo<EquationOfState>::hc() const
135     return Hf_*this->W();
139 template<class EquationOfState>
140 inline Foam::scalar Foam::eConstThermo<EquationOfState>::s
142     const scalar T
143 ) const
145     notImplemented
146     (
147         "scalar eConstThermo<EquationOfState>::s(const scalar) const"
148     );
149     return T;
153 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
155 template<class EquationOfState>
156 inline void Foam::eConstThermo<EquationOfState>::operator+=
158     const eConstThermo<EquationOfState>& ct
161     scalar molr1 = this->nMoles();
163     EquationOfState::operator+=(ct);
165     molr1 /= this->nMoles();
166     scalar molr2 = ct.nMoles()/this->nMoles();
168     Cv_ = molr1*Cv_ + molr2*ct.Cv_;
169     Hf_ = molr1*Hf_ + molr2*ct.Hf_;
173 template<class EquationOfState>
174 inline void Foam::eConstThermo<EquationOfState>::operator-=
176     const eConstThermo<EquationOfState>& ct
179     scalar molr1 = this->nMoles();
181     EquationOfState::operator-=(ct);
183     molr1 /= this->nMoles();
184     scalar molr2 = ct.nMoles()/this->nMoles();
186     Cv_ = molr1*Cv_ - molr2*ct.Cv_;
187     Hf_ = molr1*Hf_ - molr2*ct.Hf_;
191 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
193 template<class EquationOfState>
194 inline Foam::eConstThermo<EquationOfState> Foam::operator+
196     const eConstThermo<EquationOfState>& ct1,
197     const eConstThermo<EquationOfState>& ct2
200     EquationOfState eofs
201     (
202         static_cast<const EquationOfState&>(ct1)
203       + static_cast<const EquationOfState&>(ct2)
204     );
206     return eConstThermo<EquationOfState>
207     (
208         eofs,
209         ct1.nMoles()/eofs.nMoles()*ct1.Cv_
210       + ct2.nMoles()/eofs.nMoles()*ct2.Cv_,
211         ct1.nMoles()/eofs.nMoles()*ct1.Hf_
212       + ct2.nMoles()/eofs.nMoles()*ct2.Hf_
213     );
217 template<class EquationOfState>
218 inline Foam::eConstThermo<EquationOfState> Foam::operator-
220     const eConstThermo<EquationOfState>& ct1,
221     const eConstThermo<EquationOfState>& ct2
224     EquationOfState eofs
225     (
226         static_cast<const EquationOfState&>(ct1)
227       - static_cast<const EquationOfState&>(ct2)
228     );
230     return eConstThermo<EquationOfState>
231     (
232         eofs,
233         ct1.nMoles()/eofs.nMoles()*ct1.Cv_
234       - ct2.nMoles()/eofs.nMoles()*ct2.Cv_,
235         ct1.nMoles()/eofs.nMoles()*ct1.Hf_
236       - ct2.nMoles()/eofs.nMoles()*ct2.Hf_
237     );
241 template<class EquationOfState>
242 inline Foam::eConstThermo<EquationOfState> Foam::operator*
244     const scalar s,
245     const eConstThermo<EquationOfState>& ct
248     return eConstThermo<EquationOfState>
249     (
250         s*static_cast<const EquationOfState&>(ct),
251         ct.Cv_,
252         ct.Hf_
253     );
257 template<class EquationOfState>
258 inline Foam::eConstThermo<EquationOfState> Foam::operator==
260     const eConstThermo<EquationOfState>& ct1,
261     const eConstThermo<EquationOfState>& ct2
264     return ct2 - ct1;
268 // ************************************************************************* //