These new names are more consistent and logical because:
primitiveField():
primitiveFieldRef():
Provides low-level access to the Field<Type> (primitive field)
without dimension or mesh-consistency checking. This should only be
used in the low-level functions where dimensional consistency is
ensured by careful programming and computational efficiency is
paramount.
internalField():
internalFieldRef():
Provides access to the DimensionedField<Type, GeoMesh> of values on
the internal mesh-type for which the GeometricField is defined and
supports dimension and checking and mesh-consistency checking.
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
{
|
|
volScalarField& rDeltaT = trDeltaT.ref();
|
|
|
|
const dictionary& pimpleDict = pimple.dict();
|
|
|
|
scalar maxCo
|
|
(
|
|
pimpleDict.lookupOrDefault<scalar>("maxCo", 0.2)
|
|
);
|
|
|
|
scalar maxDeltaT
|
|
(
|
|
pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)
|
|
);
|
|
|
|
scalar rDeltaTSmoothingCoeff
|
|
(
|
|
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
|
|
);
|
|
|
|
surfaceScalarField maxPhi("maxPhi", phi);
|
|
|
|
forAll(phases, phasei)
|
|
{
|
|
maxPhi = max(maxPhi, mag(phases[phasei].phi()));
|
|
}
|
|
|
|
// Set the reciprocal time-step from the local Courant number
|
|
rDeltaT.ref() = max
|
|
(
|
|
1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
|
|
fvc::surfaceSum(maxPhi)()()
|
|
/((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.primitiveField())
|
|
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
|
}
|