2010-05-12 13:27:55 +00:00
|
|
|
/*---------------------------------------------------------------------------*\
|
|
|
|
========= |
|
2013-12-11 16:09:41 +00:00
|
|
|
\\ / F ield | foam-extend: Open Source CFD
|
2015-05-17 13:32:07 +00:00
|
|
|
\\ / O peration | Version: 3.2
|
|
|
|
\\ / A nd | Web: http://www.foam-extend.org
|
|
|
|
\\/ M anipulation | For copyright notice see file Copyright
|
2010-05-12 13:27:55 +00:00
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
License
|
2013-12-11 16:09:41 +00:00
|
|
|
This file is part of foam-extend.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2013-12-11 16:09:41 +00:00
|
|
|
foam-extend is free software: you can redistribute it and/or modify it
|
2010-05-12 13:27:55 +00:00
|
|
|
under the terms of the GNU General Public License as published by the
|
2013-12-11 16:09:41 +00:00
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
2010-05-12 13:27:55 +00:00
|
|
|
option) any later version.
|
|
|
|
|
2013-12-11 16:09:41 +00:00
|
|
|
foam-extend is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2013-12-11 16:09:41 +00:00
|
|
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "PDRkEpsilon.H"
|
|
|
|
#include "PDRDragModel.H"
|
|
|
|
#include "addToRunTimeSelectionTable.H"
|
|
|
|
|
2010-08-26 14:22:03 +00:00
|
|
|
#include "backwardsCompatibilityWallFunctions.H"
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
namespace Foam
|
|
|
|
{
|
|
|
|
namespace compressible
|
|
|
|
{
|
|
|
|
namespace RASModels
|
|
|
|
{
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
defineTypeNameAndDebug(PDRkEpsilon, 0);
|
|
|
|
addToRunTimeSelectionTable(RASModel, PDRkEpsilon, dictionary);
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
PDRkEpsilon::PDRkEpsilon
|
|
|
|
(
|
|
|
|
const volScalarField& rho,
|
|
|
|
const volVectorField& U,
|
|
|
|
const surfaceScalarField& phi,
|
2010-08-26 14:22:03 +00:00
|
|
|
const basicThermo& thermophysicalModel
|
2010-05-12 13:27:55 +00:00
|
|
|
)
|
|
|
|
:
|
|
|
|
RASModel(typeName, rho, U, phi, thermophysicalModel),
|
|
|
|
|
|
|
|
Cmu_
|
|
|
|
(
|
|
|
|
dimensioned<scalar>::lookupOrAddToDict
|
|
|
|
(
|
|
|
|
"Cmu",
|
|
|
|
coeffDict_,
|
|
|
|
0.09
|
|
|
|
)
|
|
|
|
),
|
|
|
|
C1_
|
|
|
|
(
|
|
|
|
dimensioned<scalar>::lookupOrAddToDict
|
|
|
|
(
|
|
|
|
"C1",
|
|
|
|
coeffDict_,
|
|
|
|
1.44
|
|
|
|
)
|
|
|
|
),
|
|
|
|
C2_
|
|
|
|
(
|
|
|
|
dimensioned<scalar>::lookupOrAddToDict
|
|
|
|
(
|
|
|
|
"C2",
|
|
|
|
coeffDict_,
|
|
|
|
1.92
|
|
|
|
)
|
|
|
|
),
|
2010-08-26 14:22:03 +00:00
|
|
|
sigmak_
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
|
|
|
dimensioned<scalar>::lookupOrAddToDict
|
|
|
|
(
|
2010-08-26 14:22:03 +00:00
|
|
|
"sigmak",
|
2010-05-12 13:27:55 +00:00
|
|
|
coeffDict_,
|
|
|
|
1.0
|
|
|
|
)
|
|
|
|
),
|
2010-08-26 14:22:03 +00:00
|
|
|
sigmaEps_
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
|
|
|
dimensioned<scalar>::lookupOrAddToDict
|
|
|
|
(
|
2010-08-26 14:22:03 +00:00
|
|
|
"sigmaEps",
|
2010-05-12 13:27:55 +00:00
|
|
|
coeffDict_,
|
2010-08-26 14:22:03 +00:00
|
|
|
1.3
|
2010-05-12 13:27:55 +00:00
|
|
|
)
|
|
|
|
),
|
2010-08-26 14:22:03 +00:00
|
|
|
Prt_
|
2010-05-12 13:27:55 +00:00
|
|
|
(
|
|
|
|
dimensioned<scalar>::lookupOrAddToDict
|
|
|
|
(
|
2010-08-26 14:22:03 +00:00
|
|
|
"Prt",
|
2010-05-12 13:27:55 +00:00
|
|
|
coeffDict_,
|
|
|
|
1.0
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
k_
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"k",
|
|
|
|
runTime_.timeName(),
|
|
|
|
mesh_,
|
|
|
|
IOobject::MUST_READ,
|
|
|
|
IOobject::AUTO_WRITE
|
|
|
|
),
|
|
|
|
mesh_
|
|
|
|
),
|
|
|
|
|
|
|
|
epsilon_
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"epsilon",
|
|
|
|
runTime_.timeName(),
|
|
|
|
mesh_,
|
|
|
|
IOobject::MUST_READ,
|
|
|
|
IOobject::AUTO_WRITE
|
|
|
|
),
|
|
|
|
mesh_
|
|
|
|
),
|
|
|
|
|
|
|
|
mut_
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"mut",
|
|
|
|
runTime_.timeName(),
|
|
|
|
mesh_,
|
|
|
|
IOobject::NO_READ,
|
|
|
|
IOobject::NO_WRITE
|
|
|
|
),
|
|
|
|
Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_)
|
2010-08-26 14:22:03 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
alphat_
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"alphat",
|
|
|
|
runTime_.timeName(),
|
|
|
|
mesh_,
|
|
|
|
IOobject::NO_READ,
|
|
|
|
IOobject::AUTO_WRITE
|
|
|
|
),
|
|
|
|
autoCreateAlphat("alphat", mesh_)
|
2010-05-12 13:27:55 +00:00
|
|
|
)
|
|
|
|
{
|
2010-08-26 14:22:03 +00:00
|
|
|
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
|
|
|
mut_.correctBoundaryConditions();
|
|
|
|
|
|
|
|
alphat_ = mut_/Prt_;
|
|
|
|
alphat_.correctBoundaryConditions();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
printCoeffs();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
tmp<volSymmTensorField> PDRkEpsilon::R() const
|
|
|
|
{
|
|
|
|
return tmp<volSymmTensorField>
|
|
|
|
(
|
|
|
|
new volSymmTensorField
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"R",
|
|
|
|
runTime_.timeName(),
|
|
|
|
mesh_,
|
|
|
|
IOobject::NO_READ,
|
|
|
|
IOobject::NO_WRITE
|
|
|
|
),
|
|
|
|
((2.0/3.0)*I)*k_ - (mut_/rho_)*dev(twoSymm(fvc::grad(U_))),
|
|
|
|
k_.boundaryField().types()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tmp<volSymmTensorField> PDRkEpsilon::devRhoReff() const
|
|
|
|
{
|
|
|
|
return tmp<volSymmTensorField>
|
|
|
|
(
|
|
|
|
new volSymmTensorField
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"devRhoReff",
|
|
|
|
runTime_.timeName(),
|
|
|
|
mesh_,
|
|
|
|
IOobject::NO_READ,
|
|
|
|
IOobject::NO_WRITE
|
|
|
|
),
|
|
|
|
-muEff()*dev(twoSymm(fvc::grad(U_)))
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-06 13:59:41 +00:00
|
|
|
tmp<fvVectorMatrix> PDRkEpsilon::divDevRhoReff() const
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
|
|
|
return
|
|
|
|
(
|
2016-06-06 13:59:41 +00:00
|
|
|
- fvm::laplacian(muEff(), U_)
|
|
|
|
- fvc::div(muEff()*dev2(T(fvc::grad(U_))))
|
2010-05-12 13:27:55 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PDRkEpsilon::read()
|
|
|
|
{
|
|
|
|
if (RASModel::read())
|
|
|
|
{
|
|
|
|
Cmu_.readIfPresent(coeffDict_);
|
|
|
|
C1_.readIfPresent(coeffDict_);
|
|
|
|
C2_.readIfPresent(coeffDict_);
|
2010-08-26 14:22:03 +00:00
|
|
|
sigmak_.readIfPresent(coeffDict());
|
|
|
|
sigmaEps_.readIfPresent(coeffDict());
|
|
|
|
Prt_.readIfPresent(coeffDict());
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PDRkEpsilon::correct()
|
|
|
|
{
|
|
|
|
if (!turbulence_)
|
|
|
|
{
|
|
|
|
// Re-calculate viscosity
|
|
|
|
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
2010-08-26 14:22:03 +00:00
|
|
|
mut_.correctBoundaryConditions();
|
|
|
|
|
|
|
|
// Re-calculate thermal diffusivity
|
|
|
|
alphat_ = mut_/Prt_;
|
|
|
|
alphat_.correctBoundaryConditions();
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
RASModel::correct();
|
|
|
|
|
|
|
|
volScalarField divU = fvc::div(phi_/fvc::interpolate(rho_));
|
|
|
|
|
|
|
|
if (mesh_.moving())
|
|
|
|
{
|
|
|
|
divU += fvc::div(mesh_.phi());
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp<volTensorField> tgradU = fvc::grad(U_);
|
|
|
|
volScalarField G = 2*mut_*(tgradU() && dev(symm(tgradU())));
|
|
|
|
tgradU.clear();
|
|
|
|
|
2010-08-26 14:22:03 +00:00
|
|
|
// Update espsilon and G at the wall
|
|
|
|
epsilon_.boundaryField().updateCoeffs();
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
// Add the blockage generation term so that it is included consistently
|
|
|
|
// in both the k and epsilon equations
|
|
|
|
const volScalarField& betav = U_.db().lookupObject<volScalarField>("betav");
|
|
|
|
|
|
|
|
const PDRDragModel& drag =
|
|
|
|
U_.db().lookupObject<PDRDragModel>("PDRDragModel");
|
|
|
|
|
|
|
|
volScalarField GR = drag.Gk();
|
|
|
|
|
|
|
|
// Dissipation equation
|
|
|
|
tmp<fvScalarMatrix> epsEqn
|
|
|
|
(
|
|
|
|
betav*fvm::ddt(rho_, epsilon_)
|
|
|
|
+ fvm::div(phi_, epsilon_)
|
|
|
|
- fvm::laplacian(DepsilonEff(), epsilon_)
|
|
|
|
==
|
|
|
|
C1_*(betav*G + GR)*epsilon_/k_
|
|
|
|
- fvm::SuSp(((2.0/3.0)*C1_)*betav*rho_*divU, epsilon_)
|
|
|
|
- fvm::Sp(C2_*betav*rho_*epsilon_/k_, epsilon_)
|
|
|
|
);
|
|
|
|
|
|
|
|
epsEqn().relax();
|
|
|
|
|
2012-04-25 09:22:35 +00:00
|
|
|
// No longer needed: matrix completes at the point of solution
|
|
|
|
// HJ, 17/Apr/2012
|
|
|
|
// epsEqn().completeAssembly();
|
2010-08-26 14:22:03 +00:00
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
solve(epsEqn);
|
|
|
|
bound(epsilon_, epsilon0_);
|
|
|
|
|
|
|
|
|
|
|
|
// Turbulent kinetic energy equation
|
|
|
|
|
|
|
|
tmp<fvScalarMatrix> kEqn
|
|
|
|
(
|
|
|
|
betav*fvm::ddt(rho_, k_)
|
|
|
|
+ fvm::div(phi_, k_)
|
|
|
|
- fvm::laplacian(DkEff(), k_)
|
|
|
|
==
|
|
|
|
betav*G + GR
|
|
|
|
- fvm::SuSp((2.0/3.0)*betav*rho_*divU, k_)
|
|
|
|
- fvm::Sp(betav*rho_*epsilon_/k_, k_)
|
|
|
|
);
|
|
|
|
|
|
|
|
kEqn().relax();
|
|
|
|
solve(kEqn);
|
|
|
|
bound(k_, k0_);
|
|
|
|
|
|
|
|
// Re-calculate viscosity
|
|
|
|
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
|
2010-08-26 14:22:03 +00:00
|
|
|
mut_.correctBoundaryConditions();
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-08-26 14:22:03 +00:00
|
|
|
// Re-calculate thermal diffusivity
|
|
|
|
alphat_ = mut_/Prt_;
|
|
|
|
alphat_.correctBoundaryConditions();
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
} // End namespace RASModels
|
|
|
|
} // End namespace compressible
|
|
|
|
} // End namespace Foam
|
|
|
|
|
|
|
|
// ************************************************************************* //
|