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

ThermoCloudI.H

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 "radiationConstants.H"
00028 
00029 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00030 
00031 template<class ParcelType>
00032 inline const typename ParcelType::constantProperties&
00033 Foam::ThermoCloud<ParcelType>::constProps() const
00034 {
00035     return constProps_;
00036 }
00037 
00038 
00039 template<class ParcelType>
00040 inline const Foam::basicThermo&
00041 Foam::ThermoCloud<ParcelType>::carrierThermo() const
00042 {
00043     return carrierThermo_;
00044 }
00045 
00046 
00047 template<class ParcelType>
00048 inline Foam::basicThermo&
00049 Foam::ThermoCloud<ParcelType>::carrierThermo()
00050 {
00051     return carrierThermo_;
00052 }
00053 
00054 
00055 template<class ParcelType>
00056 inline const Foam::HeatTransferModel<Foam::ThermoCloud<ParcelType> >&
00057 Foam::ThermoCloud<ParcelType>::heatTransfer() const
00058 {
00059     return heatTransferModel_;
00060 }
00061 
00062 
00063 template<class ParcelType>
00064 inline const Foam::scalarIntegrationScheme&
00065 Foam::ThermoCloud<ParcelType>::TIntegrator() const
00066 {
00067     return TIntegrator_;
00068 }
00069 
00070 
00071 template<class ParcelType>
00072 inline bool Foam::ThermoCloud<ParcelType>::radiation() const
00073 {
00074     return radiation_;
00075 }
00076 
00077 
00078 template<class ParcelType>
00079 inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
00080 Foam::ThermoCloud<ParcelType>::hsTrans()
00081 {
00082     return hsTrans_;
00083 }
00084 
00085 
00086 template<class ParcelType>
00087 inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
00088 Foam::ThermoCloud<ParcelType>::Shs() const
00089 {
00090     tmp<DimensionedField<scalar, volMesh> > tShs
00091     (
00092         new DimensionedField<scalar, volMesh>
00093         (
00094             IOobject
00095             (
00096                 this->name() + "Shs",
00097                 this->db().time().timeName(),
00098                 this->mesh(),
00099                 IOobject::NO_READ,
00100                 IOobject::AUTO_WRITE,
00101                 false
00102             ),
00103             this->mesh(),
00104             dimensionedScalar
00105             (
00106                 "zero",
00107                 dimMass/dimLength/pow3(dimTime),
00108                 0.0
00109             )
00110         )
00111     );
00112 
00113     scalarField& Shs = tShs().field();
00114     Shs = hsTrans_/(this->mesh().V()*this->db().time().deltaT());
00115 
00116     return tShs;
00117 }
00118 
00119 
00120 template<class ParcelType>
00121 inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
00122 Foam::ThermoCloud<ParcelType>::hcTrans()
00123 {
00124     return hcTrans_;
00125 }
00126 
00127 
00128 template<class ParcelType>
00129 inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
00130 Foam::ThermoCloud<ParcelType>::Shc() const
00131 {
00132     tmp<DimensionedField<scalar, volMesh> > tShc
00133     (
00134         new DimensionedField<scalar, volMesh>
00135         (
00136             IOobject
00137             (
00138                 this->name() + "Shc",
00139                 this->db().time().timeName(),
00140                 this->mesh(),
00141                 IOobject::NO_READ,
00142                 IOobject::AUTO_WRITE,
00143                 false
00144             ),
00145             this->mesh(),
00146             dimensionedScalar
00147             (
00148                 "zero",
00149                 dimMass/dimLength/pow3(dimTime),
00150                 0.0
00151             )
00152         )
00153     );
00154 
00155     scalarField& Shc = tShc().field();
00156     Shc = hcTrans_/(this->mesh().V()*this->db().time().deltaT());
00157 
00158     return tShc;
00159 }
00160 
00161 
00162 template<class ParcelType>
00163 inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
00164 Foam::ThermoCloud<ParcelType>::Sh() const
00165 {
00166     tmp<DimensionedField<scalar, volMesh> > tSh
00167     (
00168         new DimensionedField<scalar, volMesh>
00169         (
00170             IOobject
00171             (
00172                 this->name() + "Sh",
00173                 this->db().time().timeName(),
00174                 this->mesh(),
00175                 IOobject::NO_READ,
00176                 IOobject::AUTO_WRITE,
00177                 false
00178             ),
00179             this->mesh(),
00180             dimensionedScalar
00181             (
00182                 "zero",
00183                 dimMass/dimLength/pow3(dimTime),
00184                 0.0
00185             )
00186         )
00187     );
00188 
00189     scalarField& Sh = tSh().field();
00190     Sh = (hsTrans_ + hcTrans_)/(this->mesh().V()*this->db().time().deltaT());
00191 
00192     return tSh;
00193 }
00194 
00195 
00196 template<class ParcelType>
00197 inline Foam::tmp<Foam::volScalarField>
00198 Foam::ThermoCloud<ParcelType>::Ep() const
00199 {
00200     tmp<volScalarField> tEp
00201     (
00202         new volScalarField
00203         (
00204             IOobject
00205             (
00206                 this->name() + "radiationEp",
00207                 this->db().time().timeName(),
00208                 this->db(),
00209                 IOobject::NO_READ,
00210                 IOobject::NO_WRITE,
00211                 false
00212             ),
00213             this->mesh(),
00214             dimensionedScalar("zero", dimMass/dimLength/pow3(dimTime), 0.0)
00215         )
00216     );
00217 
00218     // Need to check if coupled as field is created on-the-fly
00219     if (radiation_ && this->coupled())
00220     {
00221         scalarField& Ep = tEp().internalField();
00222         const scalarField& V = this->mesh().V();
00223         const scalar epsilon = constProps_.epsilon0();
00224 
00225         forAllConstIter(typename ThermoCloud<ParcelType>, *this, iter)
00226         {
00227             const ParcelType& p = iter();
00228             const label cellI = p.cell();
00229             Ep[cellI] += p.nParticle()*p.areaP()*pow4(p.T());
00230         }
00231 
00232         Ep *= epsilon*radiation::sigmaSB.value()/V;
00233     }
00234 
00235     return tEp;
00236 }
00237 
00238 
00239 template<class ParcelType>
00240 inline Foam::tmp<Foam::volScalarField>
00241 Foam::ThermoCloud<ParcelType>::ap() const
00242 {
00243     tmp<volScalarField> tap
00244     (
00245         new volScalarField
00246         (
00247             IOobject
00248             (
00249                 this->name() + "radiationAp",
00250                 this->db().time().timeName(),
00251                 this->db(),
00252                 IOobject::NO_READ,
00253                 IOobject::NO_WRITE,
00254                 false
00255             ),
00256             this->mesh(),
00257             dimensionedScalar("zero", dimless/dimLength, 0.0)
00258         )
00259     );
00260 
00261     // Need to check if coupled as field is created on-the-fly
00262     if (radiation_ && this->coupled())
00263     {
00264         scalarField& ap = tap().internalField();
00265         const scalarField& V = this->mesh().V();
00266         const scalar epsilon = constProps_.epsilon0();
00267 
00268         forAllConstIter(typename ThermoCloud<ParcelType>, *this, iter)
00269         {
00270             const ParcelType& p = iter();
00271             const label cellI = p.cell();
00272             ap[cellI] += p.nParticle()*p.areaP();
00273         }
00274 
00275         ap *= epsilon/V;
00276     }
00277 
00278     return tap;
00279 }
00280 
00281 
00282 template<class ParcelType>
00283 inline Foam::tmp<Foam::volScalarField>
00284 Foam::ThermoCloud<ParcelType>::sigmap() const
00285 {
00286     tmp<volScalarField> tsigmap
00287     (
00288         new volScalarField
00289         (
00290             IOobject
00291             (
00292                 this->name() + "radiationSigmap",
00293                 this->db().time().timeName(),
00294                 this->db(),
00295                 IOobject::NO_READ,
00296                 IOobject::NO_WRITE,
00297                 false
00298             ),
00299             this->mesh(),
00300             dimensionedScalar("zero", dimless/dimLength, 0.0)
00301         )
00302     );
00303 
00304     // Need to check if coupled as field is created on-the-fly
00305     if (radiation_ && this->coupled())
00306     {
00307         scalarField& sigmap = tsigmap().internalField();
00308 
00309         const scalarField& V = this->mesh().V();
00310         const scalar epsilon = constProps_.epsilon0();
00311         const scalar f = constProps_.f0();
00312 
00313         forAllConstIter(typename ThermoCloud<ParcelType>, *this, iter)
00314         {
00315             const ParcelType& p = iter();
00316             const label cellI = p.cell();
00317             sigmap[cellI] += p.nParticle()*p.areaP();
00318         }
00319 
00320         sigmap *= (1.0 - f)*(1.0 - epsilon)/V;
00321     }
00322 
00323     return tsigmap;
00324 }
00325 
00326 
00327 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd