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