Additional wall functions: omega/nutCWTWallFunctions

Compound wall treatment by Popovac and Hanjalic, wall functions are sensitive to
flow unsteadiness, convection effects and pressure gradient effects.

Author: Filip Sutalo, Merge: Vuko Vukcevic
This commit is contained in:
Vuko Vukcevic 2017-05-29 09:46:39 +02:00
parent f4db00045d
commit c0741e5def
5 changed files with 1096 additions and 0 deletions

View file

@ -32,12 +32,14 @@ $(nutWallFunctions)/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctio
$(nutWallFunctions)/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutCWTWallFunction/nutCWTWallFunctionFvPatchScalarField.C
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
omegaWallFunctions = $(wallFunctions)/omegaWallFunctions
$(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
$(omegaWallFunctions)/omegaCWTWallFunction/omegaCWTWallFunctionFvPatchScalarField.C
kqRWallFunctions = $(wallFunctions)/kqRWallFunctions
$(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C

View file

@ -0,0 +1,335 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "nutCWTWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutCWTWallFunctionFvPatchScalarField::checkType()
{
if (!patch().isWall())
{
FatalErrorIn("nutCWTWallFunctionFvPatchScalarField::checkType()")
<< "Invalid wall function specification" << nl
<< " Patch type for patch " << patch().name()
<< " must be wall" << nl
<< " Current patch type is " << patch().type() << nl << endl
<< abort(FatalError);
}
}
scalar nutCWTWallFunctionFvPatchScalarField::calcYPlusLam
(
const scalar kappa,
const scalar E
) const
{
scalar ypl = 11.0;
for (int i = 0; i < 10; i++)
{
ypl = log(E*ypl)/kappa;
}
return ypl;
}
tmp<scalarField> nutCWTWallFunctionFvPatchScalarField::calcNut() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
// Get normals
const vectorField n = patch().nf();
// Patch velocity field at this wall
const fvPatchVectorField& Uw =
lookupPatchField<volVectorField, vector>(UName_);
const scalarField magGradUw = mag(Uw.snGrad());
const vectorField UwIn = Uw.patchInternalField();
// Patch internal velocity field tangential to the wall
const vectorField UwInTang = UwIn - (UwIn & n)*n;
const scalarField magUwInTang = mag(UwInTang);
// Calculate tangential direction for patch cells
const vectorField tDir = UwInTang/magUwInTang;
// Wall-velocity vector field tangential to the wall
const vectorField UwTang = Uw - (Uw & n)*n;
const scalarField magUwTang = mag(UwTang);
// Pressure terms
const volScalarField& p =
this->dimensionedInternalField().mesh().lookupObject
<
volScalarField
>(pName_);
// Pressure gradient
const volVectorField gradp = fvc::grad(p);
// Pressure gradient in wall adjacent cell
const vectorField gradPIn =
gradp.boundaryField()[this->patch().index()].patchInternalField();
// Pressure gradient projected on the wall parallel velocity
const scalarField gradpTang= gradPIn & tDir;
// Convective terms
const volVectorField& U =
this->dimensionedInternalField().mesh().lookupObject
<
volVectorField
>(UName_);
const surfaceScalarField& phi =
this->dimensionedInternalField().mesh().lookupObject
<
surfaceScalarField
>("phi");
const volVectorField convection = fvc::div(phi, U);
const vectorField convectionIn =
convection.boundaryField()[this->patch().index()].patchInternalField();
// Convection term projected on the wall parallel velocity
const scalarField convectionTang = convectionIn & tDir;
tmp<scalarField> tnutw(new scalarField(patch().size()));
scalarField& nutw = tnutw();
// Get face cells
const unallocLabelList& fc = patch().faceCells();
forAll(nutw, faceI)
{
const label faceCellI = fc[faceI];
const scalar uStar = Cmu25*sqrt(k[faceCellI]);
// Note: here yPlus is actually yStar
const scalar yPlus = uStar*y[faceI]/nuw[faceI];
// Relative tangential velocity
const scalar magUrel = magUwInTang[faceI] - magUwTang[faceI];
const scalar Cu = convectionTang[faceI] + gradpTang[faceI];
const scalar Psi = 1.0 - Cu/(kappa_*uStar*magGradUw[faceI]);
const scalar tauwVis = nuw[faceI]*magGradUw[faceI];
const scalar tauwLog = kappa_*uStar*magUrel*Psi/log(E_*yPlus);
// Kader blending
const scalar gamma = -0.01*pow(yPlus, 4)/(1.0 + 5.0*yPlus);
const scalar tauw = tauwVis*exp(gamma) + tauwLog*exp(1.0/gamma);
nutw[faceI] = tauw/magGradUw[faceI] - nuw[faceI];
}
return tnutw;
}
void nutCWTWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "p", "p", pName_);
writeEntryIfDifferent<word>(os, "nut", "nut", nutName_);
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
UName_("U"),
pName_("p"),
nutName_("nut"),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
checkType();
}
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", "U")),
pName_(dict.lookupOrDefault<word>("p", "p")),
nutName_(dict.lookupOrDefault<word>("nut", "nut")),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
checkType();
}
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
(
const nutCWTWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
pName_(ptf.pName_),
nutName_(ptf.nutName_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
{
checkType();
}
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
(
const nutCWTWallFunctionFvPatchScalarField& wfpsf
)
:
fixedValueFvPatchScalarField(wfpsf),
UName_(wfpsf.UName_),
pName_(wfpsf.pName_),
nutName_(wfpsf.nutName_),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
(
const nutCWTWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wfpsf, iF),
UName_(wfpsf.UName_),
pName_(wfpsf.pName_),
nutName_(wfpsf.nutName_),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nutCWTWallFunctionFvPatchScalarField::updateCoeffs()
{
operator==(calcNut());
fixedValueFvPatchScalarField::updateCoeffs();
}
tmp<scalarField> nutCWTWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk();
const scalarField kwc = k.boundaryField()[patchI].patchInternalField();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
return pow(Cmu_, 0.25)*y*sqrt(kwc)/nuw;
}
void nutCWTWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutCWTWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,215 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::nutCWTWallFunctionFvPatchScalarField
Description
Improved boundary condition for turbulent (kinematic) viscosity, taking into
account non-equilibrium effects and are sensitive to flow unsteadiness and
presence of the pressure gradient.
Reference (bibtex entry):
@article{popovacHanjalic2007,
author = {Popovac, M. and Hanjali\'{c}, K.,}
title = {{Compound Wall Treatment for RANS Computation of Complex
Turbulent Flows and Heat Transfer}},
journal = {Flow Turbulence Combust},
year = {2007},
pages = {78--177}
DOI = {10.1007/s10494-006-9067-x}
}
SourceFiles
nutCWTWallFunctionFvPatchScalarField.C
Author
Filip Sutalo, FMENA Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#ifndef nutCWTWallFunctionFvPatchScalarField_H
#define nutCWTWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutCWTWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutCWTWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
protected:
// Protected data
//- Name of velocity field
word UName_;
//- Name of pressure field
word pName_;
//- Name of eddy viscosity field
word nutName_;
//- Name of omega field
word omegaName_;
//- Cmu coefficient
scalar Cmu_;
//- Von Karman constant
scalar kappa_;
//- E coefficient
scalar E_;
//- Y+ at the edge of the laminar sublayer
scalar yPlusLam_;
// Protected member functions
//- Check the type of the patch
virtual void checkType();
//- Calculate the Y+ at the edge of the laminar sublayer
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
//- Runtime type information
TypeName("nutCWTWallTreatment");
// Constructors
//- Construct from patch and internal field
nutCWTWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutCWTWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutCWTWallFunctionFvPatchScalarField
// onto a new patch
nutCWTWallFunctionFvPatchScalarField
(
const nutCWTWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutCWTWallFunctionFvPatchScalarField
(
const nutCWTWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutCWTWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutCWTWallFunctionFvPatchScalarField
(
const nutCWTWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new nutCWTWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,337 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "omegaCWTWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void omegaCWTWallFunctionFvPatchScalarField::checkType()
{
if (!patch().isWall())
{
FatalErrorIn("omegaCWTWallFunctionFvPatchScalarField::checkType()")
<< "Invalid wall function specification" << nl
<< " Patch type for patch " << patch().name()
<< " must be wall" << nl
<< " Current patch type is " << patch().type() << nl << endl
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
omegaCWTWallFunctionFvPatchScalarField::omegaCWTWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedInternalValueFvPatchField<scalar>(p, iF),
pName_("p"),
UName_("U"),
kName_("k"),
GName_("RASModel::G"),
nuName_("nu"),
nutName_("nut"),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
beta1_(0.075)
{
checkType();
}
omegaCWTWallFunctionFvPatchScalarField::omegaCWTWallFunctionFvPatchScalarField
(
const omegaCWTWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
pName_(ptf.pName_),
UName_(ptf.UName_),
kName_(ptf.kName_),
GName_(ptf.GName_),
nuName_(ptf.nuName_),
nutName_(ptf.nutName_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
beta1_(ptf.beta1_)
{
checkType();
}
omegaCWTWallFunctionFvPatchScalarField::omegaCWTWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
pName_(dict.lookupOrDefault<word>("p", "p")),
UName_(dict.lookupOrDefault<word>("U", "U")),
kName_(dict.lookupOrDefault<word>("k", "k")),
GName_(dict.lookupOrDefault<word>("G", "RASModel::G")),
nuName_(dict.lookupOrDefault<word>("nu", "nu")),
nutName_(dict.lookupOrDefault<word>("nut", "nut")),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075))
{
checkType();
}
omegaCWTWallFunctionFvPatchScalarField::omegaCWTWallFunctionFvPatchScalarField
(
const omegaCWTWallFunctionFvPatchScalarField& owfpsf
)
:
fixedInternalValueFvPatchField<scalar>(owfpsf),
pName_(owfpsf.pName_),
UName_(owfpsf.UName_),
kName_(owfpsf.kName_),
GName_(owfpsf.GName_),
nuName_(owfpsf.nuName_),
nutName_(owfpsf.nutName_),
Cmu_(owfpsf.Cmu_),
kappa_(owfpsf.kappa_),
E_(owfpsf.E_),
beta1_(owfpsf.beta1_)
{
checkType();
}
omegaCWTWallFunctionFvPatchScalarField::omegaCWTWallFunctionFvPatchScalarField
(
const omegaCWTWallFunctionFvPatchScalarField& owfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedInternalValueFvPatchField<scalar>(owfpsf, iF),
pName_(owfpsf.pName_),
UName_(owfpsf.UName_),
kName_(owfpsf.kName_),
GName_(owfpsf.GName_),
nuName_(owfpsf.nuName_),
nutName_(owfpsf.nutName_),
Cmu_(owfpsf.Cmu_),
kappa_(owfpsf.kappa_),
E_(owfpsf.E_),
beta1_(owfpsf.beta1_)
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void omegaCWTWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
// If G field is not present, execute zero gradient evaluation
// HJ, 20/Mar/2011
if (!db().foundObject<volScalarField>(GName_))
{
InfoIn("void omegaCWTWallFunctionFvPatchScalarField::updateCoeffs()")
<< "Cannot access " << GName_ << " field for patch "
<< patch().name() << ". Evaluating as zeroGradient"
<< endl;
fvPatchScalarField::updateCoeffs();
zeroGradientFvPatchScalarField::evaluate();
return;
}
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patch().index()];
const scalar Cmu25 = pow(Cmu_, 0.25);
volScalarField& G = const_cast<volScalarField&>
(db().lookupObject<volScalarField>(GName_));
// Note: omega is now a refValue and set in fixedInternalValueFvPatchField
// HJ, 3/Aug/2011
scalarField& omega = refValue();
const scalarField& k = db().lookupObject<volScalarField>(kName_);
const scalarField& nuw =
lookupPatchField<volScalarField, scalar>(nuName_);
const scalarField& nutw =
lookupPatchField<volScalarField, scalar>(nutName_);
// Velocity field at the patch
const fvPatchVectorField& Uw =
lookupPatchField<volVectorField, vector>(UName_);
// Patch normals
const vectorField n = patch().nf();
// Velocity patch internal field
const vectorField UwIn = Uw.patchInternalField();
// Velocity vector tangential to the wall
const vectorField UwInTang = UwIn - (UwIn & n)*n;
const scalarField magUwInTang = mag(UwInTang);
// Calculate tangential direction for patch cells
const vectorField tDir = UwInTang/magUwInTang;
// Magnitude of the surface normal gradient velocity
const scalarField magGradUw = mag(Uw.snGrad());
// Pressure effects
const volScalarField& p =
this->dimensionedInternalField().mesh().lookupObject
<volScalarField>(pName_);
// Pressure gradient
const volVectorField gradp = fvc::grad(p);
// Pressure gradient in wall adjacent cell
const vectorField gradPIn =
gradp.boundaryField()[this->patch().index()].patchInternalField();
// Pressure gradient projected on the wall parallel velocity
const scalarField gradpTang= gradPIn & tDir;
// Convective terms
const volVectorField& U =
this->dimensionedInternalField().mesh().lookupObject
<
volVectorField
>(UName_);
const surfaceScalarField& phi =
this->dimensionedInternalField().mesh().lookupObject
<
surfaceScalarField
>("phi");
const volVectorField convection = fvc::div(phi, U);
const vectorField convectionIn =
convection.boundaryField()[this->patch().index()].patchInternalField();
// Convection term projected on the wall parallel velocity
const scalarField convectionTang = convectionIn & tDir;
// Get face cells
const unallocLabelList& fc = patch().faceCells();
// Set omega and G
forAll(nutw, faceI)
{
const label faceCellI = fc[faceI];
const scalar uStar= Cmu25*sqrt(k[faceCellI]);
// Note: here yPlus is actually yStar
const scalar yPlus = uStar*y[faceI]/nuw[faceI];
const scalar Cu = convectionTang[faceI] + gradpTang[faceI];
const scalar Psi = 1.0 - Cu/(kappa_*uStar*magGradUw[faceI]);
// Kader blend for velocity gradient
const scalar gamma = -0.01*pow(yPlus, 4)/(1.0 + 5.0*yPlus);
const scalar gammaEps = - 0.001*pow(yPlus, 4)/(1.0 + yPlus);
const scalar omegaVis = 6.0*nuw[faceI]/(beta1_*sqr(y[faceI]));
const scalar omegaLog = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
// Menter blend for omega
omega[faceI] = omegaVis*exp(gammaEps) + omegaLog*exp(1.0/gammaEps);
const scalar Gvis = k[faceCellI]*sqr(magGradUw[faceI])/omega[faceI];
const scalar Glog = pow(uStar, 3)/(Psi*kappa_*y[faceI]);
G[faceCellI]= Gvis*exp(gamma) + Glog*exp(1.0/gamma);
}
// TODO: perform averaging for cells sharing more than one boundary face
fixedInternalValueFvPatchField<scalar>::updateCoeffs();
}
void omegaCWTWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fixedInternalValueFvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "p", "p", pName_);
writeEntryIfDifferent<word>(os, "k", "k", kName_);
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
writeEntryIfDifferent<word>(os, "nu", "nu", nuName_);
writeEntryIfDifferent<word>(os, "nut", "nut", nutName_);
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
os.writeKeyword("beta1") << beta1_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
omegaCWTWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,207 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::omegaCWTWallFunctionFvPatchScalarField
Description
Improved boundary condition for specific dissipation, taking into account
non-equilibrium effects and are sensitive to flow unsteadiness and presence
of the pressure gradient.
Reference (bibtex entry):
@article{popovacHanjalic2007,
author = {Popovac, M. and Hanjali\'{c}, K.,}
title = {{Compound Wall Treatment for RANS Computation of Complex
Turbulent Flows and Heat Transfer}},
journal = {Flow Turbulence Combust},
year = {2007},
pages = {78--177}
DOI = {10.1007/s10494-006-9067-x}
}
SourceFiles
omegaCWTWallFunctionFvPatchScalarField.C
Author
Filip Sutalo, FMENA Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#ifndef omegaCWTWallFunctionFvPatchScalarField_H
#define omegaCWTWallFunctionFvPatchScalarField_H
#include "fixedInternalValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class omegaCWTWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class omegaCWTWallFunctionFvPatchScalarField
:
public fixedInternalValueFvPatchScalarField
{
// Private data
//- Name of pressure field
word pName_;
//- Name of velocity field
word UName_;
//- Name of turbulence kinetic energy field
word kName_;
//- Name of turbulence generation field
word GName_;
//- Name of laminar viscosity field
word nuName_;
//- Name of turbulent viscosity field
word nutName_;
//- Cmu coefficient
scalar Cmu_;
//- Von Karman constant
scalar kappa_;
//- E coefficient
scalar E_;
//- beta1 coefficient
scalar beta1_;
// Private member functions
//- Check the type of the patch
void checkType();
public:
//- Runtime type information
TypeName("omegaCWTWallTreatment");
// Constructors
//- Construct from patch and internal field
omegaCWTWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
omegaCWTWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// omegaCWTWallFunctionFvPatchScalarField
// onto a new patch
omegaCWTWallFunctionFvPatchScalarField
(
const omegaCWTWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
omegaCWTWallFunctionFvPatchScalarField
(
const omegaCWTWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new omegaCWTWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
omegaCWTWallFunctionFvPatchScalarField
(
const omegaCWTWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new omegaCWTWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //