From c46216e645cd583177593ddd0e2e35e8b7fdec96 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Fri, 10 Dec 2021 15:43:14 +0000 Subject: [PATCH] COMP: Added missed file --- .../incompressible/pimpleFoam/setRDeltaT.H | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 applications/solvers/incompressible/pimpleFoam/setRDeltaT.H diff --git a/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H b/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H new file mode 100644 index 0000000000..962bfa8766 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H @@ -0,0 +1,69 @@ +{ + volScalarField& rDeltaT = trDeltaT.ref(); + + const dictionary& pimpleDict = pimple.dict(); + + scalar maxCo + ( + pimpleDict.getOrDefault("maxCo", 0.8) + ); + + scalar rDeltaTSmoothingCoeff + ( + pimpleDict.getOrDefault("rDeltaTSmoothingCoeff", 0.02) + ); + + scalar rDeltaTDampingCoeff + ( + pimpleDict.getOrDefault("rDeltaTDampingCoeff", 1.0) + ); + + scalar maxDeltaT + ( + pimpleDict.getOrDefault("maxDeltaT", GREAT) + ); + + volScalarField rDeltaT0("rDeltaT0", rDeltaT); + + // Set the reciprocal time-step from the local Courant number + rDeltaT.ref() = max + ( + 1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT), + fvc::surfaceSum(mag(phi))()() + /((2*maxCo)*mesh.V()) + ); + + // Update the boundary values of the reciprocal time-step + rDeltaT.correctBoundaryConditions(); + + Info<< "Flow time scale min/max = " + << gMin(1/rDeltaT.primitiveField()) + << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + + if (rDeltaTSmoothingCoeff < 1.0) + { + fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); + } + + Info<< "Smoothed flow time scale min/max = " + << gMin(1/rDeltaT.primitiveField()) + << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + + // Limit rate of change of time scale + // - reduce as much as required + // - only increase at a fraction of old time scale + if + ( + rDeltaTDampingCoeff < 1.0 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT = + rDeltaT0 + *max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff); + + Info<< "Damped flow time scale min/max = " + << gMin(1/rDeltaT.primitiveField()) + << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + } +}