settlingFoam: improved handling of the turbulence and wall-functions

This commit is contained in:
Henry
2012-02-17 12:46:03 +00:00
parent f71567a71d
commit d0795f9625
25 changed files with 103 additions and 106 deletions

View File

@ -41,12 +41,6 @@
{ {
label faceCelli = currPatch.faceCells()[facei]; label faceCelli = currPatch.faceCells()[facei];
scalar yPlus =
Cmu25*y[patchi][facei]
*::sqrt(k[faceCelli])
/nub_;
// For corner cells (with two boundary or more faces), // For corner cells (with two boundary or more faces),
// epsilon and G in the near-wall cell are calculated // epsilon and G in the near-wall cell are calculated
// as an average // as an average
@ -57,13 +51,10 @@
Cmu75*::pow(k[faceCelli], 1.5) Cmu75*::pow(k[faceCelli], 1.5)
/(kappa_*y[patchi][facei]); /(kappa_*y[patchi][facei]);
if (yPlus > 11.6) G[faceCelli] +=
{ (nutbw[facei] + nub_)*magFaceGradU[facei]
G[faceCelli] += *Cmu25*::sqrt(k[faceCelli])
(nutbw[facei] + nub_)*magFaceGradU[facei] /(kappa_*y[patchi][facei]);
*Cmu25*::sqrt(k[faceCelli])
/(kappa_*y[patchi][facei]);
}
} }
} }
} }
@ -83,6 +74,7 @@
epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli]; epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
G[faceCelli] /= cellBoundaryFaceCount[faceCelli]; G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
cellBoundaryFaceCount[faceCelli] = 1;
} }
} }
} }

View File

@ -20,16 +20,11 @@
// calculate yPlus // calculate yPlus
scalar yPlus = scalar yPlus =
Cmu25*y[patchi][facei] Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])/nub_;
*::sqrt(k[faceCelli])
/nub_;
if (yPlus > 11.6) if (yPlus > 11.6)
{ {
nutw[facei] = nutw[facei] = nub_*(yPlus*kappa_/::log(E_*yPlus) -1);
yPlus*nub_*kappa_
/::log(E_*yPlus)
- nub_;
} }
else else
{ {

View File

@ -41,12 +41,6 @@
{ {
label faceCelli = currPatch.faceCells()[facei]; label faceCelli = currPatch.faceCells()[facei];
scalar yPlus =
Cmu25*y[patchi][facei]
*::sqrt(k[faceCelli])
/nu2_;
// For corner cells (with two boundary or more faces), // For corner cells (with two boundary or more faces),
// epsilon and G in the near-wall cell are calculated // epsilon and G in the near-wall cell are calculated
// as an average // as an average
@ -57,13 +51,10 @@
Cmu75*::pow(k[faceCelli], 1.5) Cmu75*::pow(k[faceCelli], 1.5)
/(kappa_*y[patchi][facei]); /(kappa_*y[patchi][facei]);
if (yPlus > 11.6) G[faceCelli] +=
{ (nut2w[facei] + nu2_)*magFaceGradU[facei]
G[faceCelli] += *Cmu25*::sqrt(k[faceCelli])
(nut2w[facei] + nu2_)*magFaceGradU[facei] /(kappa_*y[patchi][facei]);
*Cmu25*::sqrt(k[faceCelli])
/(kappa_*y[patchi][facei]);
}
} }
} }
} }
@ -83,6 +74,7 @@
epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli]; epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
G[faceCelli] /= cellBoundaryFaceCount[faceCelli]; G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
cellBoundaryFaceCount[faceCelli] = 1;
} }
} }
} }

View File

@ -20,16 +20,11 @@
// calculate yPlus // calculate yPlus
scalar yPlus = scalar yPlus =
Cmu25*y[patchi][facei] Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])/nu2_;
*::sqrt(k[faceCelli])
/nu2_;
if (yPlus > 11.6) if (yPlus > 11.6)
{ {
nutw[facei] = nutw[facei] = nu2_*(yPlus*kappa_/::log(E_*yPlus) - 1);
yPlus*nu2_*kappa_
/::log(E_*yPlus)
- nu2_;
} }
else else
{ {

View File

@ -9,7 +9,9 @@
(Alpha/(scalar(1.001) - Alpha))*(sqr(rhoc)/rho)*Vdj*Vdj, (Alpha/(scalar(1.001) - Alpha))*(sqr(rhoc)/rho)*Vdj*Vdj,
"div(phiVdj,Vdj)" "div(phiVdj,Vdj)"
) )
- fvm::laplacian(mu, U, "laplacian(muEff,U)") - fvm::laplacian(muEff, U, "laplacian(muEff,U)")
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muEff*dev2(T(fvc::grad(U))))
); );
UEqn.relax(); UEqn.relax();

View File

@ -10,13 +10,16 @@
phi + rhoc*(mesh.Sf() & fvc::interpolate(Vdj)) phi + rhoc*(mesh.Sf() & fvc::interpolate(Vdj))
); );
solve fvScalarMatrix AlphaEqn
( (
fvm::ddt(rho, Alpha) fvm::ddt(rho, Alpha)
+ fvm::div(phiAlpha, Alpha) + fvm::div(phiAlpha, Alpha)
- fvm::laplacian(mut, Alpha) - fvm::laplacian(mut, Alpha)
); );
AlphaEqn.relax();
AlphaEqn.solve();
Info<< "Solid phase fraction = " Info<< "Solid phase fraction = "
<< Alpha.weightedAverage(mesh.V()).value() << Alpha.weightedAverage(mesh.V()).value()
<< " Min(Alpha) = " << min(Alpha).value() << " Min(Alpha) = " << min(Alpha).value()

View File

@ -34,4 +34,6 @@
) )
+ mul; + mul;
} }
mul = min(mul, muMax);
} }

View File

@ -61,6 +61,7 @@
dimensionedScalar rhod(transportProperties.lookup("rhod")); dimensionedScalar rhod(transportProperties.lookup("rhod"));
dimensionedScalar muc(transportProperties.lookup("muc")); dimensionedScalar muc(transportProperties.lookup("muc"));
dimensionedScalar muMax(transportProperties.lookup("muMax"));
dimensionedScalar plasticViscosityCoeff dimensionedScalar plasticViscosityCoeff
( (
@ -328,12 +329,12 @@
); );
Info<< "Calculating field mu\n" << endl; Info<< "Calculating field muEff\n" << endl;
volScalarField mu volScalarField muEff
( (
IOobject IOobject
( (
"mu", "muEff",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
@ -345,7 +346,7 @@
Info<< "Calculating field (g.h)f\n" << endl; Info<< "Calculating field (g.h)f\n" << endl;
volScalarField gh("gh", g & mesh.C()); volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf(surfaceScalarField("gh", g & mesh.Cf())); surfaceScalarField ghf("gh", g & mesh.Cf());
volScalarField p volScalarField p
( (

View File

@ -5,7 +5,9 @@ if (turbulence)
y.correct(); y.correct();
} }
dimensionedScalar k0("k0", k.dimensions(), 0);
dimensionedScalar kMin("kMin", k.dimensions(), SMALL); dimensionedScalar kMin("kMin", k.dimensions(), SMALL);
dimensionedScalar epsilon0("epsilon0", epsilon.dimensions(), 0);
dimensionedScalar epsilonMin("epsilonMin", epsilon.dimensions(), SMALL); dimensionedScalar epsilonMin("epsilonMin", epsilon.dimensions(), SMALL);
volScalarField divU(fvc::div(phi/fvc::interpolate(rho))); volScalarField divU(fvc::div(phi/fvc::interpolate(rho)));
@ -28,13 +30,13 @@ if (turbulence)
+ fvm::div(phi, epsilon) + fvm::div(phi, epsilon)
- fvm::laplacian - fvm::laplacian
( (
mut/sigmaEps + mul, epsilon, mut/sigmaEps + muc, epsilon,
"laplacian(DepsilonEff,epsilon)" "laplacian(DepsilonEff,epsilon)"
) )
== ==
C1*G*epsilon/k C1*G*epsilon/(k + kMin)
- fvm::SuSp(C1*(1.0 - C3)*Gcoef + (2.0/3.0*C1)*rho*divU, epsilon) - fvm::SuSp(C1*(1.0 - C3)*Gcoef + (2.0/3.0*C1)*rho*divU, epsilon)
- fvm::Sp(C2*rho*epsilon/k, epsilon) - fvm::Sp(C2*rho*epsilon/(k + kMin), epsilon)
); );
#include "wallDissipation.H" #include "wallDissipation.H"
@ -42,7 +44,7 @@ if (turbulence)
epsEqn.relax(); epsEqn.relax();
epsEqn.solve(); epsEqn.solve();
bound(epsilon, epsilonMin); bound(epsilon, epsilon0);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -52,19 +54,19 @@ if (turbulence)
+ fvm::div(phi, k) + fvm::div(phi, k)
- fvm::laplacian - fvm::laplacian
( (
mut/sigmak + mul, k, mut/sigmak + muc, k,
"laplacian(DkEff,k)" "laplacian(DkEff,k)"
) )
== ==
G G
- fvm::SuSp(Gcoef + 2.0/3.0*rho*divU, k) - fvm::SuSp(Gcoef + 2.0/3.0*rho*divU, k)
- fvm::Sp(rho*epsilon/k, k) - fvm::Sp(rho*epsilon/(k + kMin), k)
); );
kEqn.relax(); kEqn.relax();
kEqn.solve(); kEqn.solve();
bound(k, kMin); bound(k, k0);
//- Re-calculate viscosity //- Re-calculate viscosity
@ -73,4 +75,4 @@ if (turbulence)
#include "wallViscosity.H" #include "wallViscosity.H"
} }
mu = mut + mul; muEff = mut + mul;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,11 +57,15 @@ int main(int argc, char *argv[])
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
while (runTime.loop()) while (runTime.run())
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; #include "readTimeControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "rhoEqn.H" #include "rhoEqn.H"

View File

@ -1,9 +1,10 @@
{ {
labelList cellBoundaryFaceCount(epsilon.size(), 0); labelList cellBoundaryFaceCount(epsilon.size(), 0);
scalar Cmu25 = ::pow(Cmu.value(), 0.25); const scalar Cmu25 = ::pow(Cmu.value(), 0.25);
scalar Cmu75 = ::pow(Cmu.value(), 0.75); const scalar Cmu75 = ::pow(Cmu.value(), 0.75);
scalar kappa_ = kappa.value(); const scalar kappa_ = kappa.value();
const scalar muc_ = muc.value();
const fvPatchList& patches = mesh.boundary(); const fvPatchList& patches = mesh.boundary();
@ -32,9 +33,6 @@
if (isA<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
const scalarField& rhow = rho.boundaryField()[patchi];
const scalarField muw(mul.boundaryField()[patchi]);
const scalarField& mutw = mut.boundaryField()[patchi]; const scalarField& mutw = mut.boundaryField()[patchi];
scalarField magFaceGradU scalarField magFaceGradU
@ -46,10 +44,6 @@
{ {
label faceCelli = curPatch.faceCells()[facei]; label faceCelli = curPatch.faceCells()[facei];
scalar yPlus =
Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])
/(muw[facei]/rhow[facei]);
// For corner cells (with two boundary or more faces), // For corner cells (with two boundary or more faces),
// epsilon and G in the near-wall cell are calculated // epsilon and G in the near-wall cell are calculated
// as an average // as an average
@ -57,16 +51,14 @@
cellBoundaryFaceCount[faceCelli]++; cellBoundaryFaceCount[faceCelli]++;
epsilon[faceCelli] += epsilon[faceCelli] +=
Cmu75*rho[faceCelli]*::pow(k[faceCelli], 1.5) Cmu75*::pow(k[faceCelli], 1.5)
/(kappa_*y[patchi][facei]); /(kappa_*y[patchi][facei]);
if (yPlus > 11.6) G[faceCelli] +=
{ (mutw[facei] + muc_)
G[faceCelli] += *magFaceGradU[facei]
mutw[facei]*magFaceGradU[facei] *Cmu25*::sqrt(k[faceCelli])
*Cmu25*::sqrt(k[faceCelli]) /(kappa_*y[patchi][facei]);
/(kappa_*y[patchi][facei]);
}
} }
} }
} }
@ -86,6 +78,7 @@
epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli]; epsilon[faceCelli] /= cellBoundaryFaceCount[faceCelli];
G[faceCelli] /= cellBoundaryFaceCount[faceCelli]; G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
cellBoundaryFaceCount[faceCelli] = 1;
} }
} }
} }

View File

@ -1,7 +1,9 @@
{ {
scalar Cmu25 = ::pow(Cmu.value(), 0.25); const scalar Cmu25 = ::pow(Cmu.value(), 0.25);
scalar kappa_ = kappa.value(); const scalar kappa_ = kappa.value();
scalar E_ = E.value(); const scalar E_ = E.value();
const scalar muc_ = muc.value();
const scalar nuc_ = muc_/rhoc.value();
const fvPatchList& patches = mesh.boundary(); const fvPatchList& patches = mesh.boundary();
@ -11,9 +13,6 @@
if (isA<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
const scalarField& rhow = rho.boundaryField()[patchi];
const scalarField muw(mul.boundaryField()[patchi]);
scalarField& mutw = mut.boundaryField()[patchi]; scalarField& mutw = mut.boundaryField()[patchi];
forAll(curPatch, facei) forAll(curPatch, facei)
@ -22,13 +21,12 @@
scalar yPlus = scalar yPlus =
Cmu25*y[patchi][facei]*::sqrt(k[faceCelli]) Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])
/(muw[facei]/rhow[facei]); /nuc_;
if (yPlus > 11.6) if (yPlus > 11.6)
{ {
mutw[facei] = mutw[facei] =
muw[facei] muc_*(yPlus*kappa_/::log(E_*yPlus) - 1);
*(yPlus*kappa_/::log(E_*yPlus) - 1);
} }
else else
{ {

View File

@ -23,12 +23,13 @@ boundaryField
inlet inlet
{ {
type fixedValue; type fixedValue;
value uniform (0.0191 0 0); value $internalField;
} }
outlet outlet
{ {
type zeroGradient; type pressureInletOutletVelocity;
value uniform (0 0 0);
} }
bottomWall bottomWall

View File

@ -23,12 +23,13 @@ boundaryField
inlet inlet
{ {
type fixedValue; type fixedValue;
value uniform 0.001; value $internalField;
} }
outlet outlet
{ {
type zeroGradient; type inletOutlet;
inletValue $internalField;
} }
bottomWall bottomWall

View File

@ -23,12 +23,13 @@ boundaryField
inlet inlet
{ {
type fixedValue; type fixedValue;
value uniform 1.50919e-06; value $internalField;
} }
outlet outlet
{ {
type zeroGradient; type inletOutlet;
inletValue $internalField;
} }
bottomWall bottomWall

View File

@ -23,12 +23,13 @@ boundaryField
inlet inlet
{ {
type fixedValue; type fixedValue;
value uniform 0.00015; value $internalField;
} }
outlet outlet
{ {
type zeroGradient; type inletOutlet;
inletValue $internalField;
} }
bottomWall bottomWall

View File

@ -22,7 +22,8 @@ boundaryField
{ {
inlet inlet
{ {
type zeroGradient; type buoyantPressure;
value uniform 0;
} }
outlet outlet
@ -39,7 +40,8 @@ boundaryField
endWall endWall
{ {
type zeroGradient; type buoyantPressure;
value uniform 0;
} }
top top

View File

@ -63,7 +63,7 @@ boundary
} }
bottomWall bottomWall
{ {
type patch; type wall;
faces faces
( (
(0 1 7 6) (0 1 7 6)

View File

@ -31,7 +31,7 @@ FoamFile
} }
bottomWall bottomWall
{ {
type patch; type wall;
nFaces 200; nFaces 200;
startFace 15804; startFace 15804;
} }

View File

@ -29,6 +29,8 @@ yieldStressExponent yieldStressExponent [ 0 0 0 0 0 0 0 ] 1050.8;
yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0; yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0;
muMax muMax [ 1 -1 -1 0 0 0 0 ] 10.0;
rhoc rhoc [ 1 -3 0 0 0 0 0 ] 996; rhoc rhoc [ 1 -3 0 0 0 0 0 ] 996;
rhod rhod [ 1 -3 0 0 0 0 0 ] 1996; rhod rhod [ 1 -3 0 0 0 0 0 ] 1996;

View File

@ -27,7 +27,7 @@ endTime 6400;
deltaT 0.1; deltaT 0.1;
writeControl runTime; writeControl adjustableRunTime;
writeInterval 20; writeInterval 20;
@ -45,4 +45,10 @@ timePrecision 6;
runTimeModifiable yes; runTimeModifiable yes;
adjustTimeStep on;
maxCo 0.5;
maxDeltaT 1;
// ************************************************************************* // // ************************************************************************* //

View File

@ -28,9 +28,9 @@ gradSchemes
divSchemes divSchemes
{ {
default none; default none;
div(phi,U) Gauss limitedLinearV 1; div(phi,U) Gauss linearUpwind grad(U);
div(phi,k) Gauss limitedLinear 1; div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss limitedLinear 1; div(phi,epsilon) Gauss upwind;
div(phiAlpha,Alpha) Gauss limitedLinear01 1; div(phiAlpha,Alpha) Gauss limitedLinear01 1;
div(phiVdj,Vdj) Gauss linear; div(phiVdj,Vdj) Gauss linear;
} }

View File

@ -36,14 +36,14 @@ solvers
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;
tolerance 1e-07; tolerance 1e-8;
relTol 0.1; relTol 0.1;
} }
"(U|Alpha|k|epsilon)Final" "(U|Alpha|k|epsilon)Final"
{ {
$k; $k;
tolerance 1e-07; tolerance 1e-8;
relTol 0; relTol 0;
} }
@ -51,21 +51,21 @@ solvers
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
tolerance 1e-07; tolerance 1e-8;
relTol 0.1; relTol 0.1;
} }
rhoFinal rhoFinal
{ {
$rho; $rho;
tolerance 1e-07; tolerance 1e-8;
relTol 0; relTol 0;
} }
} }
PIMPLE PIMPLE
{ {
nCorrectors 2; nCorrectors 3;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }
@ -76,6 +76,7 @@ relaxationFactors
} }
equations equations
{ {
"Alpha.*" 1;
"U.*" 1; "U.*" 1;
"k.*" 1; "k.*" 1;
"epsilon.*" 1; "epsilon.*" 1;

View File

@ -29,6 +29,8 @@ yieldStressExponent yieldStressExponent [ 0 0 0 0 0 0 0 ] 95.25;
yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0; yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0;
muMax muMax [ 1 -1 -1 0 0 0 0 ] 10.0;
rhoc rhoc [ 1 -3 0 0 0 0 0 ] 1000; rhoc rhoc [ 1 -3 0 0 0 0 0 ] 1000;
rhod rhod [ 1 -3 0 0 0 0 0 ] 1042; rhod rhod [ 1 -3 0 0 0 0 0 ] 1042;

View File

@ -76,6 +76,7 @@ relaxationFactors
} }
equations equations
{ {
"Alpha.*" 1;
"U.*" 1; "U.*" 1;
"k.*" 1; "k.*" 1;
"epsilon.*" 1; "epsilon.*" 1;