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

solidWallHeatFluxTemperatureFvPatchScalarField.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 "solidWallHeatFluxTemperatureFvPatchScalarField.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/fvPatchFieldMapper.H>
00029 #include <finiteVolume/volFields.H>
00030 
00031 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00032 
00033 Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
00034 solidWallHeatFluxTemperatureFvPatchScalarField
00035 (
00036     const fvPatch& p,
00037     const DimensionedField<scalar, volMesh>& iF
00038 )
00039 :
00040     fixedGradientFvPatchScalarField(p, iF),
00041     q_(p.size(), 0.0),
00042     KName_("undefined-Kcond")
00043 {}
00044 
00045 
00046 Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
00047 solidWallHeatFluxTemperatureFvPatchScalarField
00048 (
00049     const solidWallHeatFluxTemperatureFvPatchScalarField& ptf,
00050     const fvPatch& p,
00051     const DimensionedField<scalar, volMesh>& iF,
00052     const fvPatchFieldMapper& mapper
00053 )
00054 :
00055     fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
00056     q_(ptf.q_, mapper),
00057     KName_(ptf.KName_)
00058 {}
00059 
00060 
00061 Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
00062 solidWallHeatFluxTemperatureFvPatchScalarField
00063 (
00064     const fvPatch& p,
00065     const DimensionedField<scalar, volMesh>& iF,
00066     const dictionary& dict
00067 )
00068 :
00069     fixedGradientFvPatchScalarField(p, iF, dict),
00070     q_("q", dict, p.size()),
00071     KName_(dict.lookup("Kcond"))
00072 {}
00073 
00074 
00075 Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
00076 solidWallHeatFluxTemperatureFvPatchScalarField
00077 (
00078     const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf
00079 )
00080 :
00081     fixedGradientFvPatchScalarField(tppsf),
00082     q_(tppsf.q_),
00083     KName_(tppsf.KName_)
00084 {}
00085 
00086 
00087 Foam::solidWallHeatFluxTemperatureFvPatchScalarField::
00088 solidWallHeatFluxTemperatureFvPatchScalarField
00089 (
00090     const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf,
00091     const DimensionedField<scalar, volMesh>& iF
00092 )
00093 :
00094     fixedGradientFvPatchScalarField(tppsf, iF),
00095     q_(tppsf.q_),
00096     KName_(tppsf.KName_)
00097 {}
00098 
00099 
00100 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00101 
00102 void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::autoMap
00103 (
00104     const fvPatchFieldMapper& m
00105 )
00106 {
00107     fixedGradientFvPatchScalarField::autoMap(m);
00108     q_.autoMap(m);
00109 }
00110 
00111 
00112 void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap
00113 (
00114     const fvPatchScalarField& ptf,
00115     const labelList& addr
00116 )
00117 {
00118     fixedGradientFvPatchScalarField::rmap(ptf, addr);
00119 
00120     const solidWallHeatFluxTemperatureFvPatchScalarField& hfptf =
00121         refCast<const solidWallHeatFluxTemperatureFvPatchScalarField>(ptf);
00122 
00123     q_.rmap(hfptf.q_, addr);
00124 }
00125 
00126 
00127 void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
00128 {
00129     if (updated())
00130     {
00131         return;
00132     }
00133 
00134     const scalarField& Kw = patch().lookupPatchField<volScalarField, scalar>
00135     (
00136         KName_
00137     );
00138 
00139     gradient() = q_/Kw;
00140 
00141     fixedGradientFvPatchScalarField::updateCoeffs();
00142 }
00143 
00144 
00145 void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::write
00146 (
00147     Ostream& os
00148 ) const
00149 {
00150     fixedGradientFvPatchScalarField::write(os);
00151     q_.writeEntry("q", os);
00152     os.writeKeyword("Kcond") << KName_ << token::END_STATEMENT << nl;
00153     this->writeEntry("value", os);
00154 }
00155 
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 namespace Foam
00160 {
00161     makePatchTypeField
00162     (
00163         fvPatchScalarField,
00164         solidWallHeatFluxTemperatureFvPatchScalarField
00165     );
00166 }
00167 
00168 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines