updating to use wall function framework - had been missed

This commit is contained in:
andy
2009-07-10 17:27:35 +01:00
parent 40877432e8
commit 2158923839
5 changed files with 136 additions and 37 deletions

View File

@ -26,7 +26,8 @@ License
#include "LaunderSharmaKE.H"
#include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -141,10 +142,10 @@ LaunderSharmaKE::LaunderSharmaKE
"k",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_
autoCreateK("k", mesh_)
),
epsilon_
@ -154,10 +155,10 @@ LaunderSharmaKE::LaunderSharmaKE
"epsilon",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_
autoCreateEpsilon("epsilon", mesh_)
),
mut_
@ -170,9 +171,28 @@ LaunderSharmaKE::LaunderSharmaKE
IOobject::NO_READ,
IOobject::NO_WRITE
),
Cmu_*fMu()*rho_*sqr(k_)/(epsilon_ + epsilonSmall_)
autoCreateMut("mut", mesh_)
),
alphat_
(
IOobject
(
"alphat",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateAlphat("alphat", mesh_)
)
{
mut_ = rho_*Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_);
mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
printCoeffs();
}
@ -256,6 +276,12 @@ void LaunderSharmaKE::correct()
{
// Re-calculate viscosity
mut_ = rho_*Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_);
mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
return;
}
@ -275,9 +301,11 @@ void LaunderSharmaKE::correct()
}
tmp<volTensorField> tgradU = fvc::grad(U_);
volScalarField G = mut_*(tgradU() && dev(twoSymm(tgradU())));
volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear();
// Update espsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Dissipation equation
@ -294,6 +322,9 @@ void LaunderSharmaKE::correct()
);
epsEqn().relax();
epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
bound(epsilon_, epsilon0_);
@ -317,7 +348,12 @@ void LaunderSharmaKE::correct()
// Re-calculate viscosity
mut_ = Cmu_*fMu()*rho_*sqr(k_)/epsilon_;
mut_ = Cmu_*fMu()*rho_*sqr(k_)/(epsilon_ + epsilonSmall_);
mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
}

View File

@ -64,7 +64,7 @@ namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class LaunderSharmaKE Declaration
Class LaunderSharmaKE Declaration
\*---------------------------------------------------------------------------*/
class LaunderSharmaKE
@ -73,17 +73,23 @@ class LaunderSharmaKE
{
// Private data
dimensionedScalar Cmu_;
dimensionedScalar C1_;
dimensionedScalar C2_;
dimensionedScalar C3_;
dimensionedScalar alphak_;
dimensionedScalar alphaEps_;
dimensionedScalar alphah_;
// Model coefficients
volScalarField k_;
volScalarField epsilon_;
volScalarField mut_;
dimensionedScalar Cmu_;
dimensionedScalar C1_;
dimensionedScalar C2_;
dimensionedScalar C3_;
dimensionedScalar alphak_;
dimensionedScalar alphaEps_;
dimensionedScalar alphah_;
// Fields
volScalarField k_;
volScalarField epsilon_;
volScalarField mut_;
volScalarField alphat_;
// Private member functions
@ -145,7 +151,7 @@ public:
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", alphah_*mut_ + alpha())
new volScalarField("alphaEff", alphah_*alphat_ + alpha())
);
}

View File

@ -26,7 +26,8 @@ License
#include "SpalartAllmaras.H"
#include "addToRunTimeSelectionTable.H"
#include "wallDist.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -215,8 +216,24 @@ SpalartAllmaras::SpalartAllmaras
mesh_
),
alphat_
(
IOobject
(
"alphat",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateAlphat("alphat", mesh_)
),
d_(mesh_)
{
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
printCoeffs();
}
@ -305,6 +322,12 @@ void SpalartAllmaras::correct()
{
// Re-calculate viscosity
mut_ = rho_*nuTilda_*fv1(chi());
mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
return;
}
@ -338,8 +361,13 @@ void SpalartAllmaras::correct()
bound(nuTilda_, dimensionedScalar("0", nuTilda_.dimensions(), 0.0));
nuTilda_.correctBoundaryConditions();
// Re-calculate viscosity
mut_.internalField() = fv1*nuTilda_.internalField()*rho_.internalField();
mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
}

View File

@ -81,7 +81,7 @@ namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class SpalartAllmaras Declaration
Class SpalartAllmaras Declaration
\*---------------------------------------------------------------------------*/
class SpalartAllmaras
@ -90,20 +90,27 @@ class SpalartAllmaras
{
// Private data
dimensionedScalar alphaNut_;
dimensionedScalar alphah_;
// Model coefficients
dimensionedScalar alphaNut_;
dimensionedScalar alphah_;
dimensionedScalar Cb1_;
dimensionedScalar Cb2_;
dimensionedScalar Cw1_;
dimensionedScalar Cw2_;
dimensionedScalar Cw3_;
dimensionedScalar Cv1_;
dimensionedScalar Cv2_;
dimensionedScalar Cb1_;
dimensionedScalar Cb2_;
dimensionedScalar Cw1_;
dimensionedScalar Cw2_;
dimensionedScalar Cw3_;
dimensionedScalar Cv1_;
dimensionedScalar Cv2_;
volScalarField nuTilda_;
volScalarField mut_;
// Fields
volScalarField nuTilda_;
volScalarField mut_;
volScalarField alphat_;
//- Wall distance
wallDist d_;
@ -173,7 +180,7 @@ public:
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", alphah_*mut_ + alpha())
new volScalarField("alphaEff", alphah_*alphat_ + alpha())
);
}

View File

@ -27,6 +27,8 @@ License
#include "LamBremhorstKE.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -112,7 +114,7 @@ LamBremhorstKE::LamBremhorstKE
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
autoCreateEpsilon("epsilon", mesh_)
),
y_(mesh_),
@ -125,8 +127,22 @@ LamBremhorstKE::LamBremhorstKE
*(scalar(1) + 20.5/(Rt_ + SMALL))
),
nut_(Cmu_*fMu_*sqr(k_)/(epsilon_ + epsilonSmall_))
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateNut("nut", mesh_)
)
{
nut_ = Cmu_*fMu_*sqr(k_)/(epsilon_ + epsilonSmall_);
nut_.correctBoundaryConditions();
printCoeffs();
}
@ -216,7 +232,7 @@ void LamBremhorstKE::correct()
y_.correct();
}
volScalarField G = nut_*2*magSqr(symm(fvc::grad(U_)));
volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_))));
// Calculate parameters and coefficients for low-Reynolds number model
@ -229,6 +245,8 @@ void LamBremhorstKE::correct()
volScalarField f1 = scalar(1) + pow(0.05/(fMu_ + SMALL), 3);
volScalarField f2 = scalar(1) - exp(-sqr(Rt_));
// Update espsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Dissipation equation
@ -243,6 +261,9 @@ void LamBremhorstKE::correct()
);
epsEqn().relax();
epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
bound(epsilon_, epsilon0_);
@ -265,6 +286,7 @@ void LamBremhorstKE::correct()
// Re-calculate viscosity
nut_ = Cmu_*fMu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
}