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

P1.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 "P1.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvm.H"
00030 
00031 #include "absorptionEmissionModel.H"
00032 #include "scatterModel.H"
00033 #include "mathematicalConstants.H"
00034 #include "radiationConstants.H"
00035 
00036 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00037 
00038 namespace Foam
00039 {
00040     namespace radiation
00041     {
00042         defineTypeNameAndDebug(P1, 0);
00043 
00044         addToRunTimeSelectionTable
00045         (
00046             radiationModel,
00047             P1,
00048             dictionary
00049         );
00050     }
00051 }
00052 
00053 
00054 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00055 
00056 Foam::radiation::P1::P1(const volScalarField& T)
00057 :
00058     radiationModel(typeName, T),
00059     G_
00060     (
00061         IOobject
00062         (
00063             "G",
00064             mesh_.time().timeName(),
00065             mesh_,
00066             IOobject::MUST_READ,
00067             IOobject::AUTO_WRITE
00068         ),
00069         mesh_
00070     ),
00071     a_
00072     (
00073         IOobject
00074         (
00075             "a",
00076             mesh_.time().timeName(),
00077             mesh_,
00078             IOobject::NO_READ,
00079             IOobject::NO_WRITE
00080         ),
00081         mesh_,
00082         dimensionedScalar("a", dimless/dimLength, 0.0)
00083     ),
00084     e_
00085     (
00086         IOobject
00087         (
00088             "e",
00089             mesh_.time().timeName(),
00090             mesh_,
00091             IOobject::NO_READ,
00092             IOobject::NO_WRITE
00093         ),
00094         mesh_,
00095         dimensionedScalar("a", dimless/dimLength, 0.0)
00096     ),
00097     E_
00098     (
00099         IOobject
00100         (
00101             "E",
00102             mesh_.time().timeName(),
00103             mesh_,
00104             IOobject::NO_READ,
00105             IOobject::NO_WRITE
00106         ),
00107         mesh_,
00108         dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0.0)
00109     )
00110 {}
00111 
00112 
00113 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00114 
00115 Foam::radiation::P1::~P1()
00116 {}
00117 
00118 
00119 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00120 
00121 bool Foam::radiation::P1::read()
00122 {
00123     if (radiationModel::read())
00124     {
00125         // nothing to read
00126 
00127         return true;
00128     }
00129     else
00130     {
00131         return false;
00132     }
00133 }
00134 
00135 
00136 void Foam::radiation::P1::calculate()
00137 {
00138     a_ = absorptionEmission_->a();
00139     e_ = absorptionEmission_->e();
00140     E_ = absorptionEmission_->E();
00141     const volScalarField sigmaEff = scatter_->sigmaEff();
00142 
00143     // Construct diffusion
00144     const volScalarField gamma
00145     (
00146         IOobject
00147         (
00148             "gammaRad",
00149             G_.mesh().time().timeName(),
00150             G_.mesh(),
00151             IOobject::NO_READ,
00152             IOobject::NO_WRITE
00153         ),
00154         1.0/(3.0*a_ + sigmaEff)
00155     );
00156 
00157     // Solve G transport equation
00158     solve
00159     (
00160         fvm::laplacian(gamma, G_)
00161       - fvm::Sp(a_, G_)
00162      ==
00163       - 4.0*(e_*radiation::sigmaSB*pow4(T_) + E_)
00164     );
00165 }
00166 
00167 
00168 Foam::tmp<Foam::volScalarField> Foam::radiation::P1::Rp() const
00169 {
00170     return tmp<volScalarField>
00171     (
00172         new volScalarField
00173         (
00174             IOobject
00175             (
00176                 "Rp",
00177                 mesh_.time().timeName(),
00178                 mesh_,
00179                 IOobject::NO_READ,
00180                 IOobject::NO_WRITE,
00181                 false
00182             ),
00183             4.0*absorptionEmission_->eCont()*radiation::sigmaSB
00184         )
00185     );
00186 }
00187 
00188 
00189 Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
00190 Foam::radiation::P1::Ru() const
00191 {
00192     const DimensionedField<scalar, volMesh>& G =
00193         G_.dimensionedInternalField();
00194     const DimensionedField<scalar, volMesh> E =
00195         absorptionEmission_->ECont()().dimensionedInternalField();
00196     const DimensionedField<scalar, volMesh> a =
00197         absorptionEmission_->aCont()().dimensionedInternalField();
00198 
00199     return  a*G - 4.0*E;
00200 }
00201 
00202 
00203 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd