intersection with triangle plane for miss
[OpenFOAM-1.5.x.git] / src / thermophysicalModels / specie / thermo / janaf / janafThermo.C
blob5a3d05b848c56484b4124294abd748a8f088291b
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 Description
26     JANAF tables based thermodynamics package templated ito the equationOfState.
28 \*---------------------------------------------------------------------------*/
30 #include "janafThermo.H"
31 #include "IOstreams.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
40 template<class equationOfState>
41 janafThermo<equationOfState>::janafThermo(Istream& is)
43     equationOfState(is),
44     Tlow_(readScalar(is)),
45     Thigh_(readScalar(is)),
46     Tcommon_(readScalar(is))
48     if (Tlow_ >= Thigh_)
49     {
50         FatalIOErrorIn
51         (
52             "janafThermo<equationOfState>::janafThermo(Istream& is)",
53             is
54         )   << "Tlow(" << Tlow_ << ") >= Thigh(" << Thigh_ << ')'
55             << exit(FatalIOError);
56     }
58     if (Tcommon_ <= Tlow_)
59     {
60         FatalIOErrorIn
61         (
62             "janafThermo<equationOfState>::janafThermo(Istream& is)",
63             is
64         )   << "Tcommon(" << Tcommon_ << ") <= Tlow(" << Tlow_ << ')'
65             << exit(FatalIOError);
66     }
68     if (Tcommon_ > Thigh_)
69     {
70         FatalIOErrorIn
71         (
72             "janafThermo<equationOfState>::janafThermo(Istream& is)",
73             is
74         )   << "Tcommon(" << Tcommon_ << ") > Thigh(" << Thigh_ << ')'
75             << exit(FatalIOError);
76     }
78     for
79     (
80         register label coefLabel=0;
81         coefLabel<janafThermo<equationOfState>::nCoeffs_;
82         coefLabel++
83     )
84     {
85         is >> highCpCoeffs_[coefLabel];
86     }
88     for
89     (
90         register label coefLabel=0;
91         coefLabel<janafThermo<equationOfState>::nCoeffs_;
92         coefLabel++
93     )
94     {
95         is >> lowCpCoeffs_[coefLabel];
96     }
98     // Check state of Istream
99     is.check("janafThermo::janafThermo(Istream& is)");
103 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
105 template<class equationOfState>
106 Ostream& operator<<(Ostream& os, const janafThermo<equationOfState>& jt)
108     os  << static_cast<const equationOfState&>(jt) << nl
109         << "    " << jt.Tlow_
110         << tab << jt.Thigh_
111         << tab << jt.Tcommon_;
113     os << nl << "    ";
115     for
116     (
117         register label coefLabel=0;
118         coefLabel<janafThermo<equationOfState>::nCoeffs_;
119         coefLabel++
120     )
121     {
122         os << jt.highCpCoeffs_[coefLabel] << ' ';
123     }
125     os << nl << "    ";
127     for
128     (
129         register label coefLabel=0;
130         coefLabel<janafThermo<equationOfState>::nCoeffs_;
131         coefLabel++
132     )
133     {
134         os << jt.lowCpCoeffs_[coefLabel] << ' ';
135     }
137     os << endl;
139     os.check
140     (
141         "operator<<(Ostream& os, const janafThermo<equationOfState>& jt)"
142     );
144     return os;
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 } // End namespace Foam
152 // ************************************************************************* //