Commit d314ed3b authored by Henry Weller's avatar Henry Weller
Browse files

LTS, MULES and sub-cycling: Improved the handling of the rSubDeltaT field

parent 3025df4e
......@@ -82,7 +82,7 @@
? fv::localEulerDdtScheme<scalar>
(
mesh,
trSubDeltaT().name()
nAlphaSubCycles > 1 ? "rSubDeltaT" : "rDeltaT"
).fvmDdt(alpha1)
: fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
)
......
......@@ -13,6 +13,16 @@ if (nAlphaSubCycles > 1)
dimensionedScalar("0", rhoPhi.dimensions(), 0)
);
tmp<volScalarField> trSubDeltaT;
if (LTS)
{
trSubDeltaT = tmp<volScalarField>
(
new volScalarField("rSubDeltaT", trDeltaT()*nAlphaSubCycles)
);
}
for
(
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
......
bool LTS =
word(mesh.ddtScheme("default"))
== fv::localEulerDdtScheme<scalar>::typeName;
tmp<volScalarField> trDeltaT;
tmp<volScalarField> trSubDeltaT;
if (LTS)
{
scalar maxDeltaT
(
pimple.dict().lookupOrDefault<scalar>("maxDeltaT", GREAT)
);
trDeltaT = tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"rDeltaT",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
zeroGradientFvPatchScalarField::typeName
)
);
trSubDeltaT = tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"rSubDeltaT",
runTime.timeName(),
mesh
),
mesh,
1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT)
)
);
}
{
volScalarField& rDeltaT = trDeltaT();
volScalarField& rSubDeltaT = trSubDeltaT();
const dictionary& pimpleDict = pimple.dict();
......@@ -134,9 +133,4 @@
<< gMin(1/rDeltaT.internalField())
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
}
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
rSubDeltaT = rDeltaT*nAlphaSubCycles;
}
......@@ -175,6 +175,10 @@ void Foam::twoPhaseSystem::solve()
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
bool LTS =
word(mesh.ddtScheme("default"))
== fv::localEulerDdtScheme<scalar>::typeName;
word alphaScheme("div(phi," + alpha1.name() + ')');
word alpharScheme("div(phir," + alpha1.name() + ')');
......@@ -316,6 +320,22 @@ void Foam::twoPhaseSystem::solve()
if (nAlphaSubCycles > 1)
{
tmp<volScalarField> trSubDeltaT;
if (LTS)
{
const volScalarField& rDeltaT =
mesh.objectRegistry::lookupObject<volScalarField>
(
"rDeltaT"
);
trSubDeltaT = tmp<volScalarField>
(
new volScalarField("rSubDeltaT", rDeltaT*nAlphaSubCycles)
);
}
for
(
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
......
......@@ -96,7 +96,10 @@ void Foam::MULES::correct
if (LTS)
{
const volScalarField& rDeltaT =
mesh.objectRegistry::lookupObject<volScalarField>("rSubDeltaT");
mesh.objectRegistry::lookupObject<volScalarField>
(
mesh.time().subCycling() ? "rSubDeltaT" : "rDeltaT"
);
limitCorr
(
......
......@@ -118,7 +118,10 @@ void Foam::MULES::explicitSolve
if (LTS)
{
const volScalarField& rDeltaT =
mesh.objectRegistry::lookupObject<volScalarField>("rSubDeltaT");
mesh.objectRegistry::lookupObject<volScalarField>
(
mesh.time().subCycling() ? "rSubDeltaT" : "rDeltaT"
);
limit
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment