Commit b39a77a9 authored by Andrew Heather's avatar Andrew Heather
Browse files
parents c4d9fcc4 bfbab344
......@@ -51,199 +51,16 @@ PDRkEpsilon::PDRkEpsilon
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
const word& turbulenceModelName,
const word& modelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Cmu",
coeffDict_,
0.09
)
),
C1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"C1",
coeffDict_,
1.44
)
),
C2_
(
dimensioned<scalar>::lookupOrAddToDict
(
"C2",
coeffDict_,
1.92
)
),
sigmak_
(
dimensioned<scalar>::lookupOrAddToDict
(
"sigmak",
coeffDict_,
1.0
)
),
sigmaEps_
(
dimensioned<scalar>::lookupOrAddToDict
(
"sigmaEps",
coeffDict_,
1.3
)
),
Prt_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Prt",
coeffDict_,
1.0
)
),
k_
(
IOobject
(
"k",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateK("k", mesh_)
),
epsilon_
(
IOobject
(
"epsilon",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateEpsilon("epsilon", mesh_)
),
mut_
(
IOobject
(
"mut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
autoCreateMut("mut", mesh_)
),
alphat_
(
IOobject
(
"alphat",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateAlphat("alphat", mesh_)
)
{
bound(epsilon_, epsilonMin_);
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
printCoeffs();
}
kEpsilon(rho, U, phi, thermophysicalModel, turbulenceModelName, modelName)
{}
// * * * * * * * * * * * * * * * 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_)))
)
);
}
tmp<fvVectorMatrix> PDRkEpsilon::divDevRhoReff(volVectorField& U) const
{
return
(
- fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T()))
);
}
bool PDRkEpsilon::read()
{
if (RASModel::read())
{
Cmu_.readIfPresent(coeffDict_);
C1_.readIfPresent(coeffDict_);
C2_.readIfPresent(coeffDict_);
sigmak_.readIfPresent(coeffDict());
sigmaEps_.readIfPresent(coeffDict());
Prt_.readIfPresent(coeffDict());
return true;
}
else
{
return false;
}
}
void PDRkEpsilon::correct()
{
if (!turbulence_)
......@@ -272,7 +89,7 @@ void PDRkEpsilon::correct()
volScalarField G("RASModel::G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear();
// Update espsilon and G at the wall
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Add the blockage generation term so that it is included consistently
......@@ -321,6 +138,7 @@ void PDRkEpsilon::correct()
solve(kEqn);
bound(k_, kMin_);
// Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions();
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -25,12 +25,13 @@ Class
Foam::compressible::RASModels::PDRkEpsilon
Description
Standard k-epsilon turbulence model with additional source terms
Standard k-epsilon turbulence model for compressible flow
with additional source terms
corresponding to PDR basic drag model (\link basic.H \endlink)
The default model coefficients correspond to the following:
@verbatim
kEpsilonCoeffs
PDRkEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
......@@ -53,7 +54,6 @@ Description
SourceFiles
PDRkEpsilon.C
PDRkEpsilonCorrect.C
\*---------------------------------------------------------------------------*/
......@@ -61,6 +61,7 @@ SourceFiles
#define compressiblePDRkEpsilon_H
#include "RASModel.H"
#include "kEpsilon.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -77,26 +78,8 @@ namespace RASModels
class PDRkEpsilon
:
public RASModel
public kEpsilon
{
// Private data
// Model coefficients
dimensionedScalar Cmu_;
dimensionedScalar C1_;
dimensionedScalar C2_;
dimensionedScalar sigmak_;
dimensionedScalar sigmaEps_;
dimensionedScalar Prt_;
// Fields
volScalarField k_;
volScalarField epsilon_;
volScalarField mut_;
volScalarField alphat_;
public:
......@@ -113,7 +96,8 @@ public:
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
);
......@@ -124,62 +108,9 @@ public:
// Member Functions
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", mut_/sigmak_ + mu())
);
}
//- Return the effective diffusivity for epsilon
tmp<volScalarField> DepsilonEff() const
{
return tmp<volScalarField>
(
new volScalarField("DepsilonEff", mut_/sigmaEps_ + mu())
);
}
//- Return the turbulence viscosity
virtual tmp<volScalarField> mut() const
{
return mut_;
}
//- Return the turbulence thermal diffusivity
virtual tmp<volScalarField> alphat() const
{
return alphat_;
}
//- Return the turbulence kinetic energy
virtual tmp<volScalarField> k() const
{
return k_;
}
//- Return the turbulence kinetic energy dissipation rate
virtual tmp<volScalarField> epsilon() const
{
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read turbulenceProperties dictionary
virtual bool read();
};
......
......@@ -13,7 +13,6 @@
);
TEqn.relax();
TEqn.solve();
rhok = 1.0 - beta*(T - TRef);
......
......@@ -8,15 +8,18 @@
UEqn().relax();
solve
(
UEqn()
==
fvc::reconstruct
if (momentumPredictor)
{
solve
(
UEqn()
==
fvc::reconstruct
(
fvc::interpolate(rhok)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
(
- ghf*fvc::snGrad(rhok)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
)
);
);
}
......@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
#include "readSIMPLEControls.H"
p.storePrevIter();
p_rgh.storePrevIter();
// Pressure-velocity SIMPLE corrector
{
......
......@@ -14,12 +14,12 @@
mesh
);
Info<< "Reading field p\n" << endl;
volScalarField p
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p",
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
......@@ -42,9 +42,9 @@
mesh
);
# include "createPhi.H"
#include "createPhi.H"
# include "readTransportProperties.H"
#include "readTransportProperties.H"
Info<< "Creating turbulence model\n" << endl;
autoPtr<incompressible::RASModel> turbulence
......@@ -52,20 +52,6 @@
incompressible::RASModel::New(U, phi, laminarTransport)
);
Info<< "Calculating field beta*(g.h)\n" << endl;
surfaceScalarField betaghf("betagh", beta*(g & mesh.Cf()));
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell
(
p,
mesh.solutionDict().subDict("SIMPLE"),
pRefCell,
pRefValue
);
// Kinematic density for buoyancy force
volScalarField rhok
(
......@@ -77,3 +63,47 @@
),
1.0 - beta*(T - TRef)
);
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p_rgh + rhok*gh
);
label p_rghRefCell = 0;
scalar p_rghRefValue = 0.0;
setRefCell
(
p_rgh,
mesh.solutionDict().subDict("SIMPLE"),
p_rghRefCell,
p_rghRefValue
);
scalar pRefValue = 0.0;
if (p_rgh.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("SIMPLE").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, p_rghRefCell)
);
}
......@@ -6,45 +6,56 @@
UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p);
adjustPhi(phi, U, p_rgh);
surfaceScalarField buoyancyPhi =
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
phi += buoyancyPhi;
surfaceScalarField buoyancyPhi = rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf();
phi -= buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
fvScalarMatrix p_rghEqn
(
fvm::laplacian(rUAf, p) == fvc::div(phi)
fvm::laplacian(rUAf, p_rgh) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
p_rghEqn.setReference(p_rghRefCell, p_rghRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)
{
pEqn.solve();
p_rghEqn.solve();
}
else
{
pEqn.solve();
p_rghEqn.solve();
}
if (nonOrth == nNonOrthCorr)
{
// Calculate the conservative fluxes
phi -= pEqn.flux();
phi -= p_rghEqn.flux();
// Explicitly relax pressure for momentum corrector
p.relax();
p_rgh.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf);
U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf);
U.correctBoundaryConditions();
}
}
#include "continuityErrs.H"
p = p_rgh + rhok*gh;
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, p_rghRefCell)
);
}
}
......@@ -8,13 +8,18 @@
UEqn().relax();
solve
(
UEqn()
==
fvc::reconstruct
if (momentumPredictor)
{
solve
(
fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
)
);
UEqn()
==