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

MarshakRadiationFixedTMixedFvPatchScalarField.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 "MarshakRadiationFixedTMixedFvPatchScalarField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "volFields.H"
00031 
00032 #include "fvc.H"
00033 #include "radiationModel.H"
00034 #include "radiationConstants.H"
00035 
00036 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00037 
00038 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
00039 MarshakRadiationFixedTMixedFvPatchScalarField
00040 (
00041     const fvPatch& p,
00042     const DimensionedField<scalar, volMesh>& iF
00043 )
00044 :
00045     mixedFvPatchScalarField(p, iF),
00046     Trad_(p.size()),
00047     emissivity_(0.0)
00048 {
00049     refValue() = 0.0;
00050     refGrad() = 0.0;
00051     valueFraction() = 0.0;
00052 }
00053 
00054 
00055 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
00056 MarshakRadiationFixedTMixedFvPatchScalarField
00057 (
00058     const MarshakRadiationFixedTMixedFvPatchScalarField& ptf,
00059     const fvPatch& p,
00060     const DimensionedField<scalar, volMesh>& iF,
00061     const fvPatchFieldMapper& mapper
00062 )
00063 :
00064     mixedFvPatchScalarField(ptf, p, iF, mapper),
00065     Trad_(ptf.Trad_, mapper),
00066     emissivity_(ptf.emissivity_)
00067 {}
00068 
00069 
00070 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
00071 MarshakRadiationFixedTMixedFvPatchScalarField
00072 (
00073     const fvPatch& p,
00074     const DimensionedField<scalar, volMesh>& iF,
00075     const dictionary& dict
00076 )
00077 :
00078     mixedFvPatchScalarField(p, iF),
00079     Trad_("Trad", dict, p.size()),
00080     emissivity_(readScalar(dict.lookup("emissivity")))
00081 {
00082     refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_);
00083     refGrad() = 0.0;
00084 
00085     if (dict.found("value"))
00086     {
00087         fvPatchScalarField::operator=
00088         (
00089             scalarField("value", dict, p.size())
00090         );
00091     }
00092     else
00093     {
00094         fvPatchScalarField::operator=(refValue());
00095     }
00096 }
00097 
00098 
00099 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
00100 MarshakRadiationFixedTMixedFvPatchScalarField
00101 (
00102     const MarshakRadiationFixedTMixedFvPatchScalarField& ptf
00103 )
00104 :
00105     mixedFvPatchScalarField(ptf),
00106     Trad_(ptf.Trad_),
00107     emissivity_(ptf.emissivity_)
00108 {}
00109 
00110 
00111 Foam::MarshakRadiationFixedTMixedFvPatchScalarField::
00112 MarshakRadiationFixedTMixedFvPatchScalarField
00113 (
00114     const MarshakRadiationFixedTMixedFvPatchScalarField& ptf,
00115     const DimensionedField<scalar, volMesh>& iF
00116 )
00117 :
00118     mixedFvPatchScalarField(ptf, iF),
00119     Trad_(ptf.Trad_),
00120     emissivity_(ptf.emissivity_)
00121 {}
00122 
00123 
00124 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00125 
00126 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::autoMap
00127 (
00128     const fvPatchFieldMapper& m
00129 )
00130 {
00131     scalarField::autoMap(m);
00132     Trad_.autoMap(m);
00133 }
00134 
00135 
00136 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::rmap
00137 (
00138     const fvPatchScalarField& ptf,
00139     const labelList& addr
00140 )
00141 {
00142     mixedFvPatchScalarField::rmap(ptf, addr);
00143 
00144     const MarshakRadiationFixedTMixedFvPatchScalarField& mrptf =
00145         refCast<const MarshakRadiationFixedTMixedFvPatchScalarField>(ptf);
00146 
00147     Trad_.rmap(mrptf.Trad_, addr);
00148 }
00149 
00150 
00151 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::updateCoeffs()
00152 {
00153     if (this->updated())
00154     {
00155         return;
00156     }
00157 
00158     // Re-calc reference value
00159     refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_);
00160 
00161     // Diffusion coefficient - created by radiation model's ::updateCoeffs()
00162     const scalarField& gamma =
00163         patch().lookupPatchField<volScalarField, scalar>("gammaRad");
00164 
00165     const scalar Ep = emissivity_/(2.0*(2.0 - emissivity_));
00166 
00167     // Set value fraction
00168     valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep);
00169 
00170     mixedFvPatchScalarField::updateCoeffs();
00171 }
00172 
00173 
00174 void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::write(Ostream& os) const
00175 {
00176     fvPatchScalarField::write(os);
00177     Trad_.writeEntry("Trad", os);
00178     os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
00179     writeEntry("value", os);
00180 }
00181 
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 namespace Foam
00186 {
00187     makePatchTypeField
00188     (
00189         fvPatchScalarField,
00190         MarshakRadiationFixedTMixedFvPatchScalarField
00191     );
00192 }
00193 
00194 
00195 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd