OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "janafThermo.H"
00028 #include "IOstreams.H"
00029 
00030 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00031 
00032 template<class equationOfState>
00033 Foam::janafThermo<equationOfState>::janafThermo(Istream& is)
00034 :
00035     equationOfState(is),
00036     Tlow_(readScalar(is)),
00037     Thigh_(readScalar(is)),
00038     Tcommon_(readScalar(is))
00039 {
00040     if (Tlow_ >= Thigh_)
00041     {
00042         FatalIOErrorIn
00043         (
00044             "janafThermo<equationOfState>::janafThermo(Istream& is)",
00045             is
00046         )   << "Tlow(" << Tlow_ << ") >= Thigh(" << Thigh_ << ')'
00047             << exit(FatalIOError);
00048     }
00049 
00050     if (Tcommon_ <= Tlow_)
00051     {
00052         FatalIOErrorIn
00053         (
00054             "janafThermo<equationOfState>::janafThermo(Istream& is)",
00055             is
00056         )   << "Tcommon(" << Tcommon_ << ") <= Tlow(" << Tlow_ << ')'
00057             << exit(FatalIOError);
00058     }
00059 
00060     if (Tcommon_ > Thigh_)
00061     {
00062         FatalIOErrorIn
00063         (
00064             "janafThermo<equationOfState>::janafThermo(Istream& is)",
00065             is
00066         )   << "Tcommon(" << Tcommon_ << ") > Thigh(" << Thigh_ << ')'
00067             << exit(FatalIOError);
00068     }
00069 
00070     for
00071     (
00072         register label coefLabel=0;
00073         coefLabel<janafThermo<equationOfState>::nCoeffs_;
00074         coefLabel++
00075     )
00076     {
00077         is >> highCpCoeffs_[coefLabel];
00078     }
00079 
00080     for
00081     (
00082         register label coefLabel=0;
00083         coefLabel<janafThermo<equationOfState>::nCoeffs_;
00084         coefLabel++
00085     )
00086     {
00087         is >> lowCpCoeffs_[coefLabel];
00088     }
00089 
00090     // Check state of Istream
00091     is.check("janafThermo::janafThermo(Istream& is)");
00092 }
00093 
00094 
00095 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
00096 
00097 template<class equationOfState>
00098 Foam::Ostream& Foam::operator<<
00099 (
00100     Ostream& os,
00101     const janafThermo<equationOfState>& jt
00102 )
00103 {
00104     os  << static_cast<const equationOfState&>(jt) << nl
00105         << "    " << jt.Tlow_
00106         << tab << jt.Thigh_
00107         << tab << jt.Tcommon_;
00108 
00109     os << nl << "    ";
00110 
00111     for
00112     (
00113         register label coefLabel=0;
00114         coefLabel<janafThermo<equationOfState>::nCoeffs_;
00115         coefLabel++
00116     )
00117     {
00118         os << jt.highCpCoeffs_[coefLabel] << ' ';
00119     }
00120 
00121     os << nl << "    ";
00122 
00123     for
00124     (
00125         register label coefLabel=0;
00126         coefLabel<janafThermo<equationOfState>::nCoeffs_;
00127         coefLabel++
00128     )
00129     {
00130         os << jt.lowCpCoeffs_[coefLabel] << ' ';
00131     }
00132 
00133     os << endl;
00134 
00135     os.check
00136     (
00137         "operator<<(Ostream& os, const janafThermo<equationOfState>& jt)"
00138     );
00139 
00140     return os;
00141 }
00142 
00143 
00144 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd