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

turbulentMixingLengthDissipationRateInletFvPatchScalarField.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) 2006-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 "turbulentMixingLengthDissipationRateInletFvPatchScalarField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "fvPatchFieldMapper.H"
00030 #include "surfaceFields.H"
00031 #include "volFields.H"
00032 #include "RASModel.H"
00033 
00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00035 
00036 namespace Foam
00037 {
00038 namespace incompressible
00039 {
00040 
00041 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00042 
00043 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
00044 turbulentMixingLengthDissipationRateInletFvPatchScalarField
00045 (
00046     const fvPatch& p,
00047     const DimensionedField<scalar, volMesh>& iF
00048 )
00049 :
00050     fixedValueFvPatchField<scalar>(p, iF),
00051     mixingLength_(0.001)
00052 {}
00053 
00054 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
00055 turbulentMixingLengthDissipationRateInletFvPatchScalarField
00056 (
00057     const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf,
00058     const fvPatch& p,
00059     const DimensionedField<scalar, volMesh>& iF,
00060     const fvPatchFieldMapper& mapper
00061 )
00062 :
00063     fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
00064     mixingLength_(ptf.mixingLength_)
00065 {}
00066 
00067 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
00068 turbulentMixingLengthDissipationRateInletFvPatchScalarField
00069 (
00070     const fvPatch& p,
00071     const DimensionedField<scalar, volMesh>& iF,
00072     const dictionary& dict
00073 )
00074 :
00075     fixedValueFvPatchField<scalar>(p, iF, dict),
00076     mixingLength_(readScalar(dict.lookup("mixingLength")))
00077 {}
00078 
00079 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
00080 turbulentMixingLengthDissipationRateInletFvPatchScalarField
00081 (
00082     const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf
00083 )
00084 :
00085     fixedValueFvPatchField<scalar>(ptf),
00086     mixingLength_(ptf.mixingLength_)
00087 {}
00088 
00089 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
00090 turbulentMixingLengthDissipationRateInletFvPatchScalarField
00091 (
00092     const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf,
00093     const DimensionedField<scalar, volMesh>& iF
00094 )
00095 :
00096     fixedValueFvPatchField<scalar>(ptf, iF),
00097     mixingLength_(ptf.mixingLength_)
00098 {}
00099 
00100 
00101 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00102 
00103 void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
00104 {
00105     if (updated())
00106     {
00107         return;
00108     }
00109 
00110     // Lookup Cmu corresponding to the turbulence model selected
00111     const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
00112 
00113     const scalar Cmu =
00114         rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
00115 
00116     const scalar Cmu75 = pow(Cmu, 0.75);
00117 
00118     const fvPatchField<scalar>& kp =
00119         patch().lookupPatchField<volScalarField, scalar>("k");
00120 
00121     operator==(Cmu75*kp*sqrt(kp)/mixingLength_);
00122 
00123     fixedValueFvPatchField<scalar>::updateCoeffs();
00124 }
00125 
00126 
00127 void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
00128 (
00129     Ostream& os
00130 ) const
00131 {
00132     fvPatchField<scalar>::write(os);
00133     os.writeKeyword("mixingLength")
00134         << mixingLength_ << token::END_STATEMENT << nl;
00135     writeEntry("value", os);
00136 }
00137 
00138 
00139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00140 
00141 makePatchTypeField
00142 (
00143     fvPatchScalarField,
00144     turbulentMixingLengthDissipationRateInletFvPatchScalarField
00145 );
00146 
00147 
00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00149 
00150 } // End namespace incompressible
00151 } // End namespace Foam
00152 
00153 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd