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

absorptionCoeffs.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) 2008-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 "absorptionCoeffs.H"
00027 #include <OpenFOAM/IOstreams.H>
00028 
00029 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00030 
00031 Foam::radiation::absorptionCoeffs::absorptionCoeffs(Istream& is)
00032 :
00033    Tcommon_(readScalar(is)),
00034    Tlow_(readScalar(is)),
00035    Thigh_(readScalar(is)),
00036    invTemp_(readBool(is))
00037 {
00038     for (label coefLabel=0; absorptionCoeffs::nCoeffs_; coefLabel++)
00039     {
00040         is >> highACoeffs_[coefLabel];
00041     }
00042 
00043     for (label coefLabel=0; absorptionCoeffs::nCoeffs_; coefLabel++)
00044     {
00045         is >> lowACoeffs_[coefLabel];
00046     }
00047 }
00048 
00049 
00050 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * //
00051 
00052 Foam::radiation::absorptionCoeffs::~absorptionCoeffs()
00053 {}
00054 
00055 
00056 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00057 
00058 void Foam::radiation::absorptionCoeffs::checkT(const scalar T) const
00059 {
00060     if (T < Tlow_ || T > Thigh_)
00061     {
00062         FatalErrorIn
00063         (
00064             "absorptionCoeffs::checkT(const scalar T) const"
00065         )   << "attempt to use absCoeff out of temperature range:" << nl
00066             << "    " << Tlow_ << " -> " << Thigh_ << ";  T = " << T
00067             << nl << abort(FatalError);
00068     }
00069 }
00070 
00071 
00072 const Foam::radiation::absorptionCoeffs::coeffArray&
00073 Foam::radiation::absorptionCoeffs::coeffs
00074 (
00075     const scalar T
00076 ) const
00077 {
00078     checkT(T);
00079 
00080     if (T < Tcommon_)
00081     {
00082         return lowACoeffs_;
00083     }
00084     else
00085     {
00086         return highACoeffs_;
00087     }
00088 }
00089 
00090 
00091 void Foam::radiation::absorptionCoeffs::initialise(Istream&)
00092 {
00093     absorptionCoeffs(Istream);
00094 }
00095 
00096 
00097 void Foam::radiation::absorptionCoeffs::initialise(const dictionary& dict)
00098 {
00099     dict.lookup("Tcommon") >> Tcommon_;
00100     dict.lookup("Tlow") >> Tlow_;
00101     dict.lookup("Thigh") >> Thigh_;
00102     dict.lookup("invTemp") >> invTemp_;
00103 
00104     dict.lookup("loTcoeffs") >> lowACoeffs_;
00105     dict.lookup("hiTcoeffs") >> highACoeffs_;
00106 }
00107 
00108 
00109 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines