1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2006-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "turbulentMixingLengthDissipationRateInletFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "surfaceFields.H"
31 #include "volFields.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
42 turbulentMixingLengthDissipationRateInletFvPatchScalarField
45 const DimensionedField<scalar, volMesh>& iF
48 fixedValueFvPatchField<scalar>(p, iF),
52 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
53 turbulentMixingLengthDissipationRateInletFvPatchScalarField
55 const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf,
57 const DimensionedField<scalar, volMesh>& iF,
58 const fvPatchFieldMapper& mapper
61 fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
62 mixingLength_(ptf.mixingLength_)
65 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
66 turbulentMixingLengthDissipationRateInletFvPatchScalarField
69 const DimensionedField<scalar, volMesh>& iF,
70 const dictionary& dict
73 fixedValueFvPatchField<scalar>(p, iF, dict),
74 mixingLength_(readScalar(dict.lookup("mixingLength")))
77 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
78 turbulentMixingLengthDissipationRateInletFvPatchScalarField
80 const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf
83 fixedValueFvPatchField<scalar>(ptf),
84 mixingLength_(ptf.mixingLength_)
87 turbulentMixingLengthDissipationRateInletFvPatchScalarField::
88 turbulentMixingLengthDissipationRateInletFvPatchScalarField
90 const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf,
91 const DimensionedField<scalar, volMesh>& iF
94 fixedValueFvPatchField<scalar>(ptf, iF),
95 mixingLength_(ptf.mixingLength_)
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
108 // Lookup Cmu corresponding to the turbulence model selected
109 const incompressible::RASModel& RAS =
110 db().lookupObject<incompressible::RASModel>("RASProperties");
111 scalar Cmu = readScalar(RAS.coeffDict().lookup("Cmu"));
113 scalar Cmu75 = pow(Cmu, 0.75);
115 const fvPatchField<scalar>& k =
116 patch().lookupPatchField<volScalarField, scalar>("k");
118 operator==(Cmu75*k*sqrt(k)/mixingLength_);
120 fixedValueFvPatchField<scalar>::updateCoeffs();
124 void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
129 fvPatchField<scalar>::write(os);
130 os.writeKeyword("mixingLength")
131 << mixingLength_ << token::END_STATEMENT << nl;
132 writeEntry("value", os);
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 turbulentMixingLengthDissipationRateInletFvPatchScalarField
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace Foam
149 // ************************************************************************* //