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 #include "RASModel.H"
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 namespace compressible
00038 {
00039 
00040 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00041 
00042 turbulentHeatFluxTemperatureFvPatchScalarField::
00043 turbulentHeatFluxTemperatureFvPatchScalarField
00044 (
00045     const fvPatch& p,
00046     const DimensionedField<scalar, volMesh>& iF
00047 )
00048 :
00049     fixedGradientFvPatchScalarField(p, iF),
00050     q_(p.size(), 0.0),
00051     rhoName_("rho")
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     rhoName_(ptf.rhoName_)
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     rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
00081 {
00082     fvPatchField<scalar>::operator=(patchInternalField());
00083     gradient() = 0.0;
00084 }
00085 
00086 
00087 turbulentHeatFluxTemperatureFvPatchScalarField::
00088 turbulentHeatFluxTemperatureFvPatchScalarField
00089 (
00090     const turbulentHeatFluxTemperatureFvPatchScalarField& thftpsf
00091 )
00092 :
00093     fixedGradientFvPatchScalarField(thftpsf),
00094     q_(thftpsf.q_),
00095     rhoName_(thftpsf.rhoName_)
00096 {}
00097 
00098 
00099 turbulentHeatFluxTemperatureFvPatchScalarField::
00100 turbulentHeatFluxTemperatureFvPatchScalarField
00101 (
00102     const turbulentHeatFluxTemperatureFvPatchScalarField& thftpsf,
00103     const DimensionedField<scalar, volMesh>& iF
00104 )
00105 :
00106     fixedGradientFvPatchScalarField(thftpsf, iF),
00107     q_(thftpsf.q_),
00108     rhoName_(thftpsf.rhoName_)
00109 {}
00110 
00111 
00112 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00113 
00114 void turbulentHeatFluxTemperatureFvPatchScalarField::autoMap
00115 (
00116     const fvPatchFieldMapper& m
00117 )
00118 {
00119     fixedGradientFvPatchScalarField::autoMap(m);
00120     q_.autoMap(m);
00121 }
00122 
00123 
00124 void turbulentHeatFluxTemperatureFvPatchScalarField::rmap
00125 (
00126     const fvPatchScalarField& ptf,
00127     const labelList& addr
00128 )
00129 {
00130     fixedGradientFvPatchScalarField::rmap(ptf, addr);
00131 
00132     const turbulentHeatFluxTemperatureFvPatchScalarField& thftptf =
00133         refCast<const turbulentHeatFluxTemperatureFvPatchScalarField>
00134         (
00135             ptf
00136         );
00137 
00138     q_.rmap(thftptf.q_, addr);
00139 }
00140 
00141 
00142 void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
00143 {
00144     if (updated())
00145     {
00146         return;
00147     }
00148 
00149     const label patchI = patch().index();
00150 
00151     const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
00152 
00153     const scalarField alphaEffp = rasModel.alphaEff()().boundaryField()[patchI];
00154 
00155     const basicThermo& thermo =
00156         db().lookupObject<basicThermo>("thermophysicalProperties");
00157 
00158 //    const scalarField& Tp = thermo.T().boundaryField()[patchI];
00159     const scalarField& Tp = *this;
00160 
00161     const scalarField Cpp = thermo.Cp(Tp, patchI);
00162 
00163     const scalarField& rhop =
00164         patch().lookupPatchField<volScalarField, scalar>(rhoName_);
00165 
00166     const scalar Ap = gSum(patch().magSf());
00167 
00168     gradient() = q_/(Ap*rhop*Cpp*alphaEffp);
00169 
00170     fixedGradientFvPatchScalarField::updateCoeffs();
00171 }
00172 
00173 
00174 void turbulentHeatFluxTemperatureFvPatchScalarField::write
00175 (
00176     Ostream& os
00177 ) const
00178 {
00179     fvPatchScalarField::write(os);
00180     q_.writeEntry("q", os);
00181     os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
00182     gradient().writeEntry("gradient", os);
00183     writeEntry("value", os);
00184 }
00185 
00186 
00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00188 
00189 makePatchTypeField
00190 (
00191     fvPatchScalarField,
00192     turbulentHeatFluxTemperatureFvPatchScalarField
00193 );
00194 
00195 
00196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00197 
00198 } // End namespace compressible
00199 } // End namespace Foam
00200 
00201 
00202 // ************************************************************************* //
00203 
Copyright © 2000-2009 OpenCFD Ltd