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

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