initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / thermophysicalModels / specie / thermo / eConst / eConstThermoI.H
blob2f7d1faf4c0dba56c96cb53c167000bb1becf983
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
29 inline Foam::eConstThermo::eConstThermo
31     const specieThermo& st,
32     const scalar cv,
33     const scalar hf
36     specieThermo(st),
37     CV(cv),
38     Hf(hf)
42 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
44 inline Foam::eConstThermo::eConstThermo
46     const word& name,
47     const eConstThermo& ct
50     specieThermo(name, ct),
51     CV(ct.CV),
52     Hf(ct.Hf)
56 template<class equationOfState>
57 inline Foam::autoPtr<eConstThermo<equationOfState> >
58 Foam::eConstThermo<equationOfState>::clone() const
60     return autoPtr<eConstThermo<equationOfState> >
61     (
62         new eConstThermo<equationOfState>(*this)
63     );
67 template<class equationOfState>
68 inline autoPtr<eConstThermo<equationOfState> >
69 Foam::eConstThermo<equationOfState>::New(Istream& is)
71     return autoPtr<eConstThermo<equationOfState> >
72     (
73         new eConstThermo<equationOfState>(is)
74     );
78 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
80 inline Foam::scalar Foam::eConstThermo::cp(const scalar) const
82     return CV*W() + RR;
86 inline Foam::scalar Foam::eConstThermo::h(const scalar T) const
88     return cp(T)*T + Hf*W();
92 inline Foam::scalar Foam::eConstThermo::s(const scalar T) const
94     notImplemented("scalar eConstThermo::s(const scalar T) const");
95     return T;
99 inline Foam::scalar Foam::eConstThermo::TH
101     const scalar h,
102     const scalar T0
103 ) const
105     return (h - Hf)/Cp(T0);
109 inline Foam::scalar Foam::eConstThermo::TE
111     const scalar e,
112     const scalar
113 ) const
115     return (e - Hf)/CV;
119 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
121 inline Foam::eConstThermo& Foam::eConstThermo::operator=
123     const eConstThermo& ct
126     specieThermo::operator=(ct);
128     CV = ct.CV;
129     Hf = ct.Hf;
131     return *this;
135 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
137 inline Foam::eConstThermo Foam::operator+
139     const eConstThermo& ct1,
140     const eConstThermo& ct2
143     specieThermo st(((const specieThermo&)ct1) + ((const specieThermo&)ct2));
145     return eConstThermo
146     (
147         st,
148         ct1.nMoles()/st.nMoles()*ct1.CV + ct2.nMoles()/st.nMoles()*ct2.CV,
149         ct1.nMoles()/st.nMoles()*ct1.Hf + ct2.nMoles()/st.nMoles()*ct2.Hf
150     );
154 inline Foam::eConstThermo Foam::operator-
156     const eConstThermo& ct1,
157     const eConstThermo& ct2
160     specieThermo st(((const specieThermo&)ct1) - ((const specieThermo&)ct2));
162     return eConstThermo
163     (
164         st,
165         ct1.nMoles()/st.nMoles()*ct1.CV - ct2.nMoles()/st.nMoles()*ct2.CV,
166         ct1.nMoles()/st.nMoles()*ct1.Hf - ct2.nMoles()/st.nMoles()*ct2.Hf
167     );
171 inline Foam::eConstThermo Foam::operator*
173     const scalar s,
174     const eConstThermo& ct
177     return eConstThermo
178     (
179         s*((const specieThermo&)ct),
180         ct.CV,
181         ct.Hf
182     );
186 inline Foam::eConstThermo Foam::operator==
188     const eConstThermo& ct1,
189     const eConstThermo& ct2
192     return ct2 - ct1;
196 // ************************************************************************* //