FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

wallHeatTransferFvPatchScalarField.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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "wallHeatTransferFvPatchScalarField.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/fvPatchFieldMapper.H>
00029 #include <finiteVolume/volFields.H>
00030 #include <basicThermophysicalModels/basicThermo.H>
00031 
00032 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00033 
00034 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
00035 (
00036     const fvPatch& p,
00037     const DimensionedField<scalar, volMesh>& iF
00038 )
00039 :
00040     mixedFvPatchScalarField(p, iF),
00041     Tinf_(p.size(), 0.0),
00042     alphaWall_(p.size(), 0.0)
00043 {
00044     refValue() = 0.0;
00045     refGrad() = 0.0;
00046     valueFraction() = 0.0;
00047 }
00048 
00049 
00050 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
00051 (
00052     const wallHeatTransferFvPatchScalarField& ptf,
00053     const fvPatch& p,
00054     const DimensionedField<scalar, volMesh>& iF,
00055     const fvPatchFieldMapper& mapper
00056 )
00057 :
00058     mixedFvPatchScalarField(ptf, p, iF, mapper),
00059     Tinf_(ptf.Tinf_, mapper),
00060     alphaWall_(ptf.alphaWall_, mapper)
00061 {}
00062 
00063 
00064 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
00065 (
00066     const fvPatch& p,
00067     const DimensionedField<scalar, volMesh>& iF,
00068     const dictionary& dict
00069 )
00070 :
00071     mixedFvPatchScalarField(p, iF),
00072     Tinf_("Tinf", dict, p.size()),
00073     alphaWall_("alphaWall", dict, p.size())
00074 {
00075     refValue() = Tinf_;
00076     refGrad() = 0.0;
00077     valueFraction() = 0.0;
00078 
00079     if (dict.found("value"))
00080     {
00081         fvPatchField<scalar>::operator=
00082         (
00083             scalarField("value", dict, p.size())
00084         );
00085     }
00086     else
00087     {
00088         evaluate();
00089     }
00090 }
00091 
00092 
00093 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
00094 (
00095     const wallHeatTransferFvPatchScalarField& tppsf
00096 )
00097 :
00098     mixedFvPatchScalarField(tppsf),
00099     Tinf_(tppsf.Tinf_),
00100     alphaWall_(tppsf.alphaWall_)
00101 {}
00102 
00103 
00104 Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField
00105 (
00106     const wallHeatTransferFvPatchScalarField& tppsf,
00107     const DimensionedField<scalar, volMesh>& iF
00108 )
00109 :
00110     mixedFvPatchScalarField(tppsf, iF),
00111     Tinf_(tppsf.Tinf_),
00112     alphaWall_(tppsf.alphaWall_)
00113 {}
00114 
00115 
00116 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00117 
00118 void Foam::wallHeatTransferFvPatchScalarField::autoMap
00119 (
00120     const fvPatchFieldMapper& m
00121 )
00122 {
00123     scalarField::autoMap(m);
00124     Tinf_.autoMap(m);
00125     alphaWall_.autoMap(m);
00126 }
00127 
00128 
00129 void Foam::wallHeatTransferFvPatchScalarField::rmap
00130 (
00131     const fvPatchScalarField& ptf,
00132     const labelList& addr
00133 )
00134 {
00135     mixedFvPatchScalarField::rmap(ptf, addr);
00136 
00137     const wallHeatTransferFvPatchScalarField& tiptf =
00138         refCast<const wallHeatTransferFvPatchScalarField>(ptf);
00139 
00140     Tinf_.rmap(tiptf.Tinf_, addr);
00141     alphaWall_.rmap(tiptf.alphaWall_, addr);
00142 }
00143 
00144 
00145 void Foam::wallHeatTransferFvPatchScalarField::updateCoeffs()
00146 {
00147     if (updated())
00148     {
00149         return;
00150     }
00151 
00152     const basicThermo& thermo = db().lookupObject<basicThermo>
00153     (
00154         "thermophysicalProperties"
00155     );
00156 
00157     const label patchi = patch().index();
00158 
00159     const scalarField& Tw = thermo.T().boundaryField()[patchi];
00160     scalarField Cpw = thermo.Cp(Tw, patchi);
00161 
00162     valueFraction() =
00163         1.0/
00164         (
00165             1.0
00166           + Cpw*thermo.alpha().boundaryField()[patchi]
00167            *patch().deltaCoeffs()/alphaWall_
00168         );
00169 
00170     mixedFvPatchScalarField::updateCoeffs();
00171 }
00172 
00173 
00174 void Foam::wallHeatTransferFvPatchScalarField::write(Ostream& os) const
00175 {
00176     fvPatchScalarField::write(os);
00177     Tinf_.writeEntry("Tinf", os);
00178     alphaWall_.writeEntry("alphaWall", os);
00179     writeEntry("value", os);
00180 }
00181 
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 namespace Foam
00186 {
00187     makePatchTypeField(fvPatchScalarField, wallHeatTransferFvPatchScalarField);
00188 }
00189 
00190 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines