FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

janafThermo.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "janafThermo.H"
00027 #include <OpenFOAM/IOstreams.H>
00028 
00029 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00030 
00031 template<class equationOfState>
00032 Foam::janafThermo<equationOfState>::janafThermo(Istream& is)
00033 :
00034     equationOfState(is),
00035     Tlow_(readScalar(is)),
00036     Thigh_(readScalar(is)),
00037     Tcommon_(readScalar(is))
00038 {
00039     if (Tlow_ >= Thigh_)
00040     {
00041         FatalIOErrorIn
00042         (
00043             "janafThermo<equationOfState>::janafThermo(Istream& is)",
00044             is
00045         )   << "Tlow(" << Tlow_ << ") >= Thigh(" << Thigh_ << ')'
00046             << exit(FatalIOError);
00047     }
00048 
00049     if (Tcommon_ <= Tlow_)
00050     {
00051         FatalIOErrorIn
00052         (
00053             "janafThermo<equationOfState>::janafThermo(Istream& is)",
00054             is
00055         )   << "Tcommon(" << Tcommon_ << ") <= Tlow(" << Tlow_ << ')'
00056             << exit(FatalIOError);
00057     }
00058 
00059     if (Tcommon_ > Thigh_)
00060     {
00061         FatalIOErrorIn
00062         (
00063             "janafThermo<equationOfState>::janafThermo(Istream& is)",
00064             is
00065         )   << "Tcommon(" << Tcommon_ << ") > Thigh(" << Thigh_ << ')'
00066             << exit(FatalIOError);
00067     }
00068 
00069     for
00070     (
00071         register label coefLabel=0;
00072         coefLabel<janafThermo<equationOfState>::nCoeffs_;
00073         coefLabel++
00074     )
00075     {
00076         is >> highCpCoeffs_[coefLabel];
00077     }
00078 
00079     for
00080     (
00081         register label coefLabel=0;
00082         coefLabel<janafThermo<equationOfState>::nCoeffs_;
00083         coefLabel++
00084     )
00085     {
00086         is >> lowCpCoeffs_[coefLabel];
00087     }
00088 
00089     // Check state of Istream
00090     is.check("janafThermo::janafThermo(Istream& is)");
00091 }
00092 
00093 
00094 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
00095 
00096 template<class equationOfState>
00097 Foam::Ostream& Foam::operator<<
00098 (
00099     Ostream& os,
00100     const janafThermo<equationOfState>& jt
00101 )
00102 {
00103     os  << static_cast<const equationOfState&>(jt) << nl
00104         << "    " << jt.Tlow_
00105         << tab << jt.Thigh_
00106         << tab << jt.Tcommon_;
00107 
00108     os << nl << "    ";
00109 
00110     for
00111     (
00112         register label coefLabel=0;
00113         coefLabel<janafThermo<equationOfState>::nCoeffs_;
00114         coefLabel++
00115     )
00116     {
00117         os << jt.highCpCoeffs_[coefLabel] << ' ';
00118     }
00119 
00120     os << nl << "    ";
00121 
00122     for
00123     (
00124         register label coefLabel=0;
00125         coefLabel<janafThermo<equationOfState>::nCoeffs_;
00126         coefLabel++
00127     )
00128     {
00129         os << jt.lowCpCoeffs_[coefLabel] << ' ';
00130     }
00131 
00132     os << endl;
00133 
00134     os.check
00135     (
00136         "operator<<(Ostream& os, const janafThermo<equationOfState>& jt)"
00137     );
00138 
00139     return os;
00140 }
00141 
00142 
00143 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines