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

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