mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
adding new wall function methods
This commit is contained in:
@ -175,9 +175,21 @@ LRR::LRR
|
|||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
|
|
||||||
nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_))
|
nut_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"nut",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
{
|
{
|
||||||
# include "wallViscosityI.H"
|
nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
|
|
||||||
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
|
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
|
||||||
{
|
{
|
||||||
@ -289,9 +301,10 @@ void LRR::correct()
|
|||||||
RASModel::correct();
|
RASModel::correct();
|
||||||
|
|
||||||
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
|
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
|
||||||
volScalarField G = 0.5*tr(P);
|
volScalarField G("G", 0.5*tr(P));
|
||||||
|
|
||||||
# include "wallFunctionsI.H"
|
// Update espsilon and G at the wall
|
||||||
|
epsilon_.boundaryField().updateCoeffs();
|
||||||
|
|
||||||
// Dissipation equation
|
// Dissipation equation
|
||||||
tmp<fvScalarMatrix> epsEqn
|
tmp<fvScalarMatrix> epsEqn
|
||||||
@ -307,7 +320,7 @@ void LRR::correct()
|
|||||||
|
|
||||||
epsEqn().relax();
|
epsEqn().relax();
|
||||||
|
|
||||||
# include "wallDissipationI.H"
|
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||||
|
|
||||||
solve(epsEqn);
|
solve(epsEqn);
|
||||||
bound(epsilon_, epsilon0_);
|
bound(epsilon_, epsilon0_);
|
||||||
@ -370,8 +383,7 @@ void LRR::correct()
|
|||||||
|
|
||||||
// Re-calculate viscosity
|
// Re-calculate viscosity
|
||||||
nut_ = Cmu_*sqr(k_)/epsilon_;
|
nut_ = Cmu_*sqr(k_)/epsilon_;
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
# include "wallViscosityI.H"
|
|
||||||
|
|
||||||
|
|
||||||
// Correct wall shear stresses
|
// Correct wall shear stresses
|
||||||
|
|||||||
@ -204,9 +204,21 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
|
|||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
|
|
||||||
nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_))
|
nut_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"nut",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
{
|
{
|
||||||
# include "wallViscosityI.H"
|
nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
|
|
||||||
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
|
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
|
||||||
{
|
{
|
||||||
@ -321,9 +333,10 @@ void LaunderGibsonRSTM::correct()
|
|||||||
}
|
}
|
||||||
|
|
||||||
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
|
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
|
||||||
volScalarField G = 0.5*tr(P);
|
volScalarField G("G", 0.5*tr(P));
|
||||||
|
|
||||||
# include "wallFunctionsI.H"
|
// Update espsilon and G at the wall
|
||||||
|
epsilon_.boundaryField().updateCoeffs();
|
||||||
|
|
||||||
// Dissipation equation
|
// Dissipation equation
|
||||||
tmp<fvScalarMatrix> epsEqn
|
tmp<fvScalarMatrix> epsEqn
|
||||||
@ -339,7 +352,7 @@ void LaunderGibsonRSTM::correct()
|
|||||||
|
|
||||||
epsEqn().relax();
|
epsEqn().relax();
|
||||||
|
|
||||||
# include "wallDissipationI.H"
|
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||||
|
|
||||||
solve(epsEqn);
|
solve(epsEqn);
|
||||||
bound(epsilon_, epsilon0_);
|
bound(epsilon_, epsilon0_);
|
||||||
@ -411,9 +424,7 @@ void LaunderGibsonRSTM::correct()
|
|||||||
|
|
||||||
// Re-calculate turbulent viscosity
|
// Re-calculate turbulent viscosity
|
||||||
nut_ = Cmu_*sqr(k_)/epsilon_;
|
nut_ = Cmu_*sqr(k_)/epsilon_;
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
|
|
||||||
# include "wallViscosityI.H"
|
|
||||||
|
|
||||||
|
|
||||||
// Correct wall shear stresses
|
// Correct wall shear stresses
|
||||||
|
|||||||
@ -18,9 +18,19 @@ LienLeschzinerLowRe/LienLeschzinerLowRe.C
|
|||||||
LamBremhorstKE/LamBremhorstKE.C
|
LamBremhorstKE/LamBremhorstKE.C
|
||||||
|
|
||||||
/* Wall functions */
|
/* Wall functions */
|
||||||
wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C
|
derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C
|
||||||
wallFunctions/nutWallFunctions/nutStandardWallFunction/nutStandardWallFunctionFvPatchScalarField.C
|
derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C
|
||||||
wallFunctions/nutWallFunctions/nutStandardRoughWallFunction/nutStandardRoughWallFunctionFvPatchScalarField.C
|
|
||||||
|
derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.C
|
||||||
|
derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
||||||
|
derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
|
||||||
/* Patch fields */
|
/* Patch fields */
|
||||||
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||||
|
|||||||
@ -82,13 +82,14 @@ RASModel::RASModel
|
|||||||
turbulence_(lookup("turbulence")),
|
turbulence_(lookup("turbulence")),
|
||||||
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
|
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
|
||||||
coeffDict_(subDict(type + "Coeffs")),
|
coeffDict_(subDict(type + "Coeffs")),
|
||||||
|
wallFunctionDict_(subDict("wallFunctionCoeffs")),
|
||||||
|
|
||||||
kappa_
|
kappa_
|
||||||
(
|
(
|
||||||
dimensioned<scalar>::lookupOrAddToDict
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
(
|
(
|
||||||
"kappa",
|
"kappa",
|
||||||
subDict("wallFunctionCoeffs"),
|
wallFunctionDict_,
|
||||||
0.4187
|
0.4187
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
@ -97,10 +98,19 @@ RASModel::RASModel
|
|||||||
dimensioned<scalar>::lookupOrAddToDict
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
(
|
(
|
||||||
"E",
|
"E",
|
||||||
subDict("wallFunctionCoeffs"),
|
wallFunctionDict_,
|
||||||
9.0
|
9.0
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
Cmu_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"Cmu",
|
||||||
|
wallFunctionDict_,
|
||||||
|
0.09
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
yPlusLam_(yPlusLam(kappa_.value(), E_.value())),
|
yPlusLam_(yPlusLam(kappa_.value(), E_.value())),
|
||||||
|
|
||||||
|
|||||||
@ -88,8 +88,10 @@ protected:
|
|||||||
Switch printCoeffs_;
|
Switch printCoeffs_;
|
||||||
dictionary coeffDict_;
|
dictionary coeffDict_;
|
||||||
|
|
||||||
|
dictionary wallFunctionDict_;
|
||||||
dimensionedScalar kappa_;
|
dimensionedScalar kappa_;
|
||||||
dimensionedScalar E_;
|
dimensionedScalar E_;
|
||||||
|
dimensionedScalar Cmu_;
|
||||||
|
|
||||||
scalar yPlusLam(const scalar kappa, const scalar E);
|
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||||
scalar yPlusLam_;
|
scalar yPlusLam_;
|
||||||
@ -192,7 +194,6 @@ public:
|
|||||||
return epsilonSmall_;
|
return epsilonSmall_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Allow k0 to be changed
|
//- Allow k0 to be changed
|
||||||
dimensionedScalar& k0()
|
dimensionedScalar& k0()
|
||||||
{
|
{
|
||||||
@ -211,7 +212,6 @@ public:
|
|||||||
return epsilonSmall_;
|
return epsilonSmall_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return kappa for use in wall-functions
|
//- Return kappa for use in wall-functions
|
||||||
dimensionedScalar kappa() const
|
dimensionedScalar kappa() const
|
||||||
{
|
{
|
||||||
@ -224,6 +224,18 @@ public:
|
|||||||
return E_;
|
return E_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return Cmu for use in wall-functions
|
||||||
|
dimensionedScalar Cmu() const
|
||||||
|
{
|
||||||
|
return Cmu_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the near wall distances
|
||||||
|
const nearWallDist& y() const
|
||||||
|
{
|
||||||
|
return y_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return y+ at the edge of the laminar sublayer
|
//- Return y+ at the edge of the laminar sublayer
|
||||||
// for use in wall-functions
|
// for use in wall-functions
|
||||||
scalar yPlusLam() const
|
scalar yPlusLam() const
|
||||||
@ -237,6 +249,12 @@ public:
|
|||||||
return coeffDict_;
|
return coeffDict_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Const access to the wall functions coefficients dictionary
|
||||||
|
const dictionary& walLFunctionDict() const
|
||||||
|
{
|
||||||
|
return wallFunctionDict_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the laminar viscosity
|
//- Return the laminar viscosity
|
||||||
const volScalarField& nu() const
|
const volScalarField& nu() const
|
||||||
|
|||||||
@ -143,9 +143,21 @@ RNGkEpsilon::RNGkEpsilon
|
|||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
|
|
||||||
nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_))
|
nut_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"nut",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
{
|
{
|
||||||
# include "wallViscosityI.H"
|
nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
|
|
||||||
printCoeffs();
|
printCoeffs();
|
||||||
}
|
}
|
||||||
@ -239,13 +251,14 @@ void RNGkEpsilon::correct()
|
|||||||
|
|
||||||
volScalarField S2 = 2*magSqr(symm(fvc::grad(U_)));
|
volScalarField S2 = 2*magSqr(symm(fvc::grad(U_)));
|
||||||
|
|
||||||
volScalarField G = nut_*S2;
|
volScalarField G("G", nut_*S2);
|
||||||
|
|
||||||
volScalarField eta = sqrt(S2)*k_/epsilon_;
|
volScalarField eta = sqrt(S2)*k_/epsilon_;
|
||||||
volScalarField R =
|
volScalarField R =
|
||||||
((eta*(scalar(1) - eta/eta0_))/(scalar(1) + beta_*eta*sqr(eta)));
|
((eta*(scalar(1) - eta/eta0_))/(scalar(1) + beta_*eta*sqr(eta)));
|
||||||
|
|
||||||
# include "wallFunctionsI.H"
|
// Update espsilon and G at the wall
|
||||||
|
epsilon_.boundaryField().updateCoeffs();
|
||||||
|
|
||||||
// Dissipation equation
|
// Dissipation equation
|
||||||
tmp<fvScalarMatrix> epsEqn
|
tmp<fvScalarMatrix> epsEqn
|
||||||
@ -261,7 +274,7 @@ void RNGkEpsilon::correct()
|
|||||||
|
|
||||||
epsEqn().relax();
|
epsEqn().relax();
|
||||||
|
|
||||||
# include "wallDissipationI.H"
|
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||||
|
|
||||||
solve(epsEqn);
|
solve(epsEqn);
|
||||||
bound(epsilon_, epsilon0_);
|
bound(epsilon_, epsilon0_);
|
||||||
@ -285,9 +298,7 @@ void RNGkEpsilon::correct()
|
|||||||
|
|
||||||
// Re-calculate viscosity
|
// Re-calculate viscosity
|
||||||
nut_ = Cmu_*sqr(k_)/epsilon_;
|
nut_ = Cmu_*sqr(k_)/epsilon_;
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
# include "wallViscosityI.H"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,209 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "epsilonWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "wallFvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void epsilonWallFunctionFvPatchScalarField::checkType()
|
||||||
|
{
|
||||||
|
if (!isA<wallFvPatch>(patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn("epsilonWallFunctionFvPatchScalarField::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 * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(p, iF)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(p, iF, dict)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonWallFunctionFvPatchScalarField& ewfpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(ewfpsf)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonWallFunctionFvPatchScalarField& ewfpsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
|
||||||
|
const scalar Cmu = ras.Cmu().value();
|
||||||
|
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||||
|
const scalar Cmu75 = pow(Cmu, 0.75);
|
||||||
|
const scalar kappa = ras.kappa().value();
|
||||||
|
const scalar yPlusLam = ras.yPlusLam();
|
||||||
|
|
||||||
|
const scalarField& y = ras.y()[patch().index()];
|
||||||
|
|
||||||
|
volScalarField& G = const_cast<volScalarField&>
|
||||||
|
(db().lookupObject<volScalarField>("G"));
|
||||||
|
|
||||||
|
volScalarField& epsilon = const_cast<volScalarField&>
|
||||||
|
(db().lookupObject<volScalarField>("epsilon"));
|
||||||
|
|
||||||
|
const scalarField& k = db().lookupObject<volScalarField>("k");
|
||||||
|
|
||||||
|
const scalarField& nuw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||||
|
|
||||||
|
const scalarField& nutw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nut");
|
||||||
|
|
||||||
|
const fvPatchVectorField& Uw =
|
||||||
|
patch().lookupPatchField<volVectorField, vector>("U");
|
||||||
|
|
||||||
|
const scalarField magGradUw = mag(Uw.snGrad());
|
||||||
|
|
||||||
|
// Set epsilon and G
|
||||||
|
forAll(nutw, faceI)
|
||||||
|
{
|
||||||
|
label faceCellI = patch().faceCells()[faceI];
|
||||||
|
|
||||||
|
scalar yPlus = Cmu25*y[faceCellI]*sqrt(k[faceCellI])/nuw[faceI];
|
||||||
|
|
||||||
|
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa*y[faceCellI]);
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam)
|
||||||
|
{
|
||||||
|
G[faceCellI] =
|
||||||
|
(nutw[faceI] + nuw[faceI])
|
||||||
|
*magGradUw[faceI]
|
||||||
|
*Cmu25*sqrt(k[faceCellI])
|
||||||
|
/(kappa*y[faceCellI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: perform averaging for cells sharing more than one boundary face
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void epsilonWallFunctionFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedInternalValueFvPatchField<scalar>::evaluate(commsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
epsilonWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::epsilonWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Replaces functionality in wallFunctionsI.H
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
epsilonWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef epsilonWallFunctionFvPatchScalarField_H
|
||||||
|
#define epsilonWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedInternalValueFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class epsilonWallFunctionFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class epsilonWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedInternalValueFvPatchField<scalar>
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Check the type of the patch
|
||||||
|
void checkType();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("epsilonWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// epsilonWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new epsilonWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
epsilonWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const epsilonWallFunctionFvPatchScalarField&,
|
||||||
|
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 epsilonWallFunctionFvPatchScalarField(*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
|
||||||
|
void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,184 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fixedInternalValueFvPatchField.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchField<Type>(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fixedInternalValueFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchField<Type>(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchField<Type>(p, iF, dict)
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::operator=(this->patchInternalField());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fixedInternalValueFvPatchField& fivpf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchField<Type>(fivpf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fixedInternalValueFvPatchField& fivpf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchField<Type>(fivpf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void fixedInternalValueFvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||||
|
{
|
||||||
|
if (!this->updated())
|
||||||
|
{
|
||||||
|
this->updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "fixedInternalValueFvPatchField<Type>::evaluate" << endl;
|
||||||
|
zeroGradientFvPatchField<Type>::evaluate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > fixedInternalValueFvPatchField<Type>::valueInternalCoeffs
|
||||||
|
(
|
||||||
|
const tmp<scalarField>&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
Info<< "fixedInternalValueFvPatchField<Type>::valueInternalCoeffs" << endl;
|
||||||
|
return tmp<Field<Type> >
|
||||||
|
(
|
||||||
|
new Field<Type>(this->size(), pTraits<Type>::one)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > fixedInternalValueFvPatchField<Type>::valueBoundaryCoeffs
|
||||||
|
(
|
||||||
|
const tmp<scalarField>&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
Info<< "fixedInternalValueFvPatchField<Type>::valueBoundaryCoeffs" << endl;
|
||||||
|
// return tmp<Field<Type> >
|
||||||
|
// (
|
||||||
|
// new Field<Type>(this->size(), pTraits<Type>::zero)
|
||||||
|
// );
|
||||||
|
return this->patchInternalField();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > fixedInternalValueFvPatchField<Type>::
|
||||||
|
gradientInternalCoeffs() const
|
||||||
|
{
|
||||||
|
Info<< "fixedInternalValueFvPatchField<Type>::gradientInternalCoeffs"
|
||||||
|
<< endl;
|
||||||
|
return tmp<Field<Type> >
|
||||||
|
(
|
||||||
|
new Field<Type>(this->size(), pTraits<Type>::zero)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > fixedInternalValueFvPatchField<Type>::
|
||||||
|
gradientBoundaryCoeffs() const
|
||||||
|
{
|
||||||
|
Info<< "fixedInternalValueFvPatchField<Type>::gradientBoundaryCoeffs"
|
||||||
|
<< endl;
|
||||||
|
return tmp<Field<Type> >
|
||||||
|
(
|
||||||
|
new Field<Type>(this->size(), pTraits<Type>::zero)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void fixedInternalValueFvPatchField<Type>::manipulateMatrix
|
||||||
|
(
|
||||||
|
fvMatrix<Type>& matrix
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Info<< "fixedInternalValueFvPatchField<Type>::manipulateMatrix(...)"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
// Apply the patch internal field as a constraint in the matrix
|
||||||
|
matrix.setValues(this->patch().faceCells(), this->patchInternalField());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,174 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
fixedInternalValueFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fixedInternalValueFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fixedInternalValueFvPatchField_H
|
||||||
|
#define fixedInternalValueFvPatchField_H
|
||||||
|
|
||||||
|
#include "zeroGradientFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fixedInternalValueFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class fixedInternalValueFvPatchField
|
||||||
|
:
|
||||||
|
public zeroGradientFvPatchField<Type>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("fixedInternalValue");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping the given fixedInternalValueFvPatchField<Type>
|
||||||
|
// onto a new patch
|
||||||
|
fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fixedInternalValueFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fixedInternalValueFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new fixedInternalValueFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
fixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fixedInternalValueFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchField<Type> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new fixedInternalValueFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Evaluate the patch field
|
||||||
|
virtual void evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return the matrix diagonal coefficients corresponding to the
|
||||||
|
// evaluation of the value of this patchField with given weights
|
||||||
|
virtual tmp<Field<Type> > valueInternalCoeffs
|
||||||
|
(
|
||||||
|
const tmp<scalarField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the matrix source coefficients corresponding to the
|
||||||
|
// evaluation of the value of this patchField with given weights
|
||||||
|
virtual tmp<Field<Type> > valueBoundaryCoeffs
|
||||||
|
(
|
||||||
|
const tmp<scalarField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the matrix diagonal coefficients corresponding to the
|
||||||
|
// evaluation of the gradient of this patchField
|
||||||
|
virtual tmp<Field<Type> > gradientInternalCoeffs() const;
|
||||||
|
|
||||||
|
//- Return the matrix source coefficients corresponding to the
|
||||||
|
// evaluation of the gradient of this patchField
|
||||||
|
virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
|
||||||
|
|
||||||
|
//-Manipulate a matrix
|
||||||
|
virtual void manipulateMatrix(fvMatrix<Type>& matrix);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "fixedInternalValueFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fixedInternalValueFvPatchFields.H"
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(fixedInternalValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fixedInternalValueFvPatchFields_H
|
||||||
|
#define fixedInternalValueFvPatchFields_H
|
||||||
|
|
||||||
|
#include "fixedInternalValueFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(fixedInternalValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,155 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "kWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "wallFvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void kWallFunctionFvPatchScalarField::checkType()
|
||||||
|
{
|
||||||
|
if (!isA<wallFvPatch>(patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn("kWallFunctionFvPatchScalarField::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 * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchScalarField(p, iF)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchScalarField(ptf, p, iF, mapper)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchScalarField(p, iF, dict)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kWallFunctionFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchScalarField(tppsf)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kWallFunctionFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
zeroGradientFvPatchScalarField(tppsf, iF)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void kWallFunctionFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
zeroGradientFvPatchScalarField::evaluate(commsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void kWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
zeroGradientFvPatchScalarField::write(os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
kWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,161 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::kWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
kWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef kWallFunctionFvPatchScalarField_H
|
||||||
|
#define kWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "zeroGradientFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class kWallFunctionFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class kWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public zeroGradientFvPatchScalarField
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Check the type of the patch
|
||||||
|
void checkType();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("kWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// kWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new kWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
kWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const kWallFunctionFvPatchScalarField&,
|
||||||
|
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 kWallFunctionFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Evaluate the patchField
|
||||||
|
virtual void evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,204 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "nutRoughWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
scalar nutRoughWallFunctionFvPatchScalarField::fnRough
|
||||||
|
(
|
||||||
|
const scalar KsPlus,
|
||||||
|
const scalar kappa
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Set deltaB based on non-dimensional roughness height
|
||||||
|
scalar deltaB = 0.0;
|
||||||
|
if (KsPlus <= 2.25)
|
||||||
|
{
|
||||||
|
deltaB = 0.0;
|
||||||
|
}
|
||||||
|
else if ((KsPlus > 2.25) && (KsPlus <= 90.0))
|
||||||
|
{
|
||||||
|
deltaB =
|
||||||
|
1.0/kappa
|
||||||
|
*log((KsPlus - 2.25)/87.75 + Cs_*KsPlus)
|
||||||
|
*sin(0.4258*(log(KsPlus) - 0.811));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deltaB = 1.0/kappa*(1.0 + Cs_*KsPlus);
|
||||||
|
}
|
||||||
|
|
||||||
|
return exp(deltaB*kappa);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
nutRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
Ks_(0.0),
|
||||||
|
Cs_(0.0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutRoughWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
Ks_(ptf.Ks_),
|
||||||
|
Cs_(ptf.Cs_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF, dict),
|
||||||
|
Ks_(readScalar(dict.lookup("Ks"))),
|
||||||
|
Cs_(readScalar(dict.lookup("Cs")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutRoughWallFunctionFvPatchScalarField& nrwfpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(nrwfpsf),
|
||||||
|
Ks_(nrwfpsf.Ks_),
|
||||||
|
Cs_(nrwfpsf.Cs_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutRoughWallFunctionFvPatchScalarField& nrwfpsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(nrwfpsf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void nutRoughWallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
|
||||||
|
const scalar Cmu = ras.Cmu().value();
|
||||||
|
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||||
|
const scalar kappa = ras.kappa().value();
|
||||||
|
const scalar E = ras.E().value();
|
||||||
|
const scalar yPlusLam = ras.yPlusLam();
|
||||||
|
|
||||||
|
const scalarField& y = ras.y()[patch().index()];
|
||||||
|
|
||||||
|
const scalarField& k = db().lookupObject<volScalarField>("k");
|
||||||
|
|
||||||
|
const scalarField& nuw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||||
|
|
||||||
|
scalarField& nutw = *this;
|
||||||
|
|
||||||
|
forAll(nutw, faceI)
|
||||||
|
{
|
||||||
|
label faceCellI = patch().faceCells()[faceI];
|
||||||
|
|
||||||
|
scalar uStar = Cmu25*sqrt(k[faceCellI]);
|
||||||
|
|
||||||
|
scalar yPlus = uStar*y[faceCellI]/nuw[faceI];
|
||||||
|
|
||||||
|
scalar KsPlus = uStar*Ks_/nuw[faceI];
|
||||||
|
|
||||||
|
scalar Edash = E/fnRough(KsPlus, kappa);
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam)
|
||||||
|
{
|
||||||
|
nutw[faceI] = nuw[faceI]*(yPlus*kappa/log(Edash*yPlus) - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nutw[faceI] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void nutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::write(os);
|
||||||
|
os.writeKeyword("Cs") << Cs_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("Ks") << Ks_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField(fvPatchScalarField, nutRoughWallFunctionFvPatchScalarField);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,167 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::incompressible::RASModels::nutRoughWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Rough wall function boundary condition
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
nutRoughWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef nutRoughWallFunctionFvPatchScalarField_H
|
||||||
|
#define nutRoughWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class nutWallFunctionFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class nutRoughWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Roughness height
|
||||||
|
scalar Ks_;
|
||||||
|
|
||||||
|
//- Roughness constant
|
||||||
|
scalar Cs_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Compute the roughness function
|
||||||
|
scalar fnRough(const scalar KsPlus, const scalar kappa) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("nutWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// nutRoughWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutRoughWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutRoughWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new nutRoughWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
nutRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutRoughWallFunctionFvPatchScalarField&,
|
||||||
|
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 nutRoughWallFunctionFvPatchScalarField(*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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,302 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
roughnessHeight_(pTraits<scalar>::zero),
|
||||||
|
roughnessConstant_(pTraits<scalar>::zero),
|
||||||
|
roughnessFudgeFactor_(pTraits<scalar>::zero)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
roughnessHeight_(ptf.roughnessHeight_),
|
||||||
|
roughnessConstant_(ptf.roughnessConstant_),
|
||||||
|
roughnessFudgeFactor_(ptf.roughnessFudgeFactor_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF, dict),
|
||||||
|
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
|
||||||
|
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
|
||||||
|
roughnessFudgeFactor_(readScalar(dict.lookup("roughnessFudgeFactor")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf),
|
||||||
|
roughnessHeight_(tppsf.roughnessHeight_),
|
||||||
|
roughnessConstant_(tppsf.roughnessConstant_),
|
||||||
|
roughnessFudgeFactor_(tppsf.roughnessFudgeFactor_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf, iF),
|
||||||
|
roughnessHeight_(tppsf.roughnessHeight_),
|
||||||
|
roughnessConstant_(tppsf.roughnessConstant_),
|
||||||
|
roughnessFudgeFactor_(tppsf.roughnessFudgeFactor_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
|
||||||
|
const scalar kappa = ras.kappa().value();
|
||||||
|
const scalar E = ras.E().value();
|
||||||
|
const scalar yPlusLam = 11.225;
|
||||||
|
|
||||||
|
// The reciprical of the distance to the adjacent cell centre.
|
||||||
|
const scalarField& ry = patch().deltaCoeffs();
|
||||||
|
|
||||||
|
const fvPatchVectorField& U =
|
||||||
|
patch().lookupPatchField<volVectorField, vector>("U");
|
||||||
|
|
||||||
|
// The flow velocity at the adjacent cell centre.
|
||||||
|
scalarField magUp = mag(U.patchInternalField() - U);
|
||||||
|
|
||||||
|
const scalarField& nuw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||||
|
scalarField& nutw = *this;
|
||||||
|
|
||||||
|
scalarField magFaceGradU = mag(U.snGrad());
|
||||||
|
|
||||||
|
if (roughnessHeight_ > 0.0)
|
||||||
|
{
|
||||||
|
// Rough Walls.
|
||||||
|
const scalar c_1 = 1/(90 - 2.25) + roughnessConstant_;
|
||||||
|
static const scalar c_2 = 2.25/(90 - 2.25);
|
||||||
|
static const scalar c_3 = 2.0*atan(1.0)/log(90/2.25);
|
||||||
|
static const scalar c_4 = c_3*log(2.25);
|
||||||
|
|
||||||
|
//if (KsPlusBasedOnYPlus_)
|
||||||
|
{
|
||||||
|
// If KsPlus is based on YPlus the extra term added to the law
|
||||||
|
// of the wall will depend on yPlus.
|
||||||
|
forAll(nutw, facei)
|
||||||
|
{
|
||||||
|
const scalar magUpara = magUp[facei];
|
||||||
|
const scalar Re = magUpara/(nuw[facei]*ry[facei]);
|
||||||
|
const scalar kappaRe = kappa*Re;
|
||||||
|
|
||||||
|
scalar yPlus = yPlusLam;
|
||||||
|
const scalar ryPlusLam = 1.0/yPlus;
|
||||||
|
|
||||||
|
int iter = 0;
|
||||||
|
scalar yPlusLast = 0.0;
|
||||||
|
scalar dKsPlusdYPlus = roughnessHeight_*ry[facei];
|
||||||
|
|
||||||
|
// Enforce the roughnessHeight to be less than the distance to
|
||||||
|
// the first cell centre.
|
||||||
|
if(dKsPlusdYPlus > 1)
|
||||||
|
{
|
||||||
|
dKsPlusdYPlus = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fudge factor to get results to be similar to fluent
|
||||||
|
// (at least difference between rough and smooth).
|
||||||
|
dKsPlusdYPlus *= roughnessFudgeFactor_;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
yPlusLast = yPlus;
|
||||||
|
|
||||||
|
// The non-dimensional roughness height.
|
||||||
|
scalar KsPlus = yPlus*dKsPlusdYPlus;
|
||||||
|
|
||||||
|
// The extra term in the law-of-the-wall.
|
||||||
|
scalar G = 0.0;
|
||||||
|
|
||||||
|
scalar yPlusGPrime = 0.0;
|
||||||
|
|
||||||
|
if (KsPlus >= 90)
|
||||||
|
{
|
||||||
|
const scalar t_1 = 1 + roughnessConstant_*KsPlus;
|
||||||
|
G = log(t_1);
|
||||||
|
yPlusGPrime = roughnessConstant_*KsPlus/t_1;
|
||||||
|
}
|
||||||
|
else if (KsPlus > 2.25)
|
||||||
|
{
|
||||||
|
const scalar t_1 = c_1*KsPlus - c_2;
|
||||||
|
const scalar t_2 = c_3*log(KsPlus) - c_4;
|
||||||
|
const scalar sint_2 = sin(t_2);
|
||||||
|
const scalar logt_1 = log(t_1);
|
||||||
|
G = logt_1*sint_2;
|
||||||
|
yPlusGPrime =
|
||||||
|
(c_1*sint_2*KsPlus/t_1) + (c_3*logt_1*cos(t_2));
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar denom = 1.0 + log(E* yPlus) - G - yPlusGPrime;
|
||||||
|
if (mag(denom) > VSMALL)
|
||||||
|
{
|
||||||
|
yPlus = (kappaRe + yPlus*(1 - yPlusGPrime))/denom;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ensure immediate end and nutw = 0.
|
||||||
|
yPlus = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} while
|
||||||
|
(
|
||||||
|
mag(ryPlusLam*(yPlus - yPlusLast)) > 0.0001
|
||||||
|
&& ++iter < 10
|
||||||
|
&& yPlus > VSMALL
|
||||||
|
);
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam)
|
||||||
|
{
|
||||||
|
nutw[facei] = nuw[facei]*(yPlus*yPlus/Re - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nutw[facei] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Smooth Walls.
|
||||||
|
forAll(nutw, facei)
|
||||||
|
{
|
||||||
|
const scalar magUpara = magUp[facei];
|
||||||
|
const scalar Re = magUpara/(nuw[facei]*ry[facei]);
|
||||||
|
const scalar kappaRe = kappa*Re;
|
||||||
|
|
||||||
|
scalar yPlus = yPlusLam;
|
||||||
|
const scalar ryPlusLam = 1.0/yPlus;
|
||||||
|
|
||||||
|
int iter = 0;
|
||||||
|
scalar yPlusLast = 0.0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
yPlusLast = yPlus;
|
||||||
|
yPlus = (kappaRe + yPlus)/(1.0 + log(E*yPlus));
|
||||||
|
|
||||||
|
} while(mag(ryPlusLam*(yPlus - yPlusLast)) > 0.0001 && ++iter < 10);
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam)
|
||||||
|
{
|
||||||
|
nutw[facei] = nuw[facei]*(yPlus*yPlus/Re - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nutw[facei] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
fixedValueFvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("roughnessHeight")
|
||||||
|
<< roughnessHeight_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("roughnessConstant")
|
||||||
|
<< roughnessConstant_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("roughnessFudgeFactor")
|
||||||
|
<< roughnessFudgeFactor_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,208 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::incompressible::RASModels::
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wall function boundary condition for rough walls
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
||||||
|
#define nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
scalar roughnessHeight_;
|
||||||
|
scalar roughnessConstant_;
|
||||||
|
scalar roughnessFudgeFactor_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("nutSpalartAllmarasStandardRoughWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField&,
|
||||||
|
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 nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the fluctuation scale
|
||||||
|
const scalar& roughnessHeight() const
|
||||||
|
{
|
||||||
|
return roughnessHeight_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the fluctuation scale to allow adjustment
|
||||||
|
scalar& roughnessHeight()
|
||||||
|
{
|
||||||
|
return roughnessHeight_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the fluctuation scale
|
||||||
|
const scalar& roughnessConstant() const
|
||||||
|
{
|
||||||
|
return roughnessConstant_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the fluctuation scale to allow adjustment
|
||||||
|
scalar& roughnessConstant()
|
||||||
|
{
|
||||||
|
return roughnessConstant_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the fluctuation scale
|
||||||
|
const scalar& roughnessFudgeFactor() const
|
||||||
|
{
|
||||||
|
return roughnessFudgeFactor_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the fluctuation scale to allow adjustment
|
||||||
|
scalar& roughnessFudgeFactor()
|
||||||
|
{
|
||||||
|
return roughnessFudgeFactor_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Evaluate the patchField
|
||||||
|
virtual void evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType=Pstream::blocking
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,172 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
|
||||||
|
scalar kappa = ras.kappa().value();
|
||||||
|
scalar E = ras.E().value();
|
||||||
|
scalar yPlusLam = ras.yPlusLam();
|
||||||
|
|
||||||
|
const scalarField& ry = patch().deltaCoeffs();
|
||||||
|
|
||||||
|
const fvPatchVectorField& U =
|
||||||
|
patch().lookupPatchField<volVectorField, vector>("U");
|
||||||
|
|
||||||
|
scalarField magUp = mag(U.patchInternalField() - U);
|
||||||
|
|
||||||
|
const scalarField& nuw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||||
|
scalarField& nutw = *this;
|
||||||
|
|
||||||
|
scalarField magFaceGradU = mag(U.snGrad());
|
||||||
|
|
||||||
|
forAll(nutw, facei)
|
||||||
|
{
|
||||||
|
scalar magUpara = magUp[facei];
|
||||||
|
|
||||||
|
scalar kappaRe = kappa*magUpara/(nuw[facei]*ry[facei]);
|
||||||
|
|
||||||
|
scalar yPlus = yPlusLam;
|
||||||
|
scalar ryPlusLam = 1.0/yPlus;
|
||||||
|
|
||||||
|
int iter = 0;
|
||||||
|
scalar yPlusLast = 0.0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
yPlusLast = yPlus;
|
||||||
|
yPlus = (kappaRe + yPlus)/(1.0 + log(E*yPlus));
|
||||||
|
|
||||||
|
} while(mag(ryPlusLam*(yPlus - yPlusLast)) > 0.01 && ++iter < 10 );
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam)
|
||||||
|
{
|
||||||
|
nutw[facei] = nuw[facei]*(yPlus*kappa/log(E*yPlus) - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nutw[facei] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,160 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::incompressible::RASModels::
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wall function boundary condition for walls
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef nutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
||||||
|
#define nutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class nutWallFunctionFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("nutSpalartAllmarasStandardWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField&,
|
||||||
|
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 nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Evaluate the patchField
|
||||||
|
virtual void evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType=Pstream::blocking
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,180 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "nutSpalartAllmarasWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasWallFunctionFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasWallFunctionFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void nutSpalartAllmarasWallFunctionFvPatchScalarField::evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
|
||||||
|
scalar kappa = ras.kappa().value();
|
||||||
|
scalar E = ras.E().value();
|
||||||
|
|
||||||
|
const scalarField& ry = patch().deltaCoeffs();
|
||||||
|
|
||||||
|
const fvPatchVectorField& U =
|
||||||
|
patch().lookupPatchField<volVectorField, vector>("U");
|
||||||
|
|
||||||
|
scalarField magUp = mag(U.patchInternalField() - U);
|
||||||
|
|
||||||
|
const scalarField& nuw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||||
|
|
||||||
|
scalarField& nutw = *this;
|
||||||
|
|
||||||
|
scalarField magFaceGradU = mag(U.snGrad());
|
||||||
|
|
||||||
|
forAll(nutw, facei)
|
||||||
|
{
|
||||||
|
scalar magUpara = magUp[facei];
|
||||||
|
|
||||||
|
scalar utau = sqrt((nutw[facei] + nuw[facei])*magFaceGradU[facei]);
|
||||||
|
|
||||||
|
if (utau > VSMALL)
|
||||||
|
{
|
||||||
|
int iter = 0;
|
||||||
|
scalar err = GREAT;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
scalar kUu = min(kappa*magUpara/utau, 50);
|
||||||
|
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
|
||||||
|
|
||||||
|
scalar f =
|
||||||
|
- utau/(ry[facei]*nuw[facei])
|
||||||
|
+ magUpara/utau
|
||||||
|
+ 1/E*(fkUu - 1.0/6.0*kUu*sqr(kUu));
|
||||||
|
|
||||||
|
scalar df =
|
||||||
|
1.0/(ry[facei]*nuw[facei])
|
||||||
|
+ magUpara/sqr(utau)
|
||||||
|
+ 1/E*kUu*fkUu/utau;
|
||||||
|
|
||||||
|
scalar utauNew = utau + f/df;
|
||||||
|
err = mag((utau - utauNew)/utau);
|
||||||
|
utau = utauNew;
|
||||||
|
|
||||||
|
} while (utau > VSMALL && err > 0.01 && ++iter < 10);
|
||||||
|
|
||||||
|
nutw[facei] =
|
||||||
|
max(sqr(max(utau, 0))/magFaceGradU[facei] - nuw[facei], 0.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nutw[facei] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField(fvPatchScalarField, nutSpalartAllmarasWallFunctionFvPatchScalarField);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,153 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::incompressible::RASModels::
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wall function boundary condition for walls
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef nutSpalartAllmarasWallFunctionFvPatchScalarField_H
|
||||||
|
#define nutSpalartAllmarasWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class nutSpalartAllmarasWallFunctionFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("nutSpalartAllmarasWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new nutSpalartAllmarasWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
nutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutSpalartAllmarasWallFunctionFvPatchScalarField&,
|
||||||
|
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 nutSpalartAllmarasWallFunctionFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Evaluate the patchField
|
||||||
|
virtual void evaluate
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType=Pstream::blocking
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,157 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "nutWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
nutWallFunctionFvPatchScalarField::
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutWallFunctionFvPatchScalarField::
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutWallFunctionFvPatchScalarField::
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutWallFunctionFvPatchScalarField::
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutWallFunctionFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
nutWallFunctionFvPatchScalarField::
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutWallFunctionFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(tppsf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void nutWallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
|
||||||
|
const scalar Cmu = ras.Cmu().value();
|
||||||
|
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||||
|
const scalar kappa = ras.kappa().value();
|
||||||
|
const scalar E = ras.E().value();
|
||||||
|
const scalar yPlusLam = ras.yPlusLam();
|
||||||
|
|
||||||
|
const scalarField& y = ras.y()[patch().index()];
|
||||||
|
|
||||||
|
const scalarField& k = db().lookupObject<volScalarField>("k");
|
||||||
|
|
||||||
|
const scalarField& nuw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||||
|
|
||||||
|
scalarField& nutw = *this;
|
||||||
|
|
||||||
|
forAll(nutw, faceI)
|
||||||
|
{
|
||||||
|
label faceCellI = patch().faceCells()[faceI];
|
||||||
|
|
||||||
|
scalar yPlus = Cmu25*y[faceCellI]*sqrt(k[faceCellI])/nuw[faceI];
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam)
|
||||||
|
{
|
||||||
|
nutw[faceI] = nuw[faceI]*(yPlus*kappa/log(E*yPlus) - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nutw[faceI] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void nutWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>::write(os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField(fvPatchScalarField, nutWallFunctionFvPatchScalarField);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,154 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::incompressible::RASModels::nutWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wall function boundary condition
|
||||||
|
- replicates OpenFOAM v1.5 (and lower) behaviour
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
nutWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef nutWallFunctionFvPatchScalarField_H
|
||||||
|
#define nutWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class nutWallFunctionFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class nutWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("nutWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// nutWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new nutWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
nutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const nutWallFunctionFvPatchScalarField&,
|
||||||
|
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 nutWallFunctionFvPatchScalarField(*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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,200 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "omegaWallFunctionFvPatchScalarField.H"
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "wallFvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void omegaWallFunctionFvPatchScalarField::checkType()
|
||||||
|
{
|
||||||
|
if (!isA<wallFvPatch>(patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn("omegaWallFunctionFvPatchScalarField::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 * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(p, iF)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const omegaWallFunctionFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(p, iF, dict)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const omegaWallFunctionFvPatchScalarField& ewfpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(ewfpsf)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const omegaWallFunctionFvPatchScalarField& ewfpsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF)
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
|
||||||
|
const scalar Cmu = ras.Cmu().value();
|
||||||
|
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||||
|
|
||||||
|
const scalar kappa = ras.kappa().value();
|
||||||
|
const scalar yPlusLam = ras.yPlusLam();
|
||||||
|
|
||||||
|
const scalarField& y = ras.y()[patch().index()];
|
||||||
|
|
||||||
|
volScalarField& G = const_cast<volScalarField&>
|
||||||
|
(db().lookupObject<volScalarField>("G"));
|
||||||
|
|
||||||
|
volScalarField& omega = const_cast<volScalarField&>
|
||||||
|
(db().lookupObject<volScalarField>("omega"));
|
||||||
|
|
||||||
|
const scalarField& k = db().lookupObject<volScalarField>("k");
|
||||||
|
|
||||||
|
const scalarField& nuw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||||
|
|
||||||
|
const scalarField& nutw =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("nut");
|
||||||
|
|
||||||
|
const fvPatchVectorField& Uw =
|
||||||
|
patch().lookupPatchField<volVectorField, vector>("U");
|
||||||
|
|
||||||
|
const scalarField magGradUw = mag(Uw.snGrad());
|
||||||
|
|
||||||
|
// Set epsilon and G
|
||||||
|
forAll(nutw, faceI)
|
||||||
|
{
|
||||||
|
label faceCellI = patch().faceCells()[faceI];
|
||||||
|
|
||||||
|
scalar yPlus = Cmu25*y[faceCellI]*sqrt(k[faceCellI])/nuw[faceI];
|
||||||
|
|
||||||
|
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa*y[faceCellI]);
|
||||||
|
|
||||||
|
if (yPlus > yPlusLam)
|
||||||
|
{
|
||||||
|
G[faceCellI] =
|
||||||
|
(nutw[faceI] + nuw[faceI])
|
||||||
|
*magGradUw[faceI]
|
||||||
|
*Cmu25*sqrt(k[faceCellI])
|
||||||
|
/(kappa*y[faceCellI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: perform averaging for cells sharing more than one boundary face
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
omegaWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace RASModels
|
||||||
|
} // End namespace incompressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,159 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::omegaWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Replaces functionality in wallFunctionsI.H
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
omegaWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef omegaWallFunctionFvPatchScalarField_H
|
||||||
|
#define omegaWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedInternalValueFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace incompressible
|
||||||
|
{
|
||||||
|
namespace RASModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class omegaWallFunctionFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class omegaWallFunctionFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedInternalValueFvPatchField<scalar>
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Check the type of the patch
|
||||||
|
void checkType();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("omegaWallFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// omegaWallFunctionFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const omegaWallFunctionFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const omegaWallFunctionFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new omegaWallFunctionFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
omegaWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const omegaWallFunctionFvPatchScalarField&,
|
||||||
|
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 omegaWallFunctionFvPatchScalarField(*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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -117,9 +117,21 @@ kEpsilon::kEpsilon
|
|||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
|
|
||||||
nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_))
|
nut_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"nut",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
{
|
{
|
||||||
# include "wallViscosityI.H"
|
nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
|
|
||||||
printCoeffs();
|
printCoeffs();
|
||||||
}
|
}
|
||||||
@ -207,9 +219,10 @@ void kEpsilon::correct()
|
|||||||
|
|
||||||
RASModel::correct();
|
RASModel::correct();
|
||||||
|
|
||||||
volScalarField G = nut_*2*magSqr(symm(fvc::grad(U_)));
|
volScalarField G("G", nut_*2*magSqr(symm(fvc::grad(U_))));
|
||||||
|
|
||||||
# include "wallFunctionsI.H"
|
// Update espsilon and G at the wall
|
||||||
|
epsilon_.boundaryField().updateCoeffs();
|
||||||
|
|
||||||
// Dissipation equation
|
// Dissipation equation
|
||||||
tmp<fvScalarMatrix> epsEqn
|
tmp<fvScalarMatrix> epsEqn
|
||||||
@ -225,7 +238,7 @@ void kEpsilon::correct()
|
|||||||
|
|
||||||
epsEqn().relax();
|
epsEqn().relax();
|
||||||
|
|
||||||
# include "wallDissipationI.H"
|
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||||
|
|
||||||
solve(epsEqn);
|
solve(epsEqn);
|
||||||
bound(epsilon_, epsilon0_);
|
bound(epsilon_, epsilon0_);
|
||||||
@ -250,9 +263,7 @@ void kEpsilon::correct()
|
|||||||
|
|
||||||
// Re-calculate viscosity
|
// Re-calculate viscosity
|
||||||
nut_ = Cmu_*sqr(k_)/epsilon_;
|
nut_ = Cmu_*sqr(k_)/epsilon_;
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
# include "wallViscosityI.H"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -237,9 +237,27 @@ kOmegaSST::kOmegaSST
|
|||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
|
|
||||||
nut_(a1_*k_/max(a1_*(omega_ + omegaSmall_), F2()*mag(symm(fvc::grad(U_)))))
|
nut_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"nut",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
{
|
{
|
||||||
# include "kOmegaWallViscosityI.H"
|
nut_ ==
|
||||||
|
a1_*k_
|
||||||
|
/max
|
||||||
|
(
|
||||||
|
a1_*(omega_ + omegaSmall_),
|
||||||
|
F2()*mag(symm(fvc::grad(U_)))
|
||||||
|
);
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
|
|
||||||
printCoeffs();
|
printCoeffs();
|
||||||
}
|
}
|
||||||
@ -341,9 +359,10 @@ void kOmegaSST::correct()
|
|||||||
}
|
}
|
||||||
|
|
||||||
volScalarField S2 = magSqr(symm(fvc::grad(U_)));
|
volScalarField S2 = magSqr(symm(fvc::grad(U_)));
|
||||||
volScalarField G = nut_*2*S2;
|
volScalarField G("G", nut_*2*S2);
|
||||||
|
|
||||||
# include "kOmegaWallFunctionsI.H"
|
// Update omega and G at the wall
|
||||||
|
omega_.boundaryField().updateCoeffs();
|
||||||
|
|
||||||
volScalarField CDkOmega =
|
volScalarField CDkOmega =
|
||||||
(2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_;
|
(2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_;
|
||||||
@ -369,7 +388,7 @@ void kOmegaSST::correct()
|
|||||||
|
|
||||||
omegaEqn().relax();
|
omegaEqn().relax();
|
||||||
|
|
||||||
# include "wallOmegaI.H"
|
omegaEqn().boundaryManipulate(omega_.boundaryField());
|
||||||
|
|
||||||
solve(omegaEqn);
|
solve(omegaEqn);
|
||||||
bound(omega_, omega0_);
|
bound(omega_, omega0_);
|
||||||
@ -393,9 +412,7 @@ void kOmegaSST::correct()
|
|||||||
|
|
||||||
// Re-calculate viscosity
|
// Re-calculate viscosity
|
||||||
nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2));
|
nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2));
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
# include "kOmegaWallViscosityI.H"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -166,11 +166,24 @@ realizableKE::realizableKE
|
|||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
|
|
||||||
nut_(rCmu(fvc::grad(U_))*sqr(k_)/(epsilon_ + epsilonSmall_))
|
nut_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"nut",
|
||||||
|
runTime_.timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bound(k_, k0_);
|
bound(k_, k0_);
|
||||||
bound(epsilon_, epsilon0_);
|
bound(epsilon_, epsilon0_);
|
||||||
# include "wallViscosityI.H"
|
|
||||||
|
nut_ == rCmu(fvc::grad(U_))*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
|
|
||||||
printCoeffs();
|
printCoeffs();
|
||||||
}
|
}
|
||||||
@ -266,9 +279,10 @@ void realizableKE::correct()
|
|||||||
volScalarField eta = magS*k_/epsilon_;
|
volScalarField eta = magS*k_/epsilon_;
|
||||||
volScalarField C1 = max(eta/(scalar(5) + eta), scalar(0.43));
|
volScalarField C1 = max(eta/(scalar(5) + eta), scalar(0.43));
|
||||||
|
|
||||||
volScalarField G = nut_*S2;
|
volScalarField G("G", nut_*S2);
|
||||||
|
|
||||||
# include "wallFunctionsI.H"
|
// Update espsilon and G at the wall
|
||||||
|
epsilon_.boundaryField().updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
// Dissipation equation
|
// Dissipation equation
|
||||||
@ -289,7 +303,7 @@ void realizableKE::correct()
|
|||||||
|
|
||||||
epsEqn().relax();
|
epsEqn().relax();
|
||||||
|
|
||||||
# include "wallDissipationI.H"
|
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||||
|
|
||||||
solve(epsEqn);
|
solve(epsEqn);
|
||||||
bound(epsilon_, epsilon0_);
|
bound(epsilon_, epsilon0_);
|
||||||
@ -313,9 +327,7 @@ void realizableKE::correct()
|
|||||||
|
|
||||||
// Re-calculate viscosity
|
// Re-calculate viscosity
|
||||||
nut_ = rCmu(gradU, S2, magS)*sqr(k_)/epsilon_;
|
nut_ = rCmu(gradU, S2, magS)*sqr(k_)/epsilon_;
|
||||||
|
nut_.correctBoundaryConditions();
|
||||||
# include "wallViscosityI.H"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user