mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
37 lines
969 B
C
37 lines
969 B
C
{
|
|
volScalarField& rDeltaT = trDeltaT();
|
|
|
|
scalar rDeltaTSmoothingCoeff
|
|
(
|
|
runTime.controlDict().lookupOrDefault<scalar>
|
|
(
|
|
"rDeltaTSmoothingCoeff",
|
|
0.02
|
|
)
|
|
);
|
|
|
|
surfaceScalarField maxPhi("maxPhi", phi);
|
|
|
|
forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
|
|
{
|
|
maxPhi = max(maxPhi, mag(iter().phi()));
|
|
}
|
|
|
|
// Set the reciprocal time-step from the local Courant number
|
|
rDeltaT.dimensionedInternalField() = max
|
|
(
|
|
1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
|
|
fvc::surfaceSum(maxPhi)().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;
|
|
}
|