setDeltaT: Rationalised and standardised for both modular and standard solvers

This commit is contained in:
Henry Weller
2022-11-03 20:59:43 +00:00
parent ee4f05411d
commit b1dea63437
7 changed files with 59 additions and 69 deletions

View File

@ -33,13 +33,16 @@ Description
if (adjustTimeStep)
{
scalar deltaT = maxCo*runTime.deltaTValue()/(CoNum + small);
deltaT = min
(
min(deltaT, runTime.deltaTValue() + 0.1*deltaT),
1.2*runTime.deltaTValue()
);
runTime.setDeltaT(min(deltaT, maxDeltaT));
scalar deltaT = 1.2*runTime.deltaTValue();
if (CoNum > small)
{
deltaT = min(deltaT, maxCo/CoNum*runTime.deltaTValue());
}
deltaT = min(deltaT, maxDeltaT);
runTime.setDeltaT(deltaT);
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}

View File

@ -55,33 +55,23 @@ void Foam::setDeltaT(Time& runTime, const PtrList<solver>& solvers)
void Foam::adjustDeltaT(Time& runTime, const PtrList<solver>& solvers)
{
// Update the time-step limited by the solvers maxDeltaT
if (runTime.controlDict().lookupOrDefault("adjustTimeStep", false))
{
scalar deltaT = great;
scalar deltaT = 1.2*runTime.deltaTValue();
bool transient = false;
forAll(solvers, i)
{
if (solvers[i].transient())
{
const scalar maxDeltaTi = solvers[i].maxDeltaT();
deltaT = min
(
deltaT,
min
(
min
(
maxDeltaTi,
runTime.deltaTValue() + 0.1*maxDeltaTi
),
1.2*runTime.deltaTValue()
)
);
transient = true;
deltaT = min(deltaT, solvers[i].maxDeltaT());
}
}
if (deltaT != great)
if (transient)
{
runTime.setDeltaT(deltaT);
Info<< "deltaT = " << runTime.deltaTValue() << endl;

View File

@ -43,20 +43,14 @@ void Foam::setDeltaT(Time& runTime, const solver& solver)
void Foam::adjustDeltaT(Time& runTime, const solver& solver)
{
// Update the time-step from the solver maxDeltaT
// Update the time-step limited by the solver maxDeltaT
if
(
solver.transient()
&& runTime.controlDict().lookupOrDefault("adjustTimeStep", false)
)
{
scalar deltaT = solver.maxDeltaT();
deltaT = min
(
min(deltaT, runTime.deltaTValue() + 0.1*deltaT),
1.2*runTime.deltaTValue()
);
runTime.setDeltaT(deltaT);
runTime.setDeltaT(min(1.2*runTime.deltaTValue(), solver.maxDeltaT()));
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,19 +33,21 @@ Description
if (adjustTimeStep)
{
scalar maxDeltaTFact =
min(maxCo/(CoNum + small), maxAcousticCo/(acousticCoNum + small));
scalar deltaT = 1.2*runTime.deltaTValue();
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
if (CoNum > small)
{
deltaT = min(deltaT, maxCo/CoNum*runTime.deltaTValue());
}
runTime.setDeltaT
(
min
(
deltaTFact*runTime.deltaTValue(),
maxDeltaT
)
);
if (acousticCoNum > small)
{
deltaT = min(deltaT, maxAcousticCo/acousticCoNum*runTime.deltaTValue());
}
deltaT = min(deltaT, maxDeltaT);
runTime.setDeltaT(deltaT);
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}

View File

@ -33,15 +33,21 @@ Description
if (adjustTimeStep)
{
scalar deltaT =
min(maxCo/(CoNum + small), maxAlphaCo/(alphaCoNum + small))
*runTime.deltaTValue();
deltaT = min
(
min(deltaT, runTime.deltaTValue() + 0.1*deltaT),
1.2*runTime.deltaTValue()
);
runTime.setDeltaT(min(deltaT, maxDeltaT));
scalar deltaT = 1.2*runTime.deltaTValue();
if (CoNum > small)
{
deltaT = min(deltaT, runTime.deltaTValue()*maxCo/CoNum);
}
if (alphaCoNum > small)
{
deltaT = min(maxAlphaCo/alphaCoNum*runTime.deltaTValue(), deltaT);
}
deltaT = min(deltaT, maxDeltaT);
runTime.setDeltaT(deltaT);
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}

View File

@ -33,18 +33,17 @@ Description
if (adjustTimeStep)
{
scalar deltaT = 1.2*runTime.deltaTValue();
if (CoNum > small)
{
scalar deltaT = maxCo*runTime.deltaTValue()/CoNum;
deltaT = min(min(deltaT, fvModels.maxDeltaT()), maxDeltaT);
deltaT = min
(
min(deltaT, runTime.deltaTValue() + 0.1*deltaT),
1.2*runTime.deltaTValue()
);
runTime.setDeltaT(deltaT);
deltaT = min(deltaT, maxCo/CoNum*runTime.deltaTValue());
}
deltaT = min(min(deltaT, fvModels.maxDeltaT()), maxDeltaT);
runTime.setDeltaT(deltaT);
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}

View File

@ -33,11 +33,11 @@ Description
if (adjustTimeStep)
{
scalar deltaT = runTime.deltaTValue();
scalar deltaT = 1.2*runTime.deltaTValue();
if (CoNum > small)
{
deltaT = min(maxCo/CoNum*runTime.deltaTValue(), fvModels.maxDeltaT());
deltaT = min(deltaT, runTime.deltaTValue()*maxCo/CoNum);
}
if (alphaCoNum > small)
@ -45,13 +45,9 @@ if (adjustTimeStep)
deltaT = min(maxAlphaCo/alphaCoNum*runTime.deltaTValue(), deltaT);
}
deltaT = min
(
min(deltaT, runTime.deltaTValue() + 0.1*deltaT),
1.2*runTime.deltaTValue()
);
deltaT = min(min(deltaT, fvModels.maxDeltaT()), maxDeltaT);
runTime.setDeltaT(min(deltaT, maxDeltaT));
runTime.setDeltaT(deltaT);
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}