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

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