diff --git a/applications/solvers/combustion/PDRFoam/setDeltaT.H b/applications/solvers/combustion/PDRFoam/setDeltaT.H index 365126ce90..177fc1fa7f 100644 --- a/applications/solvers/combustion/PDRFoam/setDeltaT.H +++ b/applications/solvers/combustion/PDRFoam/setDeltaT.H @@ -36,11 +36,13 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + SMALL); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/combustion/chemFoam/setDeltaT.H b/applications/solvers/combustion/chemFoam/setDeltaT.H index ef50a97026..93f68ceb6c 100644 --- a/applications/solvers/combustion/chemFoam/setDeltaT.H +++ b/applications/solvers/combustion/chemFoam/setDeltaT.H @@ -1,5 +1,6 @@ if (adjustTimeStep) { - runTime.setDeltaT(min(dtChem, maxDeltaT)); + runTime.setDeltaT(Foam::min(dtChem, maxDeltaT)); + Info<< "deltaT = " << runTime.deltaTValue() << endl; } diff --git a/applications/solvers/combustion/fireFoam/setMultiRegionDeltaT.H b/applications/solvers/combustion/fireFoam/setMultiRegionDeltaT.H index 31c9e675fc..a5ac0fcc9a 100644 --- a/applications/solvers/combustion/fireFoam/setMultiRegionDeltaT.H +++ b/applications/solvers/combustion/fireFoam/setMultiRegionDeltaT.H @@ -54,9 +54,18 @@ if (adjustTimeStep) runTime.setDeltaT ( - min + Foam::min ( - dt0*min(min(TFactorFluid, min(TFactorFilm, TFactorSolid)), 1.2), + dt0 + * Foam::min + ( + Foam::min + ( + TFactorFluid, + Foam::min(TFactorFilm, TFactorSolid) + ), + 1.2 + ), maxDeltaT ) ); diff --git a/applications/solvers/combustion/reactingFoam/setRDeltaT.H b/applications/solvers/combustion/reactingFoam/setRDeltaT.H index 6bf4cf8375..67a2b00f91 100644 --- a/applications/solvers/combustion/reactingFoam/setRDeltaT.H +++ b/applications/solvers/combustion/reactingFoam/setRDeltaT.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,10 +57,22 @@ License // (relative to reference value) scalar alphaY(pimpleDict.getOrDefault("alphaY", 1.0)); - Info<< "Time scales min/max:" << endl; - // Cache old reciprocal time scale field - volScalarField rDeltaT0("rDeltaT0", rDeltaT); + // The old reciprocal time scale field, with any damping factor + tmp rDeltaT0_damped; + + // Calculate damped value before applying any other changes + if + ( + rDeltaTDampingCoeff < 1 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT); + } + + + Info<< "Time scales min/max:" << endl; // Flow time scale { @@ -70,12 +82,14 @@ License /((2*maxCo)*mesh.V()*rho()) ); - // Limit the largest time scale - rDeltaT.max(1/maxDeltaT); + // Limit the largest time scale (=> smallest reciprocal time) + rDeltaT.clamp_min(1/maxDeltaT); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); Info<< " Flow = " - << 1/gMax(rDeltaT.primitiveField()) << ", " - << 1/gMin(rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } // Heat release rate time scale @@ -86,11 +100,13 @@ License mag(Qdot)/(alphaTemp*rho*thermo.Cp()*T) ); - Info<< " Temperature = " - << 1/(gMax(rDeltaTT.field()) + VSMALL) << ", " - << 1/(gMin(rDeltaTT.field()) + VSMALL) << endl; + rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT); - rDeltaT.ref() = max(rDeltaT(), rDeltaTT); + auto limits = gMinMax(rDeltaTT.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< " Temperature = " + << limits.min() << ", " << limits.max() << endl; } // Reaction rate time scale @@ -138,11 +154,13 @@ License if (foundY) { - Info<< " Composition = " - << 1/(gMax(rDeltaTY.field()) + VSMALL) << ", " - << 1/(gMin(rDeltaTY.field()) + VSMALL) << endl; + rDeltaT.primitiveFieldRef().clamp_min(rDeltaTY); - rDeltaT.ref() = max(rDeltaT(), rDeltaTY); + auto limits = gMinMax(rDeltaTY.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< " Composition = " + << limits.min() << ", " << limits.max() << endl; } else { @@ -161,28 +179,22 @@ License fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } - // Limit rate of change of time scale + // Limit rate of change of time scale (=> smallest reciprocal time) // - reduce as much as required // - only increase at a fraction of old time scale - if - ( - rDeltaTDampingCoeff < 1 - && runTime.timeIndex() > runTime.startTimeIndex() + 1 - ) + if (rDeltaT0_damped) { - rDeltaT = max - ( - rDeltaT, - (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0 - ); + rDeltaT.clamp_min(rDeltaT0_damped()); } // Update tho boundary values of the reciprocal time-step rDeltaT.correctBoundaryConditions(); + auto limits = gMinMax(rDeltaT.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< " Overall = " - << 1/gMax(rDeltaT.primitiveField()) - << ", " << 1/gMin(rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H b/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H index 5e2a2b302c..8f9560b742 100644 --- a/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H +++ b/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H @@ -23,7 +23,11 @@ fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); - Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } } diff --git a/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H b/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H index e818402eff..51ecac9f07 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H +++ b/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H @@ -52,18 +52,26 @@ // 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; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Flow time scale min/max = " + << limits.min() << ", " << limits.max() << 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; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Smoothed flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } // Limit rate of change of time scale // - reduce as much as required @@ -78,8 +86,10 @@ rDeltaT0 *max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff); + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Damped flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H index 3ca2f68581..5ccc00d3ad 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H @@ -1,7 +1,7 @@ scalar CoNum = -GREAT; forAll(fluidRegions, regionI) { - CoNum = max + CoNum = Foam::max ( compressibleCourantNo ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H index fe3d742816..d4dd47300e 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H @@ -78,8 +78,8 @@ } rho = thermo.rho(); - rho = max(rho, rhoMin[i]); - rho = min(rho, rhoMax[i]); + + rho.clamp_range(rhoMin[i], rhoMax[i]); rho.relax(); Info<< "Min/max rho:" << min(rho).value() << ' ' diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C index 33d1c05548..a0232c0b1c 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C @@ -387,15 +387,18 @@ updateCoeffs() { scalar Q = gSum(kappa(Tp)*patch().magSf()*snGrad()); - Info<< "T solid : " << nl << endl; + auto limits = gMinMax(Tp); + auto avg = gAverage(Tp); - Info - << " heat transfer rate from solid:" << Q - << " walltemperature " - << " min:" << gMin(Tp) - << " max:" << gMax(Tp) - << " avg:" << gAverage(Tp) << nl - << endl; + Info<< "T solid : " << nl << endl; + + Info + << " heat transfer rate from solid:" << Q + << " walltemperature " + << " min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << nl + << endl; } } else if (regionType_ == fluid) @@ -445,10 +448,16 @@ updateCoeffs() scalarField qLiq((Tp - Tc)*KdeltaLiq); scalarField qVap((Tp - Tv.patchInternalField())*KdeltaVap); + auto infoT = gMinMax(Tp); + auto avgT = gAverage(Tp); + + auto infoLiq = gMinMax(qLiq); + auto infoVap = gMinMax(qVap); + Info<< "T flow : " << nl << endl; - Info<< " qLiq: " << gMin(qLiq) << " - " << gMax(qLiq) << endl; - Info<< " qVap: " << gMin(qVap) << " - " << gMax(qVap) << endl; + Info<< " qLiq: " << infoLiq.min() << " - " << infoLiq.max() << nl + << " qVap: " << infoVap.min() << " - " << infoVap.max() << nl; scalar QLiq = gSum(qLiq*patch().magSf()); scalar QVap = gSum(qVap*patch().magSf()); @@ -457,9 +466,9 @@ updateCoeffs() Info<< " Heat transfer to Vap: " << QVap << endl; Info<< " walltemperature " - << " min:" << gMin(Tp) - << " max:" << gMax(Tp) - << " avg:" << gAverage(Tp) + << " min:" << infoT.min() + << " max:" << infoT.max() + << " avg:" << avgT << endl; } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/fluid/compressibleMultiRegionCourantNo.H index 290bb596cf..392d74f6a3 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/fluid/compressibleMultiRegionCourantNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/fluid/compressibleMultiRegionCourantNo.H @@ -31,7 +31,7 @@ ); - CoNum = + scalar regionCoNum = 0.5*gMax ( sumPhi/fluidRegions[regioni].V().field() @@ -41,9 +41,9 @@ ( fvc::surfaceSum(mag(phi1 - phi2))().primitiveField() / fluidRegions[regioni].V().field() - )*runTime.deltaTValue(), + )*runTime.deltaTValue(); - CoNum = max(UrCoNum, CoNum); + CoNum = Foam::max(CoNum, Foam::max(regionCoNum, UrCoNum)); } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H index dd129047dc..d5b5c7ceaa 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H @@ -2,7 +2,7 @@ forAll(fluidRegions, regioni) { - CoNum = max + CoNum = Foam::max ( compressibleCourantNo ( @@ -17,7 +17,7 @@ /* forAll(porousFluidRegions, porousi) { - CoNum = max + CoNum = Foam::max ( compressibleCourantNo ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H index 09f4a717a9..8be6345765 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H @@ -47,10 +47,10 @@ if (adjustTimeStep) runTime.setDeltaT ( - min + Foam::min ( - min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(), - min(runTime.deltaTValue(), maxDeltaT) + Foam::min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(), + Foam::min(runTime.deltaTValue(), maxDeltaT) ) ); Info<< "deltaT = " << runTime.deltaTValue() << endl; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H index 8eed82dd5c..d81d374f41 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H @@ -48,18 +48,14 @@ if (adjustTimeStep) scalar maxDeltaTFluid = maxCo/(CoNum + SMALL); scalar maxDeltaTSolid = maxDi/(DiNum + SMALL); - scalar deltaTFluid = - min - ( - min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid), - 1.2 - ); + const scalar deltaTFluid = + Foam::min(Foam::min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid), 1.2); runTime.setDeltaT ( - min + Foam::min ( - min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(), + Foam::min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(), maxDeltaT ) ); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H index 6e87fb9203..8c6111d276 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H @@ -22,7 +22,7 @@ forAll(solidRegions, i) tmp trho = thermo.rho(); const volScalarField& rho = trho(); - DiNum = max + DiNum = Foam::max ( solidRegionDiffNo ( diff --git a/applications/solvers/heatTransfer/solidFoam/solidDiffusionNo.H b/applications/solvers/heatTransfer/solidFoam/solidDiffusionNo.H index 90317f67c6..3484c35b9f 100644 --- a/applications/solvers/heatTransfer/solidFoam/solidDiffusionNo.H +++ b/applications/solvers/heatTransfer/solidFoam/solidDiffusionNo.H @@ -17,7 +17,7 @@ scalar DiNum = -GREAT; tmp trho = thermo.rho(); const volScalarField& rho = trho(); - DiNum = max + DiNum = Foam::max ( solidRegionDiffNo ( diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C index be66f4cc53..79a06161d1 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C @@ -60,13 +60,10 @@ template void zeroCells ( GeometricField& vf, - const labelList& cells + const labelUList& cells ) { - forAll(cells, i) - { - vf[cells[i]] = Zero; - } + UIndirectList(vf.primitiveField(), cells) = Zero; } diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H b/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H index 4d7b9d8811..3d19017f9d 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H @@ -103,8 +103,8 @@ dimensionedScalar alphaMax laminarTransport ); -const labelList& inletCells = mesh.boundary()["inlet"].faceCells(); -//const labelList& outletCells = mesh.boundary()["outlet"].faceCells(); +const labelUList& inletCells = mesh.boundary()["inlet"].faceCells(); +//const labelUList& outletCells = mesh.boundary()["outlet"].faceCells(); volScalarField alpha ( diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H index 8c692c1378..f5304eea58 100644 --- a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H @@ -55,7 +55,7 @@ if (mesh.changing()) dimensionedScalar rAUf("rAUf", dimTime, 1.0); const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); + const labelUList& cellTypes = overlap.cellTypes(); const labelIOList& zoneIDs = overlap.zoneID(); while (pimple.correctNonOrthogonal()) diff --git a/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H b/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H index 962bfa8766..3acc01c5fa 100644 --- a/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H +++ b/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H @@ -36,18 +36,26 @@ // 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; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Flow time scale min/max = " + << limits.min() << ", " << limits.max() << 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; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Smoothed flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } // Limit rate of change of time scale // - reduce as much as required @@ -62,8 +70,10 @@ rDeltaT0 *max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff); + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Damped flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H b/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H index bda1cc2d88..745249cfdf 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,10 +54,21 @@ License scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05)); - Info<< "Time scales min/max:" << endl; + // The old reciprocal time scale field, with any damping factor + tmp rDeltaT0_damped; - // Cache old reciprocal time scale field - volScalarField rDeltaT0("rDeltaT0", rDeltaT); + // Calculate damped value before applying any other changes + if + ( + rDeltaTDampingCoeff < 1 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT); + } + + + Info<< "Time scales min/max:" << endl; // Flow time scale { @@ -67,12 +78,14 @@ License /((2*maxCo)*mesh.V()*rho()) ); - // Limit the largest time scale - rDeltaT.max(1/maxDeltaT); + // Limit the largest time scale (=> smallest reciprocal time) + rDeltaT.clamp_min(1/maxDeltaT); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); Info<< " Flow = " - << gMin(1/rDeltaT.primitiveField()) << ", " - << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } // Reaction source time scale @@ -93,15 +106,13 @@ License ) ); - Info<< " Temperature = " - << gMin(1/(rDeltaTT.field() + VSMALL)) << ", " - << gMax(1/(rDeltaTT.field() + VSMALL)) << endl; + rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT); - rDeltaT.ref() = max - ( - rDeltaT(), - rDeltaTT - ); + auto limits = gMinMax(rDeltaTT.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< " Temperature = " + << limits.min() << ", " << limits.max() << endl; } // Update tho boundary values of the reciprocal time-step @@ -113,25 +124,19 @@ License fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } - // Limit rate of change of time scale + // Limit rate of change of time scale (=> smallest reciprocal time) // - reduce as much as required // - only increase at a fraction of old time scale - if - ( - rDeltaTDampingCoeff < 1.0 - && runTime.timeIndex() > runTime.startTimeIndex() + 1 - ) + if (rDeltaT0_damped) { - rDeltaT = max - ( - rDeltaT, - (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0 - ); + rDeltaT.clamp_min(rDeltaT0_damped()); } + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< " Overall = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/setMultiRegionDeltaT.H b/applications/solvers/lagrangian/reactingParcelFoam/setMultiRegionDeltaT.H index 70d55cb8c8..1257447f3e 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/setMultiRegionDeltaT.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/setMultiRegionDeltaT.H @@ -36,13 +36,18 @@ Description if (adjustTimeStep) { const scalar maxDeltaTFact = - min(maxCo/(CoNum + SMALL), maxCo/(surfaceFilm.CourantNumber() + SMALL)); + Foam::min + ( + maxCo/(CoNum + SMALL), + maxCo/(surfaceFilm.CourantNumber() + SMALL) + ); + const scalar deltaTFact = - min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H b/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H index 5977b18fe6..42e187ed3c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,10 +54,21 @@ License scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05)); - Info<< "Time scales min/max:" << endl; + // The old reciprocal time scale field, with any damping factor + tmp rDeltaT0_damped; - // Cache old reciprocal time scale field - volScalarField rDeltaT0("rDeltaT0", rDeltaT); + // Calculate damped value before applying any other changes + if + ( + rDeltaTDampingCoeff < 1 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT); + } + + + Info<< "Time scales min/max:" << endl; // Flow time scale { @@ -67,12 +78,14 @@ License /((2*maxCo)*mesh.V()*rho()) ); - // Limit the largest time scale - rDeltaT.max(1/maxDeltaT); + // Limit the largest time scale (=> smallest reciprocal time) + rDeltaT.clamp_min(1/maxDeltaT); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); Info<< " Flow = " - << gMin(1/rDeltaT.primitiveField()) << ", " - << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } // Reaction source time scale @@ -92,15 +105,13 @@ License ) ); - Info<< " Temperature = " - << gMin(1/(rDeltaTT.field() + VSMALL)) << ", " - << gMax(1/(rDeltaTT.field() + VSMALL)) << endl; + rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT); - rDeltaT.ref() = max - ( - rDeltaT(), - rDeltaTT - ); + auto limits = gMinMax(rDeltaTT.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< " Temperature = " + << limits.min() << ", " << limits.max() << endl; } // Update the boundary values of the reciprocal time-step @@ -112,25 +123,22 @@ License fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } - // Limit rate of change of time scale + // Limit rate of change of time scale (=> smallest reciprocal time) // - reduce as much as required // - only increase at a fraction of old time scale - if - ( - rDeltaTDampingCoeff < 1.0 - && runTime.timeIndex() > runTime.startTimeIndex() + 1 - ) + if (rDeltaT0_damped) { - rDeltaT = max - ( - rDeltaT, - (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0 - ); + rDeltaT.clamp_min(rDeltaT0_damped()); } + // Update the boundary values of the reciprocal time-step + rDeltaT.correctBoundaryConditions(); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< " Overall = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H index 1ce5db0ec8..2b3d264c62 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H @@ -48,8 +48,7 @@ U.correctBoundaryConditions(); fvOptions.correct(U); rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl; diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/pEqn.H b/applications/solvers/lagrangian/simpleCoalParcelFoam/pEqn.H index 055eff6f0b..1c85828e24 100644 --- a/applications/solvers/lagrangian/simpleCoalParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/pEqn.H @@ -49,8 +49,7 @@ fvOptions.correct(U); rho = thermo.rho(); - rho = max(rho, rhoMin); - rho = min(rho, rhoMax); + rho.clamp_range(rhoMin, rhoMax); rho.relax(); Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl; diff --git a/applications/solvers/lagrangian/sprayFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/pEqn.H index 198bf00d52..fbdcc57790 100644 --- a/applications/solvers/lagrangian/sprayFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/pEqn.H @@ -1,6 +1,5 @@ rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); volScalarField rAU(1.0/UEqn.A()); @@ -94,8 +93,7 @@ p.relax(); // Recalculate density from the relaxed pressure rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl; diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H index a7850a5e90..92bd8c2564 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H @@ -1,6 +1,5 @@ rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); volScalarField rAU(1.0/UEqn.A()); @@ -94,8 +93,7 @@ p.relax(); // Recalculate density from the relaxed pressure rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl; diff --git a/applications/solvers/multiphase/VoF/setDeltaT.H b/applications/solvers/multiphase/VoF/setDeltaT.H index ac59647e7e..79fbe90c4f 100644 --- a/applications/solvers/multiphase/VoF/setDeltaT.H +++ b/applications/solvers/multiphase/VoF/setDeltaT.H @@ -36,13 +36,14 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = - min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL)); + Foam::min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL)); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/multiphase/VoF/setRDeltaT.H b/applications/solvers/multiphase/VoF/setRDeltaT.H index 313fca2e33..bcc6e3b56d 100644 --- a/applications/solvers/multiphase/VoF/setRDeltaT.H +++ b/applications/solvers/multiphase/VoF/setRDeltaT.H @@ -53,6 +53,21 @@ pimpleDict.getOrDefault("maxDeltaT", GREAT) ); + + // The old reciprocal time scale field, with any damping factor + tmp rDeltaT0_damped; + + // Calculate damped value before applying any other changes + if + ( + rDeltaTDampingCoeff < 1 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT); + } + + volScalarField rDeltaT0("rDeltaT0", rDeltaT); // Set the reciprocal time-step from the local Courant number @@ -83,10 +98,13 @@ // Update tho boundary values of the reciprocal time-step rDeltaT.correctBoundaryConditions(); - Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } if (rDeltaTSmoothingCoeff < 1.0) { fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); @@ -110,27 +128,25 @@ fvc::sweep(rDeltaT, alpha1, nAlphaSweepIter, alphaSpreadDiff); } - Info<< "Smoothed flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); - // Limit rate of change of time scale + Info<< "Smoothed flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } + + // Limit rate of change of time scale (=> smallest reciprocal time) // - reduce as much as required // - only increase at a fraction of old time scale - if - ( - rDeltaTDampingCoeff < 1.0 - && runTime.timeIndex() > runTime.startTimeIndex() + 1 - ) + if (rDeltaT0_damped) { - rDeltaT = max - ( - rDeltaT, - (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0 - ); + rDeltaT.clamp_min(rDeltaT0_damped()); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); Info<< "Damped flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } } diff --git a/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H b/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H index e1e7427fe0..1d2dd28f6b 100644 --- a/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H +++ b/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H @@ -36,13 +36,14 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = - min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL)); + Foam::min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL)); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/multiphase/cavitatingFoam/setInitialDeltaT.H b/applications/solvers/multiphase/cavitatingFoam/setInitialDeltaT.H index 69fbe57333..435b2e4b0b 100644 --- a/applications/solvers/multiphase/cavitatingFoam/setInitialDeltaT.H +++ b/applications/solvers/multiphase/cavitatingFoam/setInitialDeltaT.H @@ -37,11 +37,15 @@ if (adjustTimeStep) if (CoNum > SMALL) { scalar maxDeltaTFact = - min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL)); + Foam::min + ( + maxCo/(CoNum + SMALL), + maxAcousticCo/(acousticCoNum + SMALL) + ); runTime.setDeltaT ( - min + Foam::min ( maxDeltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H b/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H index ce2e552001..cc698aefed 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H @@ -26,12 +26,12 @@ forAll(dgdt, celli) { if (dgdt[celli] > 0.0) { - Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); - Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); + Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); + Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); } else if (dgdt[celli] < 0.0) { - Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); + Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4); } } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C index b0c52f0f62..e3e2d7ee5f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C @@ -210,7 +210,7 @@ void VoFPatchTransfer::correct film().toRegion(patchi, Vp); const polyPatch& pp = pbm[patchi]; - const labelList& faceCells = pp.faceCells(); + const labelUList& faceCells = pp.faceCells(); // Accumulate the total mass removed from patch scalar dMassPatch = 0; diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaSuSp.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaSuSp.H index 65c5750ff9..457f40891a 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaSuSp.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaSuSp.H @@ -26,12 +26,12 @@ forAll(dgdt, celli) { if (dgdt[celli] > 0.0) { - Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); - Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); + Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); + Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); } else if (dgdt[celli] < 0.0) { - Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); + Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4); } } diff --git a/applications/solvers/multiphase/compressibleInterFoam/overCompressibleInterDyMFoam/alphaSuSp.H b/applications/solvers/multiphase/compressibleInterFoam/overCompressibleInterDyMFoam/alphaSuSp.H index 65c5750ff9..457f40891a 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/overCompressibleInterDyMFoam/alphaSuSp.H +++ b/applications/solvers/multiphase/compressibleInterFoam/overCompressibleInterDyMFoam/alphaSuSp.H @@ -26,12 +26,12 @@ forAll(dgdt, celli) { if (dgdt[celli] > 0.0) { - Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); - Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); + Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); + Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); } else if (dgdt[celli] < 0.0) { - Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); + Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4); } } diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/setDeltaT.H b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/setDeltaT.H index 026fb506bb..9a67a63d13 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/setDeltaT.H +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/setDeltaT.H @@ -36,13 +36,13 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = - min + Foam::min ( maxCo/(CoNum + SMALL), - min + Foam::min ( maxAlphaCo/(alphaCoNum + SMALL), - min + Foam::min ( maxAlphaDdt/(ddtAlphaNum + SMALL), maxDi/(DiNum + SMALL) @@ -50,16 +50,18 @@ if (adjustTimeStep) ) ); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT ) ); + Info<< "deltaT = " << runTime.deltaTValue() << endl; } diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H index 7df3631b04..9af4e28691 100644 --- a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H @@ -65,7 +65,7 @@ dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0); const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); + const labelUList& cellTypes = overlap.cellTypes(); const labelIOList& zoneIDs = overlap.zoneID(); while (pimple.correctNonOrthogonal()) diff --git a/applications/solvers/multiphase/reactingMultiphaseEulerFoam/setRDeltaT.H b/applications/solvers/multiphase/reactingMultiphaseEulerFoam/setRDeltaT.H index 1d0c65b153..c15dfe4a9f 100644 --- a/applications/solvers/multiphase/reactingMultiphaseEulerFoam/setRDeltaT.H +++ b/applications/solvers/multiphase/reactingMultiphaseEulerFoam/setRDeltaT.H @@ -38,7 +38,9 @@ fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/CourantNos.H b/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/CourantNos.H index 13c45ad51c..1bd1d9d036 100644 --- a/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/CourantNos.H +++ b/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/CourantNos.H @@ -8,5 +8,5 @@ Info<< "Max Ur Courant Number = " << UrCoNum << endl; - CoNum = max(CoNum, UrCoNum); + CoNum = Foam::max(CoNum, UrCoNum); } diff --git a/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/setRDeltaT.H b/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/setRDeltaT.H index 10a7c9e0f0..45d9e6c74a 100644 --- a/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/setRDeltaT.H +++ b/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/setRDeltaT.H @@ -31,7 +31,9 @@ fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/CourantNos.H b/applications/solvers/multiphase/twoPhaseEulerFoam/CourantNos.H index d828f32769..96e1ece1ac 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/CourantNos.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/CourantNos.H @@ -8,5 +8,5 @@ Info<< "Max Ur Courant Number = " << UrCoNum << endl; - CoNum = max(CoNum, UrCoNum); + CoNum = Foam::max(CoNum, UrCoNum); } diff --git a/applications/test/IOField/Test-IOField.cxx b/applications/test/IOField/Test-IOField.cxx index 96f91d5e7e..e9f6123e40 100644 --- a/applications/test/IOField/Test-IOField.cxx +++ b/applications/test/IOField/Test-IOField.cxx @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2019-2022 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -269,7 +269,7 @@ int main(int argc, char *argv[]) ioOutput.rename(args.executable() + "-labels"); Info<< "write " << ioOutput.objectRelPath() << endl; { - IOListRef