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

radiationModel.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 "radiationModel.H"
00028 #include "absorptionEmissionModel.H"
00029 #include "scatterModel.H"
00030 #include "fvm.H"
00031 
00032 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036     namespace radiation
00037     {
00038         defineTypeNameAndDebug(radiationModel, 0);
00039         defineRunTimeSelectionTable(radiationModel, dictionary);
00040     }
00041 }
00042 
00043 
00044 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00045 
00046 Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
00047 :
00048     IOdictionary
00049     (
00050         IOobject
00051         (
00052             "radiationProperties",
00053             T.time().constant(),
00054             T.mesh(),
00055             IOobject::MUST_READ,
00056             IOobject::NO_WRITE
00057         )
00058     ),
00059     mesh_(T.mesh()),
00060     time_(T.time()),
00061     T_(T),
00062     radiation_(false),
00063     coeffs_(dictionary::null),
00064     solverFreq_(0),
00065     absorptionEmission_(NULL),
00066     scatter_(NULL)
00067 {}
00068 
00069 
00070 Foam::radiation::radiationModel::radiationModel
00071 (
00072     const word& type,
00073     const volScalarField& T
00074 )
00075 :
00076     IOdictionary
00077     (
00078         IOobject
00079         (
00080             "radiationProperties",
00081             T.time().constant(),
00082             T.mesh(),
00083             IOobject::MUST_READ,
00084             IOobject::NO_WRITE
00085         )
00086     ),
00087     mesh_(T.mesh()),
00088     time_(T.time()),
00089     T_(T),
00090     radiation_(lookup("radiation")),
00091     coeffs_(subDict(type + "Coeffs")),
00092     solverFreq_(readLabel(lookup("solverFreq"))),
00093     absorptionEmission_(absorptionEmissionModel::New(*this, mesh_)),
00094     scatter_(scatterModel::New(*this, mesh_))
00095 {
00096     solverFreq_ = max(1, solverFreq_);
00097 }
00098 
00099 
00100 // * * * * * * * * * * * * * * * * Destructor    * * * * * * * * * * * * * * //
00101 
00102 Foam::radiation::radiationModel::~radiationModel()
00103 {}
00104 
00105 
00106 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00107 
00108 bool Foam::radiation::radiationModel::read()
00109 {
00110     if (regIOobject::read())
00111     {
00112         lookup("radiation") >> radiation_;
00113         coeffs_ = subDict(type() + "Coeffs");
00114 
00115         return true;
00116     }
00117     else
00118     {
00119         return false;
00120     }
00121 }
00122 
00123 
00124 void Foam::radiation::radiationModel::correct()
00125 {
00126     if (!radiation_)
00127     {
00128         return;
00129     }
00130 
00131     if (time_.timeIndex() % solverFreq_ == 0)
00132     {
00133         calculate();
00134     }
00135 }
00136 
00137 
00138 Foam::tmp<Foam::fvScalarMatrix> Foam::radiation::radiationModel::Sh
00139 (
00140     basicThermo& thermo
00141 ) const
00142 {
00143     volScalarField& h = thermo.h();
00144     const volScalarField cp = thermo.Cp();
00145     const volScalarField T3 = pow3(T_);
00146 
00147     return
00148     (
00149         Ru()
00150       - fvm::Sp(4.0*Rp()*T3/cp, h)
00151       - Rp()*T3*(T_ - 4.0*h/cp)
00152     );
00153 }
00154 
00155 
00156 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd