mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
rhoCentralFoam: Added experimental LTS support
Select LTS via the ddtScheme:
ddtSchemes
{
default localEuler rDeltaT;
}
The LTS algorithm is controlled with the standard settings in
controlDict, e.g.:
maxCo 0.5;
maxDeltaT 2e-8;
with the addition of the optional rDeltaT smoothing coefficient:
rDeltaTSmoothingCoeff 0.02;
which defaults to 0.02.
For cases with reasonably uniform meshes like the forwardStep tutorial
LTS does not provide much benefit but for cases with large variation in
cell-size like the biconic25-55Run35 tutorial LTS provides significant
speed-up to convergence particularly if started from uniform conditions.
This commit is contained in:
@ -0,0 +1,28 @@
|
|||||||
|
bool LTS =
|
||||||
|
word(mesh.ddtScheme("ddt(rho)"))
|
||||||
|
== fv::localEulerDdtScheme<scalar>::typeName;
|
||||||
|
|
||||||
|
tmp<volScalarField> trDeltaT;
|
||||||
|
|
||||||
|
if (LTS)
|
||||||
|
{
|
||||||
|
Info<< "Using LTS" << endl;
|
||||||
|
|
||||||
|
trDeltaT = tmp<volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rDeltaT",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("one", dimless/dimTime, 1),
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -36,6 +36,8 @@ Description
|
|||||||
#include "zeroGradientFvPatchFields.H"
|
#include "zeroGradientFvPatchFields.H"
|
||||||
#include "fixedRhoFvPatchScalarField.H"
|
#include "fixedRhoFvPatchScalarField.H"
|
||||||
#include "directionInterpolate.H"
|
#include "directionInterpolate.H"
|
||||||
|
#include "localEulerDdtScheme.H"
|
||||||
|
#include "fvcSmooth.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -46,6 +48,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
|
#include "createRDeltaT.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -134,7 +137,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "centralCourantNo.H"
|
#include "centralCourantNo.H"
|
||||||
#include "readTimeControls.H"
|
#include "readTimeControls.H"
|
||||||
#include "setDeltaT.H"
|
|
||||||
|
if (LTS)
|
||||||
|
{
|
||||||
|
#include "setRDeltaT.H"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#include "setDeltaT.H"
|
||||||
|
}
|
||||||
|
|
||||||
runTime++;
|
runTime++;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
volScalarField& rDeltaT = trDeltaT();
|
||||||
|
|
||||||
|
scalar rDeltaTSmoothingCoeff
|
||||||
|
(
|
||||||
|
runTime.controlDict().lookupOrDefault<scalar>
|
||||||
|
(
|
||||||
|
"rDeltaTSmoothingCoeff",
|
||||||
|
0.02
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Set the reciprocal time-step from the local Courant number
|
||||||
|
rDeltaT.dimensionedInternalField() = max
|
||||||
|
(
|
||||||
|
1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
|
||||||
|
fvc::surfaceSum(amaxSf)().dimensionedInternalField()
|
||||||
|
/(2*maxCo*mesh.V())
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update tho boundary values of the reciprocal time-step
|
||||||
|
rDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
|
|
||||||
|
Info<< "Flow time scale min/max = "
|
||||||
|
<< gMin(1/rDeltaT.internalField())
|
||||||
|
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user