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

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