mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added compressible variant of v2f RAS model and associated wall functions
This commit is contained in:
@ -9,6 +9,7 @@ LaunderGibsonRSTM/LaunderGibsonRSTM.C
|
|||||||
realizableKE/realizableKE.C
|
realizableKE/realizableKE.C
|
||||||
SpalartAllmaras/SpalartAllmaras.C
|
SpalartAllmaras/SpalartAllmaras.C
|
||||||
kOmegaSST/kOmegaSST.C
|
kOmegaSST/kOmegaSST.C
|
||||||
|
v2f/v2f.C
|
||||||
|
|
||||||
/* Wall functions */
|
/* Wall functions */
|
||||||
wallFunctions = derivedFvPatchFields/wallFunctions
|
wallFunctions = derivedFvPatchFields/wallFunctions
|
||||||
@ -30,12 +31,20 @@ $(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.
|
|||||||
|
|
||||||
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
|
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
|
||||||
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
|
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
|
||||||
|
$(epsilonWallFunctions)/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
fWallFunctions = $(wallFunctions)/fWallFunctions
|
||||||
|
$(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
omegaWallFunctions = $(wallFunctions)/omegaWallFunctions
|
omegaWallFunctions = $(wallFunctions)/omegaWallFunctions
|
||||||
$(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
|
$(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
kqRWallFunctions = $(wallFunctions)/kqRWallFunctions
|
kqRWallFunctions = $(wallFunctions)/kqRWallFunctions
|
||||||
$(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C
|
$(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C
|
||||||
|
$(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
v2WallFunctions = $(wallFunctions)/v2WallFunctions
|
||||||
|
$(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
/* Patch fields */
|
/* Patch fields */
|
||||||
derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C
|
derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C
|
||||||
|
|||||||
@ -0,0 +1,208 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "epsilonLowReWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
scalar epsilonLowReWallFunctionFvPatchScalarField::yPlusLam
|
||||||
|
(
|
||||||
|
const scalar kappa,
|
||||||
|
const scalar E
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalar ypl = 11.0;
|
||||||
|
|
||||||
|
for (int i=0; i<10; i++)
|
||||||
|
{
|
||||||
|
ypl = log(max(E*ypl, 1))/kappa;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ypl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField::
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
epsilonWallFunctionFvPatchScalarField(p, iF),
|
||||||
|
yPlusLam_(yPlusLam(kappa_, E_))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField::
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonLowReWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField::
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
epsilonWallFunctionFvPatchScalarField(p, iF, dict),
|
||||||
|
yPlusLam_(yPlusLam(kappa_, E_))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField::
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
epsilonWallFunctionFvPatchScalarField(ewfpsf),
|
||||||
|
yPlusLam_(ewfpsf.yPlusLam_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField::
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
epsilonWallFunctionFvPatchScalarField(ewfpsf, iF),
|
||||||
|
yPlusLam_(ewfpsf.yPlusLam_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
|
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
const scalarField& y = rasModel.y()[patchI];
|
||||||
|
|
||||||
|
volScalarField& G =
|
||||||
|
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
|
||||||
|
|
||||||
|
DimensionedField<scalar, volMesh>& epsilon =
|
||||||
|
const_cast<DimensionedField<scalar, volMesh>&>
|
||||||
|
(
|
||||||
|
dimensionedInternalField()
|
||||||
|
);
|
||||||
|
|
||||||
|
const tmp<volScalarField> tk = rasModel.k();
|
||||||
|
const volScalarField& k = tk();
|
||||||
|
|
||||||
|
const tmp<volScalarField> tmu = rasModel.mu();
|
||||||
|
const scalarField& muw = tmu().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const tmp<volScalarField> tmut = rasModel.mut();
|
||||||
|
const volScalarField& mut = tmut();
|
||||||
|
const scalarField& mutw = mut.boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||||
|
const scalarField magGradUw(mag(Uw.snGrad()));
|
||||||
|
|
||||||
|
const scalar Cmu25 = pow025(Cmu_);
|
||||||
|
const scalar Cmu75 = pow(Cmu_, 0.75);
|
||||||
|
|
||||||
|
// Set epsilon and G
|
||||||
|
forAll(mutw, faceI)
|
||||||
|
{
|
||||||
|
label faceCellI = patch().faceCells()[faceI];
|
||||||
|
|
||||||
|
scalar yPlus = Cmu25*sqrt(k[faceCellI])*y[faceI]/muw[faceI]/rhow[faceI];
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam_)
|
||||||
|
{
|
||||||
|
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
epsilon[faceCellI] = 2.0*Cmu25*pow(k[faceCellI], 1.5)/y[faceI];
|
||||||
|
}
|
||||||
|
|
||||||
|
G[faceCellI] =
|
||||||
|
(mutw[faceI] + muw[faceI])
|
||||||
|
*magGradUw[faceI]
|
||||||
|
*Cmu25*sqrt(k[faceCellI])
|
||||||
|
/(kappa_*y[faceI]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedInternalValueFvPatchField<scalar>::updateCoeffs();
|
||||||
|
|
||||||
|
// TODO: perform averaging for cells sharing more than one boundary face
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,191 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::iompressible::RASModels::epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpCmpWallFunctions
|
||||||
|
|
||||||
|
Description
|
||||||
|
This boundary condition provides a turbulence dissipation wall function
|
||||||
|
condition for low- and high-Reynolds number turbulent flow cases.
|
||||||
|
|
||||||
|
The condition can be applied to wall boundaries, whereby it inserts near
|
||||||
|
wall epsilon values directly into the epsilon equation to act as a
|
||||||
|
constraint.
|
||||||
|
|
||||||
|
The model operates in two modes, based on the computed laminar-to-turbulent
|
||||||
|
switch-over y+ value derived from kappa and E.
|
||||||
|
|
||||||
|
\heading Patch usage
|
||||||
|
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
Cmu | model coefficient | no | 0.09
|
||||||
|
kappa | Von Karman constant | no | 0.41
|
||||||
|
E | model coefficient | no | 9.8
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
myPatch
|
||||||
|
{
|
||||||
|
type epsilonLowReWallFunction;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::epsilonWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef epsilonLowReWallFunctionFvPatchScalarField_H
|
||||||
|
#define epsilonLowReWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "epsilonWallFunctionFvPatchScalarField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class epsilonLowReWallFunctionFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public epsilonWallFunctionFvPatchScalarField
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Y+ at the edge of the laminar sublayer
|
||||||
|
scalar yPlusLam_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||||
|
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("compressible::epsilonLowReWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonLowReWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonLowReWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new epsilonLowReWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonLowReWallFunctionFvPatchScalarField&,
|
||||||
|
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 epsilonLowReWallFunctionFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,258 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "wallFvPatch.H"
|
||||||
|
#include "v2f.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void fWallFunctionFvPatchScalarField::checkType()
|
||||||
|
{
|
||||||
|
if (!isA<wallFvPatch>(patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn("fWallFunctionFvPatchScalarField::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 fWallFunctionFvPatchScalarField::yPlusLam
|
||||||
|
(
|
||||||
|
const scalar kappa,
|
||||||
|
const scalar E
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalar ypl = 11.0;
|
||||||
|
|
||||||
|
for (int i=0; i<10; i++)
|
||||||
|
{
|
||||||
|
ypl = log(max(E*ypl, 1))/kappa;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ypl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(p, iF),
|
||||||
|
Cmu_(0.09),
|
||||||
|
kappa_(0.41),
|
||||||
|
E_(9.8),
|
||||||
|
yPlusLam_(yPlusLam(kappa_, E_))
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
|
Cmu_(ptf.Cmu_),
|
||||||
|
kappa_(ptf.kappa_),
|
||||||
|
E_(ptf.E_),
|
||||||
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||||
|
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||||
|
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||||
|
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||||
|
yPlusLam_(yPlusLam(kappa_, E_))
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fWallFunctionFvPatchScalarField& v2wfpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(v2wfpsf),
|
||||||
|
Cmu_(v2wfpsf.Cmu_),
|
||||||
|
kappa_(v2wfpsf.kappa_),
|
||||||
|
E_(v2wfpsf.E_),
|
||||||
|
yPlusLam_(v2wfpsf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fWallFunctionFvPatchScalarField& v2wfpsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(v2wfpsf, iF),
|
||||||
|
Cmu_(v2wfpsf.Cmu_),
|
||||||
|
kappa_(v2wfpsf.kappa_),
|
||||||
|
E_(v2wfpsf.E_),
|
||||||
|
yPlusLam_(v2wfpsf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void fWallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
|
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
const v2f& v2fModel = refCast<const v2f>(rasModel);
|
||||||
|
|
||||||
|
const scalarField& y = v2fModel.y()[patchI];
|
||||||
|
|
||||||
|
const tmp<volScalarField> tk = v2fModel.k();
|
||||||
|
const volScalarField& k = tk();
|
||||||
|
|
||||||
|
const tmp<volScalarField> tepsilon = v2fModel.epsilon();
|
||||||
|
const volScalarField& epsilon = tepsilon();
|
||||||
|
|
||||||
|
const tmp<volScalarField> tv2 = v2fModel.v2();
|
||||||
|
const volScalarField& v2 = tv2();
|
||||||
|
|
||||||
|
const tmp<volScalarField> tmu = v2fModel.mu();
|
||||||
|
const scalarField& muw = tmu().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalarField& rhow = v2fModel.rho().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalar Cmu25 = pow025(Cmu_);
|
||||||
|
|
||||||
|
scalarField& f = *this;
|
||||||
|
|
||||||
|
// Set f wall values
|
||||||
|
forAll(f, faceI)
|
||||||
|
{
|
||||||
|
label faceCellI = patch().faceCells()[faceI];
|
||||||
|
|
||||||
|
scalar uTau = Cmu25*sqrt(k[faceCellI]);
|
||||||
|
|
||||||
|
scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI];
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam_)
|
||||||
|
{
|
||||||
|
scalar N = 6.0;
|
||||||
|
scalar v2c = v2[faceCellI];
|
||||||
|
scalar epsc = epsilon[faceCellI];
|
||||||
|
scalar kc = k[faceCellI];
|
||||||
|
|
||||||
|
f[faceI] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL);
|
||||||
|
f[faceI] /= sqr(uTau) + ROOTVSMALL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f[faceI] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchField<scalar>::updateCoeffs();
|
||||||
|
|
||||||
|
// TODO: perform averaging for cells sharing more than one boundary face
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fWallFunctionFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<scalar>::evaluate(commsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<scalar>::write(os);
|
||||||
|
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
fWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,206 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::compressible::RASModels::fWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpCmpWallFunctions
|
||||||
|
|
||||||
|
Description
|
||||||
|
This boundary condition provides a turbulence damping function, f, wall
|
||||||
|
function condition for low- and high Reynolds number, turbulent flow cases
|
||||||
|
|
||||||
|
The model operates in two modes, based on the computed laminar-to-turbulent
|
||||||
|
switch-over y+ value derived from kappa and E.
|
||||||
|
|
||||||
|
\heading Patch usage
|
||||||
|
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
Cmu | model coefficient | no | 0.09
|
||||||
|
kappa | Von Karman constant | no | 0.41
|
||||||
|
E | model coefficient | no | 9.8
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
myPatch
|
||||||
|
{
|
||||||
|
type fWallFunction;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::fixedValueFvPatchField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fWallFunctionFvPatchScalarField_H
|
||||||
|
#define fWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fWallFunctionFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class fWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchField<scalar>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- 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
|
||||||
|
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("compressible::fWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given fWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new fWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
fWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fWallFunctionFvPatchScalarField&,
|
||||||
|
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 fWallFunctionFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Evaluate the patchField
|
||||||
|
virtual void evaluate(const Pstream::commsTypes);
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,257 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "kLowReWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "wallFvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void kLowReWallFunctionFvPatchScalarField::checkType()
|
||||||
|
{
|
||||||
|
if (!isA<wallFvPatch>(patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn("kLowReWallFunctionFvPatchScalarField::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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
scalar kLowReWallFunctionFvPatchScalarField::yPlusLam
|
||||||
|
(
|
||||||
|
const scalar kappa,
|
||||||
|
const scalar E
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalar ypl = 11.0;
|
||||||
|
|
||||||
|
for (int i=0; i<10; i++)
|
||||||
|
{
|
||||||
|
ypl = log(max(E*ypl, 1))/kappa;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ypl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(p, iF),
|
||||||
|
Cmu_(0.09),
|
||||||
|
kappa_(0.41),
|
||||||
|
E_(9.8),
|
||||||
|
Ceps2_(1.9),
|
||||||
|
yPlusLam_(yPlusLam(kappa_, E_))
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kLowReWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
|
Cmu_(ptf.Cmu_),
|
||||||
|
kappa_(ptf.kappa_),
|
||||||
|
E_(ptf.E_),
|
||||||
|
Ceps2_(ptf.Ceps2_),
|
||||||
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||||
|
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||||
|
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||||
|
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||||
|
Ceps2_(dict.lookupOrDefault<scalar>("Ceps2", 1.9)),
|
||||||
|
yPlusLam_(yPlusLam(kappa_, E_))
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kLowReWallFunctionFvPatchScalarField& kwfpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(kwfpsf),
|
||||||
|
Cmu_(kwfpsf.Cmu_),
|
||||||
|
kappa_(kwfpsf.kappa_),
|
||||||
|
E_(kwfpsf.E_),
|
||||||
|
Ceps2_(kwfpsf.Ceps2_),
|
||||||
|
yPlusLam_(kwfpsf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kLowReWallFunctionFvPatchScalarField& kwfpsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(kwfpsf, iF),
|
||||||
|
Cmu_(kwfpsf.Cmu_),
|
||||||
|
kappa_(kwfpsf.kappa_),
|
||||||
|
E_(kwfpsf.E_),
|
||||||
|
Ceps2_(kwfpsf.Ceps2_),
|
||||||
|
yPlusLam_(kwfpsf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void kLowReWallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 tmp<volScalarField> tmu = rasModel.mu();
|
||||||
|
const scalarField& muw = tmu().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalar Cmu25 = pow025(Cmu_);
|
||||||
|
|
||||||
|
scalarField& kw = *this;
|
||||||
|
|
||||||
|
// Set k wall values
|
||||||
|
forAll(kw, faceI)
|
||||||
|
{
|
||||||
|
label faceCellI = patch().faceCells()[faceI];
|
||||||
|
|
||||||
|
scalar uTau = Cmu25*sqrt(k[faceCellI]);
|
||||||
|
|
||||||
|
scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI];
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam_)
|
||||||
|
{
|
||||||
|
scalar Ck = -0.416;
|
||||||
|
scalar Bk = 8.366;
|
||||||
|
kw[faceI] = Ck/kappa_*log(yPlus) + Bk;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scalar C = 11.0;
|
||||||
|
scalar Cf = (1.0/sqr(yPlus + C) + 2.0*yPlus/pow3(C) - 1.0/sqr(C));
|
||||||
|
kw[faceI] = 2400.0/sqr(Ceps2_)*Cf;
|
||||||
|
}
|
||||||
|
|
||||||
|
kw[faceI] *= sqr(uTau);
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchField<scalar>::updateCoeffs();
|
||||||
|
|
||||||
|
// TODO: perform averaging for cells sharing more than one boundary face
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void kLowReWallFunctionFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<scalar>::evaluate(commsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void kLowReWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<scalar>::write(os);
|
||||||
|
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("Ceps2") << Ceps2_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
kLowReWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,210 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::compressible::RASModels::kLowReWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpCmpWallFunctions
|
||||||
|
|
||||||
|
Description
|
||||||
|
This boundary condition provides a turbulence kinetic energy wall function
|
||||||
|
condition for low- and high-Reynolds number turbulent flow cases.
|
||||||
|
|
||||||
|
The model operates in two modes, based on the computed laminar-to-turbulent
|
||||||
|
switch-over y+ value derived from kappa and E.
|
||||||
|
|
||||||
|
\heading Patch usage
|
||||||
|
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
Cmu | model coefficient | no | 0.09
|
||||||
|
kappa | Von Karman constant | no | 0.41
|
||||||
|
E | model coefficient | no | 9.8
|
||||||
|
Ceps2 | model coefficient | no | 1.9
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
myPatch
|
||||||
|
{
|
||||||
|
type kLowReWallFunction;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::fixedValueFvPatchField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
kLowReWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef kLowReWallFunctionFvPatchScalarField_H
|
||||||
|
#define kLowReWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class kLowReWallFunctionFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class kLowReWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchField<scalar>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Cmu coefficient
|
||||||
|
scalar Cmu_;
|
||||||
|
|
||||||
|
//- Von Karman constant
|
||||||
|
scalar kappa_;
|
||||||
|
|
||||||
|
//- E coefficient
|
||||||
|
scalar E_;
|
||||||
|
|
||||||
|
//- Ceps2 coefficient
|
||||||
|
scalar Ceps2_;
|
||||||
|
|
||||||
|
//- 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
|
||||||
|
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("compressible::kLowReWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given kLowReWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kLowReWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kLowReWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new kLowReWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
kLowReWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kLowReWallFunctionFvPatchScalarField&,
|
||||||
|
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 kLowReWallFunctionFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Evaluate the patchField
|
||||||
|
virtual void evaluate(const Pstream::commsTypes);
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,248 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "v2WallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "wallFvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void v2WallFunctionFvPatchScalarField::checkType()
|
||||||
|
{
|
||||||
|
if (!isA<wallFvPatch>(patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn("v2WallFunctionFvPatchScalarField::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 v2WallFunctionFvPatchScalarField::yPlusLam
|
||||||
|
(
|
||||||
|
const scalar kappa,
|
||||||
|
const scalar E
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalar ypl = 11.0;
|
||||||
|
|
||||||
|
for (int i=0; i<10; i++)
|
||||||
|
{
|
||||||
|
ypl = log(max(E*ypl, 1))/kappa;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ypl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(p, iF),
|
||||||
|
Cmu_(0.09),
|
||||||
|
kappa_(0.41),
|
||||||
|
E_(9.8),
|
||||||
|
yPlusLam_(yPlusLam(kappa_, E_))
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const v2WallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
|
Cmu_(ptf.Cmu_),
|
||||||
|
kappa_(ptf.kappa_),
|
||||||
|
E_(ptf.E_),
|
||||||
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||||
|
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||||
|
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||||
|
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||||
|
yPlusLam_(yPlusLam(kappa_, E_))
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const v2WallFunctionFvPatchScalarField& v2wfpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(v2wfpsf),
|
||||||
|
Cmu_(v2wfpsf.Cmu_),
|
||||||
|
kappa_(v2wfpsf.kappa_),
|
||||||
|
E_(v2wfpsf.E_),
|
||||||
|
yPlusLam_(v2wfpsf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const v2WallFunctionFvPatchScalarField& v2wfpsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<scalar>(v2wfpsf, iF),
|
||||||
|
Cmu_(v2wfpsf.Cmu_),
|
||||||
|
kappa_(v2wfpsf.kappa_),
|
||||||
|
E_(v2wfpsf.E_),
|
||||||
|
yPlusLam_(v2wfpsf.yPlusLam_)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void v2WallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 tmp<volScalarField> tmu = rasModel.mu();
|
||||||
|
const scalarField& muw = tmu().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalar Cmu25 = pow025(Cmu_);
|
||||||
|
|
||||||
|
scalarField& v2 = *this;
|
||||||
|
|
||||||
|
// Set v2 wall values
|
||||||
|
forAll(v2, faceI)
|
||||||
|
{
|
||||||
|
label faceCellI = patch().faceCells()[faceI];
|
||||||
|
|
||||||
|
scalar uTau = Cmu25*sqrt(k[faceCellI]);
|
||||||
|
|
||||||
|
scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI];
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam_)
|
||||||
|
{
|
||||||
|
scalar Cv2 = 0.193;
|
||||||
|
scalar Bv2 = -0.94;
|
||||||
|
v2[faceI] = Cv2/kappa_*log(yPlus) + Bv2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scalar Cv2 = 0.193;
|
||||||
|
v2[faceI] = Cv2*pow4(yPlus);
|
||||||
|
}
|
||||||
|
|
||||||
|
v2[faceI] *= sqr(uTau);
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchField<scalar>::updateCoeffs();
|
||||||
|
|
||||||
|
// TODO: perform averaging for cells sharing more than one boundary face
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void v2WallFunctionFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<scalar>::evaluate(commsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void v2WallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fixedValueFvPatchField<scalar>::write(os);
|
||||||
|
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
v2WallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,208 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::compressible::RASModels::v2WallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpCmpWallFunctions
|
||||||
|
|
||||||
|
Description
|
||||||
|
This boundary condition provides a turbulence stress normal to streamlines
|
||||||
|
wall function condition for low- and high-Reynolds number, turbulent flow
|
||||||
|
cases.
|
||||||
|
|
||||||
|
The model operates in two modes, based on the computed laminar-to-turbulent
|
||||||
|
switch-over y+ value derived from kappa and E.
|
||||||
|
|
||||||
|
|
||||||
|
\heading Patch usage
|
||||||
|
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
Cmu | model coefficient | no | 0.09
|
||||||
|
kappa | Von Karman constant | no | 0.41
|
||||||
|
E | model coefficient | no | 9.8
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
myPatch
|
||||||
|
{
|
||||||
|
type v2WallFunction;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::fixedValueFvPatchField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
v2WallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef v2WallFunctionFvPatchScalarField_H
|
||||||
|
#define v2WallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class v2WallFunctionFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class v2WallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchField<scalar>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- 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
|
||||||
|
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("compressible::v2WallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given v2WallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const v2WallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const v2WallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new v2WallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
v2WallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const v2WallFunctionFvPatchScalarField&,
|
||||||
|
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 v2WallFunctionFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Evaluate the patchField
|
||||||
|
virtual void evaluate(const Pstream::commsTypes);
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
490
src/turbulenceModels/compressible/RAS/v2f/v2f.C
Normal file
490
src/turbulenceModels/compressible/RAS/v2f/v2f.C
Normal file
@ -0,0 +1,490 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "v2f.H"
|
||||||
|
#include "fixedValueFvPatchField.H"
|
||||||
|
#include "zeroGradientFvPatchField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(v2f, 0);
|
||||||
|
addToRunTimeSelectionTable(RASModel, v2f, dictionary);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
wordList v2f::RBoundaryTypes() const
|
||||||
|
{
|
||||||
|
const volScalarField::GeometricBoundaryField& bf(k_.boundaryField());
|
||||||
|
|
||||||
|
wordList bTypes
|
||||||
|
(
|
||||||
|
bf.size(),
|
||||||
|
zeroGradientFvPatchField<symmTensor>::typeName
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(bf, patchI)
|
||||||
|
{
|
||||||
|
if (bf[patchI].fixesValue())
|
||||||
|
{
|
||||||
|
bTypes[patchI] = fixedValueFvPatchField<symmTensor>::typeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<volScalarField> v2f::davidsonCorrectNut
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>& value
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return min(CmuKEps_*sqr(k_)/epsilon_, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<volScalarField> v2f::Ts() const
|
||||||
|
{
|
||||||
|
return max(k_/epsilon_, 6.0*sqrt(mu()/rho_/epsilon_));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<volScalarField> v2f::Ls() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
CL_*max(pow(k_, 1.5)/epsilon_, Ceta_*pow025(pow3(mu()/rho_)/epsilon_));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
v2f::v2f
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const fluidThermo& thermophysicalModel,
|
||||||
|
const word& turbulenceModelName,
|
||||||
|
const word& modelName
|
||||||
|
)
|
||||||
|
:
|
||||||
|
RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
|
||||||
|
|
||||||
|
Cmu_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"Cmu",
|
||||||
|
coeffDict_,
|
||||||
|
0.22
|
||||||
|
)
|
||||||
|
),
|
||||||
|
CmuKEps_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"CmuKEps",
|
||||||
|
coeffDict_,
|
||||||
|
0.09
|
||||||
|
)
|
||||||
|
),
|
||||||
|
C1_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"C1",
|
||||||
|
coeffDict_,
|
||||||
|
1.4
|
||||||
|
)
|
||||||
|
),
|
||||||
|
C2_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"C2",
|
||||||
|
coeffDict_,
|
||||||
|
0.3
|
||||||
|
)
|
||||||
|
),
|
||||||
|
CL_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"CL",
|
||||||
|
coeffDict_,
|
||||||
|
0.23
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Ceta_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"Ceta",
|
||||||
|
coeffDict_,
|
||||||
|
70.0
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Ceps2_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"Ceps2",
|
||||||
|
coeffDict_,
|
||||||
|
1.9
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Ceps3_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"Ceps3",
|
||||||
|
coeffDict_,
|
||||||
|
-0.33
|
||||||
|
)
|
||||||
|
),
|
||||||
|
sigmaK_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"sigmaK",
|
||||||
|
coeffDict_,
|
||||||
|
1.0
|
||||||
|
)
|
||||||
|
),
|
||||||
|
sigmaEps_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"sigmaEps",
|
||||||
|
coeffDict_,
|
||||||
|
1.3
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Prt_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"Prt",
|
||||||
|
coeffDict_,
|
||||||
|
1.0
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
k_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"k",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
epsilon_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"epsilon",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
v2_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"v2",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
f_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"f",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
mut_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"mut",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
alphat_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"alphat",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
v2Min_(dimensionedScalar("v2Min", v2_.dimensions(), SMALL)),
|
||||||
|
fMin_(dimensionedScalar("fMin", f_.dimensions(), 0.0))
|
||||||
|
{
|
||||||
|
bound(k_, kMin_);
|
||||||
|
bound(epsilon_, epsilonMin_);
|
||||||
|
bound(v2_, v2Min_);
|
||||||
|
bound(f_, fMin_);
|
||||||
|
|
||||||
|
mut_ = rho_*davidsonCorrectNut(Cmu_*v2_*Ts());
|
||||||
|
mut_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
alphat_ = mut_/Prt_;
|
||||||
|
alphat_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
printCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
tmp<volSymmTensorField> v2f::R() const
|
||||||
|
{
|
||||||
|
return tmp<volSymmTensorField>
|
||||||
|
(
|
||||||
|
new volSymmTensorField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"R",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
((2.0/3.0)*I)*k_ - (mut_/rho_)*dev(twoSymm(fvc::grad(U_))),
|
||||||
|
RBoundaryTypes()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<volSymmTensorField> v2f::devRhoReff() const
|
||||||
|
{
|
||||||
|
return tmp<volSymmTensorField>
|
||||||
|
(
|
||||||
|
new volSymmTensorField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"devRhoReff",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
-muEff()*dev(twoSymm(fvc::grad(U_)))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<fvVectorMatrix> v2f::divDevRhoReff(volVectorField& U) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
- fvm::laplacian(muEff(), U)
|
||||||
|
- fvc::div(muEff()*dev2(T(fvc::grad(U))))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool v2f::read()
|
||||||
|
{
|
||||||
|
if (RASModel::read())
|
||||||
|
{
|
||||||
|
Cmu_.readIfPresent(coeffDict());
|
||||||
|
CmuKEps_.readIfPresent(coeffDict());
|
||||||
|
C1_.readIfPresent(coeffDict());
|
||||||
|
C2_.readIfPresent(coeffDict());
|
||||||
|
CL_.readIfPresent(coeffDict());
|
||||||
|
Ceta_.readIfPresent(coeffDict());
|
||||||
|
Ceps2_.readIfPresent(coeffDict());
|
||||||
|
sigmaK_.readIfPresent(coeffDict());
|
||||||
|
sigmaEps_.readIfPresent(coeffDict());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void v2f::correct()
|
||||||
|
{
|
||||||
|
if (!turbulence_)
|
||||||
|
{
|
||||||
|
// Re-calculate viscosity
|
||||||
|
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
|
||||||
|
mut_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
// Re-calculate thermal diffusivity
|
||||||
|
alphat_ = mut_/Prt_;
|
||||||
|
alphat_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RASModel::correct();
|
||||||
|
|
||||||
|
volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_)));
|
||||||
|
|
||||||
|
if (mesh_.moving())
|
||||||
|
{
|
||||||
|
divU += fvc::div(mesh_.phi());
|
||||||
|
}
|
||||||
|
|
||||||
|
// use N=6 so that f=0 at walls
|
||||||
|
const dimensionedScalar N("N", dimless, 6.0);
|
||||||
|
|
||||||
|
const volTensorField gradU(fvc::grad(U_));
|
||||||
|
const volScalarField S2(2*magSqr(dev(symm(gradU))));
|
||||||
|
|
||||||
|
const volScalarField G("RASModel.G", mut_*S2);
|
||||||
|
const volScalarField T(Ts());
|
||||||
|
const volScalarField L2("v2f.L2", sqr(Ls()));
|
||||||
|
const volScalarField alpha
|
||||||
|
(
|
||||||
|
"v2f::alpha",
|
||||||
|
1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0))
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<volScalarField> Ceps1 = 1.4*(1.0 + 0.05*min(sqrt(k_/v2_), 100.0));
|
||||||
|
|
||||||
|
// Update epsilon (and possibly G) at the wall
|
||||||
|
epsilon_.boundaryField().updateCoeffs();
|
||||||
|
|
||||||
|
// Dissipation equation
|
||||||
|
tmp<fvScalarMatrix> epsEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho_, epsilon_)
|
||||||
|
+ fvm::div(phi_, epsilon_)
|
||||||
|
- fvm::laplacian(DepsilonEff(), epsilon_)
|
||||||
|
==
|
||||||
|
Ceps1()*G/T
|
||||||
|
- fvm::SuSp(((2.0/3.0)*Ceps1 + Ceps3_)*rho_*divU, epsilon_)
|
||||||
|
- fvm::Sp(Ceps2_*rho_/T, epsilon_)
|
||||||
|
);
|
||||||
|
|
||||||
|
epsEqn().relax();
|
||||||
|
|
||||||
|
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||||
|
|
||||||
|
solve(epsEqn);
|
||||||
|
bound(epsilon_, epsilonMin_);
|
||||||
|
|
||||||
|
// Turbulent kinetic energy equation
|
||||||
|
tmp<fvScalarMatrix> kEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho_, k_)
|
||||||
|
+ fvm::div(phi_, k_)
|
||||||
|
- fvm::laplacian(DkEff(), k_)
|
||||||
|
==
|
||||||
|
G
|
||||||
|
- fvm::SuSp((2.0/3.0)*rho_*divU, k_)
|
||||||
|
- fvm::Sp(rho_*epsilon_/k_, k_)
|
||||||
|
);
|
||||||
|
|
||||||
|
kEqn().relax();
|
||||||
|
solve(kEqn);
|
||||||
|
bound(k_, kMin_);
|
||||||
|
|
||||||
|
// Relaxation function equation
|
||||||
|
tmp<fvScalarMatrix> fEqn
|
||||||
|
(
|
||||||
|
- fvm::laplacian(rho_, f_)
|
||||||
|
==
|
||||||
|
- fvm::Sp(rho_/L2, f_)
|
||||||
|
- 1.0/L2/k_*(rho_*alpha - C2_*G)
|
||||||
|
);
|
||||||
|
|
||||||
|
fEqn().relax();
|
||||||
|
solve(fEqn);
|
||||||
|
bound(f_, fMin_);
|
||||||
|
|
||||||
|
// Turbulence stress normal to streamlines equation
|
||||||
|
tmp<fvScalarMatrix> v2Eqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho_, v2_)
|
||||||
|
+ fvm::div(phi_, v2_)
|
||||||
|
- fvm::laplacian(DkEff(), v2_)
|
||||||
|
==
|
||||||
|
min(rho_*k_*f_, -rho_*alpha + C2_*G)
|
||||||
|
- fvm::Sp(rho_*N*epsilon_/k_, v2_)
|
||||||
|
);
|
||||||
|
|
||||||
|
v2Eqn().relax();
|
||||||
|
solve(v2Eqn);
|
||||||
|
bound(v2_, v2Min_);
|
||||||
|
|
||||||
|
// Re-calculate viscosity
|
||||||
|
mut_ = rho_*davidsonCorrectNut(Cmu_*v2_*T);
|
||||||
|
mut_.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
288
src/turbulenceModels/compressible/RAS/v2f/v2f.H
Normal file
288
src/turbulenceModels/compressible/RAS/v2f/v2f.H
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM 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.
|
||||||
|
|
||||||
|
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::compressible::RASModels::v2f
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpCmpRASTurbulence
|
||||||
|
|
||||||
|
Description
|
||||||
|
Lien and Kalitzin's v2-f turbulence model for incompressible flows, with
|
||||||
|
a limit imposed on the turbulent viscosity given by Davidson et al.
|
||||||
|
|
||||||
|
The model solves for turbulence k and epsilon, with additional equations
|
||||||
|
for the turbulence stress normal to streamlines, v2, and elliptic damping
|
||||||
|
function, f. The variant implemented employs N=6, such that f=0 on walls.
|
||||||
|
|
||||||
|
Wall boundary conditions are:
|
||||||
|
|
||||||
|
k = kLowReWallFunction
|
||||||
|
epsilon = epsilonLowReWallFunction
|
||||||
|
v2 = v2WalLFunction
|
||||||
|
f = fWallFunction
|
||||||
|
|
||||||
|
These are applicable to both low- and high-Reynolds number flows.
|
||||||
|
|
||||||
|
Inlet values can be approximated by:
|
||||||
|
|
||||||
|
v2 = 2/3 k
|
||||||
|
f = zero-gradient
|
||||||
|
|
||||||
|
|
||||||
|
References:
|
||||||
|
|
||||||
|
Lien F-S, Kalitzin G, 2001. Computations of transonic flow with the v2-f
|
||||||
|
turbulence model. Int. J. Heat Fluid Flow 22, pp 53-61
|
||||||
|
|
||||||
|
Davidson L, Nielsen P, Sveningsson A, 2003. Modifications of the v2-f
|
||||||
|
model for computing the flow in a 3D wall jet. Turbulence, Heat and Mass
|
||||||
|
Transfer 4, pp 577-584
|
||||||
|
|
||||||
|
The default model coefficients are given as:
|
||||||
|
\verbatim
|
||||||
|
v2fCoeffs
|
||||||
|
{
|
||||||
|
Cmu 0.22;
|
||||||
|
CmuKEps 0.09;
|
||||||
|
C1 1.4;
|
||||||
|
C2 0.3;
|
||||||
|
CL 0.23;
|
||||||
|
Ceta 70;
|
||||||
|
Ceps2 1.9;
|
||||||
|
sigmaEps 1.3;
|
||||||
|
sigmaK 1;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Note
|
||||||
|
If the kLowReWallFunction is employed, a velocity variant of the turbulent
|
||||||
|
viscosity wall function should be used, e.g. nutUWallFunction. Turbulence
|
||||||
|
k variants (nutk...) for this case will not behave correctly.
|
||||||
|
|
||||||
|
SeeAlso
|
||||||
|
Foam::kEpsilon
|
||||||
|
Foam::kLowReWallFunctionFvPatchScalarField
|
||||||
|
Foam::epsilonLowReWallFunctionFvPatchScalarField
|
||||||
|
Foam::v2WallFunctionFvPatchScalarField
|
||||||
|
Foam::fWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
v2f.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef compressiblev2f_H
|
||||||
|
#define compressiblev2f_H
|
||||||
|
|
||||||
|
#include "RASModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class v2f Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class v2f
|
||||||
|
:
|
||||||
|
public RASModel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
// Model coefficients
|
||||||
|
|
||||||
|
dimensionedScalar Cmu_;
|
||||||
|
dimensionedScalar CmuKEps_;
|
||||||
|
dimensionedScalar C1_;
|
||||||
|
dimensionedScalar C2_;
|
||||||
|
dimensionedScalar CL_;
|
||||||
|
dimensionedScalar Ceta_;
|
||||||
|
dimensionedScalar Ceps2_;
|
||||||
|
dimensionedScalar Ceps3_;
|
||||||
|
dimensionedScalar sigmaK_;
|
||||||
|
dimensionedScalar sigmaEps_;
|
||||||
|
dimensionedScalar Prt_;
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
|
||||||
|
//- Turbulence kinetic energy
|
||||||
|
volScalarField k_;
|
||||||
|
|
||||||
|
//- Turbulence dissipation
|
||||||
|
volScalarField epsilon_;
|
||||||
|
|
||||||
|
//- Turbulence stress normal to streamlines
|
||||||
|
volScalarField v2_;
|
||||||
|
|
||||||
|
//- Damping function
|
||||||
|
volScalarField f_;
|
||||||
|
|
||||||
|
//- Turbulence viscosity
|
||||||
|
volScalarField mut_;
|
||||||
|
|
||||||
|
//- Turbulence thermal diffusivity
|
||||||
|
volScalarField alphat_;
|
||||||
|
|
||||||
|
|
||||||
|
// Bounding values
|
||||||
|
|
||||||
|
dimensionedScalar v2Min_;
|
||||||
|
dimensionedScalar fMin_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Return boundary type names for the R field
|
||||||
|
wordList RBoundaryTypes() const;
|
||||||
|
|
||||||
|
//- Apply Davidson correction to nut
|
||||||
|
tmp<volScalarField> davidsonCorrectNut
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>& value
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return time scale, Ts
|
||||||
|
tmp<volScalarField> Ts() const;
|
||||||
|
|
||||||
|
//- Return length scale, Ls
|
||||||
|
tmp<volScalarField> Ls() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("v2f");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
v2f
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const fluidThermo& thermophysicalModel,
|
||||||
|
const word& turbulenceModelName = turbulenceModel::typeName,
|
||||||
|
const word& modelName = typeName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~v2f()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the effective diffusivity for k
|
||||||
|
tmp<volScalarField> DkEff() const
|
||||||
|
{
|
||||||
|
return tmp<volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField("DkEff", mut_/sigmaK_ + mu())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the effective diffusivity for epsilon
|
||||||
|
tmp<volScalarField> DepsilonEff() const
|
||||||
|
{
|
||||||
|
return tmp<volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField("DepsilonEff", mut_/sigmaEps_ + mu())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the turbulence viscosity
|
||||||
|
virtual tmp<volScalarField> mut() const
|
||||||
|
{
|
||||||
|
return mut_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the turbulence thermal diffusivity
|
||||||
|
virtual tmp<volScalarField> alphat() const
|
||||||
|
{
|
||||||
|
return alphat_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the turbulence kinetic energy
|
||||||
|
virtual tmp<volScalarField> k() const
|
||||||
|
{
|
||||||
|
return k_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the turbulence kinetic energy dissipation rate
|
||||||
|
virtual tmp<volScalarField> epsilon() const
|
||||||
|
{
|
||||||
|
return epsilon_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return turbulence stress normal to streamlines
|
||||||
|
virtual tmp<volScalarField> v2() const
|
||||||
|
{
|
||||||
|
return v2_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the damping function
|
||||||
|
virtual tmp<volScalarField> f() const
|
||||||
|
{
|
||||||
|
return f_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the Reynolds stress tensor
|
||||||
|
virtual tmp<volSymmTensorField> R() const;
|
||||||
|
|
||||||
|
//- Return the effective stress tensor including the laminar stress
|
||||||
|
virtual tmp<volSymmTensorField> devRhoReff() const;
|
||||||
|
|
||||||
|
//- Return the source term for the momentum equation
|
||||||
|
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
|
||||||
|
|
||||||
|
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Read RASProperties dictionary
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user