Commit 931296ef authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: alphatJayatillekeWallFunction - re-worked to remove dependency on k. See #684

parent 534c173a
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -24,11 +24,11 @@ License
\*---------------------------------------------------------------------------*/
#include "alphatJayatillekeWallFunctionFvPatchScalarField.H"
#include "turbulentFluidThermoModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H"
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -57,6 +57,37 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::checkType()
}
tmp<scalarField> alphatJayatillekeWallFunctionFvPatchScalarField::yPlus
(
const compressible::turbulenceModel& turbModel
) const
{
const label patchi = patch().index();
const tmp<volScalarField> tnut = turbModel.nut();
const volScalarField& nut = tnut();
if (isA<nutWallFunctionFvPatchScalarField>(nut.boundaryField()[patchi]))
{
const nutWallFunctionFvPatchScalarField& nutPf =
dynamic_cast<const nutWallFunctionFvPatchScalarField&>
(
nut.boundaryField()[patchi]
);
return nutPf.yPlus();
}
else
{
const scalarField& y = turbModel.y()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
return
y*sqrt(turbModel.nuEff(patchi)*mag(Uw.snGrad()))
/turbModel.nu(patchi);
}
}
scalar alphatJayatillekeWallFunctionFvPatchScalarField::Psmooth
(
const scalar Prat
......@@ -109,7 +140,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(p, iF),
Prt_(0.85),
Cmu_(0.09),
kappa_(0.41),
E_(9.8)
{
......@@ -128,7 +158,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Prt_(ptf.Prt_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_)
{}
......@@ -144,7 +173,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(p, iF, dict),
Prt_(dict.lookupOrDefault<scalar>("Prt", 0.85)),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8))
{
......@@ -160,7 +188,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(awfpsf),
Prt_(awfpsf.Prt_),
Cmu_(awfpsf.Cmu_),
kappa_(awfpsf.kappa_),
E_(awfpsf.E_)
{
......@@ -177,7 +204,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(awfpsf, iF),
Prt_(awfpsf.Prt_),
Cmu_(awfpsf.Cmu_),
kappa_(awfpsf.kappa_),
E_(awfpsf.E_)
{
......@@ -207,7 +233,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
)
);
const scalar Cmu25 = pow025(Cmu_);
const scalarField yPlusp(yPlus(turbModel));
const scalarField& y = turbModel.y()[patchi];
......@@ -217,11 +243,6 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
const tmp<scalarField> talphaw = turbModel.alpha(patchi);
const scalarField& alphaw = talphaw();
scalarField& alphatw = *this;
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField magGradUw(mag(Uw.snGrad()));
......@@ -230,6 +251,8 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
const fvPatchScalarField& hew =
turbModel.transport().he().boundaryField()[patchi];
scalarField& alphatw = *this;
// Heat flux [W/m2] - lagging alphatw
const scalarField qDot
(
......@@ -239,11 +262,9 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
// Populate boundary values
forAll(alphatw, facei)
{
label celli = patch().faceCells()[facei];
scalar uTau = Cmu25*sqrt(k[celli]);
scalar yPlus = yPlusp[facei];
scalar yPlus = uTau*y[facei]/(muw[facei]/rhow[facei]);
scalar uTau = yPlus/y[facei]*(muw[facei]/rhow[facei]);
// Molecular Prandtl number
scalar Pr = muw[facei]/alphaw[facei];
......@@ -301,7 +322,6 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeEntry("Prt", Prt_);
os.writeEntry("Cmu", Cmu_);
os.writeEntry("kappa", kappa_);
os.writeEntry("E", E_);
writeEntry("value", os);
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -35,7 +35,6 @@ Usage
\table
Property | Description | Required | Default value
Prt | turbulent Prandtl number | no | 0.85
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
\endtable
......@@ -64,6 +63,7 @@ SourceFiles
#define alphatJayatillekeWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -85,9 +85,6 @@ class alphatJayatillekeWallFunctionFvPatchScalarField
//- Turbulent Prandtl number
scalar Prt_;
//- Cmu coefficient
scalar Cmu_;
//- Von Karman constant
scalar kappa_;
......@@ -107,6 +104,12 @@ class alphatJayatillekeWallFunctionFvPatchScalarField
//- Check the type of the patch
void checkType();
//- Return the patch y+
tmp<scalarField> yPlus
(
const compressible::turbulenceModel& turbModel
) const;
//- `P' function
scalar Psmooth(const scalar Prat) const;
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -24,10 +24,10 @@ License
\*---------------------------------------------------------------------------*/
#include "alphatJayatillekeWallFunctionFvPatchScalarField.H"
#include "turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -58,6 +58,37 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::checkType()
}
tmp<scalarField> alphatJayatillekeWallFunctionFvPatchScalarField::yPlus
(
const turbulenceModel& turbModel
) const
{
const label patchi = patch().index();
const tmp<volScalarField> tnut = turbModel.nut();
const volScalarField& nut = tnut();
if (isA<nutWallFunctionFvPatchScalarField>(nut.boundaryField()[patchi]))
{
const nutWallFunctionFvPatchScalarField& nutPf =
dynamic_cast<const nutWallFunctionFvPatchScalarField&>
(
nut.boundaryField()[patchi]
);
return nutPf.yPlus();
}
else
{
const scalarField& y = turbModel.y()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
return
y*sqrt(turbModel.nuEff(patchi)*mag(Uw.snGrad()))
/turbModel.nu(patchi);
}
}
scalar alphatJayatillekeWallFunctionFvPatchScalarField::Psmooth
(
const scalar Prat
......@@ -110,7 +141,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(p, iF),
Prt_(0.85),
Cmu_(0.09),
kappa_(0.41),
E_(9.8)
{
......@@ -129,7 +159,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Prt_(ptf.Prt_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_)
{
......@@ -147,7 +176,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(p, iF, dict),
Prt_(readScalar(dict.lookup("Prt"))), // force read to avoid ambiguity
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8))
{
......@@ -163,7 +191,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(wfpsf),
Prt_(wfpsf.Prt_),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_)
{
......@@ -180,7 +207,6 @@ alphatJayatillekeWallFunctionFvPatchScalarField
:
fixedValueFvPatchScalarField(wfpsf, iF),
Prt_(wfpsf.Prt_),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_)
{
......@@ -210,13 +236,11 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
)
);
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalarField& y = turbModel.y()[patchi];
const scalarField yPlusp(yPlus(turbModel));
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const IOdictionary& transportProperties =
db().lookupObject<IOdictionary>("transportProperties");
......@@ -236,10 +260,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
scalarField& alphatw = *this;
forAll(alphatw, facei)
{
label celli = patch().faceCells()[facei];
// y+
scalar yPlus = Cmu25*sqrt(k[celli])*y[facei]/nuw[facei];
scalar yPlus = yPlusp[facei];
// Molecular-to-turbulent Prandtl number ratio
scalar Prat = Pr/Prt_;
......@@ -269,7 +290,6 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeEntry("Prt", Prt_);
os.writeEntry("Cmu", Cmu_);
os.writeEntry("kappa", kappa_);
os.writeEntry("E", E_);
writeEntry("value", os);
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -35,7 +35,6 @@ Usage
\table
Property | Description | Required | Default value
Prt | turbulent Prandtl number | no | 0.85
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
\endtable
......@@ -63,6 +62,7 @@ SourceFiles
#define alphatJayatillekeWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -86,9 +86,6 @@ protected:
//- Turbulent Prandtl number
scalar Prt_;
//- Cmu coefficient
scalar Cmu_;
//- Von Karman constant
scalar kappa_;
......@@ -107,6 +104,9 @@ protected:
//- Check the type of the patch
virtual void checkType();
//- Return the patch y+
tmp<scalarField> yPlus(const turbulenceModel& turbModel) const;
//- `P' function
scalar Psmooth(const scalar Prat) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment