Commit 24c4b1b7 authored by Andrew Heather's avatar Andrew Heather
Browse files

relocation of turbulence models and renaming namespaces

parent 2251d431
......@@ -9,7 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
......
......@@ -35,7 +35,7 @@ namespace Foam
{
namespace compressible
{
namespace turbulenceModels
namespace RAS
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -55,12 +55,15 @@ PDRkEpsilon::PDRkEpsilon
:
turbulenceModel(typeName, rho, U, phi, thermophysicalModel),
Cmu(turbulenceModelCoeffs_.lookup("Cmu")),
C1(turbulenceModelCoeffs_.lookup("C1")),
C2(turbulenceModelCoeffs_.lookup("C2")),
alphak(turbulenceModelCoeffs_.lookup("alphak")),
alphaEps(turbulenceModelCoeffs_.lookup("alphaEps")),
alphah(turbulenceModelCoeffs_.lookup("alphah")),
Cmu(turbulenceModelCoeffs_.lookupOrAddDefault<scalar>("Cmu", 0.09)),
C1(turbulenceModelCoeffs_.lookupOrAddDefault<scalar>("C1", 1.44)),
C2(turbulenceModelCoeffs_.lookupOrAddDefault<scalar>("C2", 1.92)),
alphak(turbulenceModelCoeffs_.lookupOrAddDefault<scalar>("alphak", 1.0)),
alphaEps
(
turbulenceModelCoeffs_.lookupOrAddDefault<scalar>("alphaEps", 0.76923)
),
alphah(turbulenceModelCoeffs_.lookupOrAddDefault<scalar>("alphah", 1.0)),
k_
(
......@@ -102,6 +105,8 @@ PDRkEpsilon::PDRkEpsilon
)
{
# include "wallViscosityI.H"
printCoeffs();
}
......@@ -161,12 +166,12 @@ bool PDRkEpsilon::read()
{
if (turbulenceModel::read())
{
turbulenceModelCoeffs_.lookup("Cmu") >> Cmu;
turbulenceModelCoeffs_.lookup("C1") >> C1;
turbulenceModelCoeffs_.lookup("C2") >> C2;
turbulenceModelCoeffs_.lookup("alphak") >> alphak;
turbulenceModelCoeffs_.lookup("alphaEps") >> alphaEps;
turbulenceModelCoeffs_.lookup("alphah") >> alphah;
turbulenceModelCoeffs_.readIfPresent<scalar>("Cmu", Cmu);
turbulenceModelCoeffs_.readIfPresent<scalar>("C1", C1);
turbulenceModelCoeffs_.readIfPresent<scalar>("C2", C2);
turbulenceModelCoeffs_.readIfPresent<scalar>("alphak", alphak);
turbulenceModelCoeffs_.readIfPresent<scalar>("alphaEps", alphaEps);
turbulenceModelCoeffs_.readIfPresent<scalar>("alphah", alphah);
return true;
}
......@@ -204,7 +209,7 @@ void PDRkEpsilon::correct()
// in both the k and epsilon equations
const volScalarField& betav = U_.db().lookupObject<volScalarField>("betav");
const PDRDragModel& drag =
const PDRDragModel& drag =
U_.db().lookupObject<PDRDragModel>("PDRDragModel");
volScalarField GR = drag.Gk();
......@@ -259,7 +264,7 @@ void PDRkEpsilon::correct()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace turbulenceModels
} // End namespace RAS
} // End namespace compressible
} // End namespace Foam
......
......@@ -45,7 +45,7 @@ namespace Foam
{
namespace compressible
{
namespace turbulenceModels
namespace RAS
{
/*---------------------------------------------------------------------------*\
......@@ -58,12 +58,12 @@ class PDRkEpsilon
{
// Private data
dimensionedScalar Cmu;
dimensionedScalar C1;
dimensionedScalar C2;
dimensionedScalar alphak;
dimensionedScalar alphaEps;
dimensionedScalar alphah;
scalar Cmu;
scalar C1;
scalar C2;
scalar alphak;
scalar alphaEps;
scalar alphah;
volScalarField k_;
volScalarField epsilon_;
......@@ -103,7 +103,7 @@ public:
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
return tmp<volScalarField>
(
new volScalarField("DkEff", alphak*mut_ + mu())
);
......@@ -112,7 +112,7 @@ public:
//- Return the effective diffusivity for epsilon
tmp<volScalarField> DepsilonEff() const
{
return tmp<volScalarField>
return tmp<volScalarField>
(
new volScalarField("DepsilonEff", alphaEps*mut_ + mu())
);
......@@ -121,7 +121,7 @@ public:
//- Return the effective turbulent thermal diffusivity
tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>
return tmp<volScalarField>
(
new volScalarField("alphaEff", alphah*mut_ + alpha())
);
......@@ -158,7 +158,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace turbulenceModels
} // End namespace RAS
} // End namespace compressible
} // End namespace Foam
......
......@@ -5,7 +5,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude
EXE_LIBS = \
......
......@@ -3,8 +3,8 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/LESmodels \
-I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
......
......@@ -6,7 +6,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/lnInclude
-I$(LIB_SRC)/turbulenceModels/RAS/compressible/lnInclude
EXE_LIBS = \
-lengine \
......
EXE_INC = \
-I../engineFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
......
EXE_INC = \
-I../dieselEngineFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
......
......@@ -4,7 +4,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I../XiFoam
......
EXE_INC = \
-I../XiFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
......
......@@ -2,8 +2,8 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/LESmodels \
-I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude
-I$(LIB_SRC)/turbulenceModels/LES \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude
EXE_LIBS = \
-lfiniteVolume \
......
......@@ -2,7 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels
-I$(LIB_SRC)/turbulenceModels/RAS
EXE_LIBS = \
-lfiniteVolume \
......
......@@ -3,7 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels
-I$(LIB_SRC)/turbulenceModels/RAS
EXE_LIBS = \
-lfiniteVolume \
......
......@@ -2,7 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels
-I$(LIB_SRC)/turbulenceModels/RAS
EXE_LIBS = \
-lfiniteVolume \
......
......@@ -2,7 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels
-I$(LIB_SRC)/turbulenceModels/RAS
EXE_LIBS = \
-lfiniteVolume \
......
......@@ -2,7 +2,7 @@ EXE_INC = \
-I../sonicFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels
-I$(LIB_SRC)/turbulenceModels/RAS
EXE_LIBS = \
-lfiniteVolume \
......
nAveragingSteps++;
scalar nm1Coeff = scalar(nAveragingSteps - 1)/nAveragingSteps;
scalar nCoeff = 1.0/nAveragingSteps;
R += sqr(Umean);
Umean = nm1Coeff*Umean + nCoeff*U;
R = nm1Coeff*R + nCoeff*sqr(U) - sqr(Umean);
Bmean = nm1Coeff*Bmean + nCoeff*sgsModel->B();
epsilonMean = nm1Coeff*epsilonMean + nCoeff*sgsModel->epsilon();
pPrime2Mean += sqr(pMean);
pMean = nm1Coeff*pMean + nCoeff*p;
pPrime2Mean = nm1Coeff*pPrime2Mean + nCoeff*sqr(p) - sqr(pMean);
nAveragingSteps++;
scalar nm1Coeff = scalar(nAveragingSteps - 1)/nAveragingSteps;
scalar nCoeff = 1.0/nAveragingSteps;
R += sqr(Umean);
Umean = nm1Coeff*Umean + nCoeff*U;
R = nm1Coeff*R + nCoeff*sqr(U) - sqr(Umean);
Bmean = nm1Coeff*Bmean + nCoeff*sgsModel->B();
epsilonMean = nm1Coeff*epsilonMean + nCoeff*sgsModel->epsilon();
pPrime2Mean += sqr(pMean);
pMean = nm1Coeff*pMean + nCoeff*p;
pPrime2Mean = nm1Coeff*pPrime2Mean + nCoeff*sqr(p) - sqr(pMean);
nAveragingSteps++;
scalar nm1Coeff = scalar(nAveragingSteps - 1)/nAveragingSteps;
scalar nCoeff = 1.0/nAveragingSteps;
R += sqr(Umean);
Umean = nm1Coeff*Umean + nCoeff*U;
R = nm1Coeff*R + nCoeff*sqr(U) - sqr(Umean);
Bmean = nm1Coeff*Bmean + nCoeff*sgsModel->B();
epsilonMean = nm1Coeff*epsilonMean + nCoeff*sgsModel->epsilon();
pPrime2Mean += sqr(pMean);
pMean = nm1Coeff*pMean + nCoeff*p;
pPrime2Mean = nm1Coeff*pPrime2Mean + nCoeff*sqr(p) - sqr(pMean);
label nAveragingSteps = 1;
IFstream nAveragingStepsFile
(
runTime.path()/runTime.timeName()/"uniform"/"nAveragingSteps.raw"
);
autoPtr<volVectorField> UmeanPtr;
autoPtr<volSymmTensorField> RPtr;
autoPtr<volSymmTensorField> BmeanPtr;
autoPtr<volScalarField> epsilonMeanPtr;
autoPtr<volScalarField> pMeanPtr;
autoPtr<volScalarField> pPrime2MeanPtr;
if (nAveragingStepsFile.good())
{
nAveragingStepsFile >> nAveragingSteps;
Info<< "Reading field Umean\n" << endl;
UmeanPtr.reset
(
new volVectorField
(
IOobject
(
"Umean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
Info<< "\nReading field R\n" << endl;
RPtr.reset
(
new volSymmTensorField
(
IOobject
(
"R",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
Info<< "\nReading field Bmean\n" << endl;
BmeanPtr.reset
(
new volSymmTensorField
(
IOobject
(
"Bmean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
Info<< "\nReading field epsilonMean\n" << endl;
epsilonMeanPtr.reset
(
new volScalarField
(
IOobject
(
"epsilonMean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
Info<< "Reading field pMean\n" << endl;
pMeanPtr.reset
(
new volScalarField
(
IOobject
(
"pMean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
Info<< "Reading field pPrime2Mean\n" << endl;
pPrime2MeanPtr.reset
(
new volScalarField
(
IOobject
(
"pPrime2Mean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
}
else
{
Info<< "Creating field Umean\n" << endl;
UmeanPtr.reset
(
new volVectorField
(
IOobject
(
"Umean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
U
)
);
Info<< "Creating field R\n" << endl;
RPtr.reset
(
new volSymmTensorField
(
IOobject
(
"R",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sqr(U) - sqr(UmeanPtr())
)
);
Info<< "Creating field Bmean\n" << endl;
BmeanPtr.reset
(
new volSymmTensorField
(
IOobject
(
"Bmean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sgsModel->B()
)
);
Info<< "Creating field epsilonMean\n" << endl;
epsilonMeanPtr.reset
(
new volScalarField
(
IOobject
(
"epsilonMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sgsModel->epsilon()
)
);
Info<< "Creating field pMean\n" << endl;
pMeanPtr.reset
(
new volScalarField
(
IOobject
(
"pMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p
)
);
Info<< "Creating field pPrime2Mean\n" << endl;
pPrime2MeanPtr.reset
(
new volScalarField
(
IOobject
(
"pPrime2Mean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sqr(p) - sqr(pMeanPtr())
)
);
}
volVectorField& Umean = UmeanPtr();
volSymmTensorField& R = RPtr();
volSymmTensorField& Bmean = BmeanPtr();
volScalarField& epsilonMean = epsilonMeanPtr();
volScalarField& pMean = pMeanPtr();
volScalarField& pPrime2Mean = pPrime2MeanPtr();