diff --git a/applications/solvers/combustion/XiFoam/PDRFoam/StCourantNo.H b/applications/solvers/combustion/XiFoam/PDRFoam/StCourantNo.H index 65ee2e2b1e..6e175de5b6 100644 --- a/applications/solvers/combustion/XiFoam/PDRFoam/StCourantNo.H +++ b/applications/solvers/combustion/XiFoam/PDRFoam/StCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,21 +30,16 @@ Description \*---------------------------------------------------------------------------*/ { - scalar meanStCoNum = 0.0; + const scalarField sumPhi + ( + fvc::surfaceSum(mag(phiSt))().primitiveField() + /rho.primitiveField() + ); - if (mesh.nInternalFaces()) - { - scalarField sumPhi - ( - fvc::surfaceSum(mag(phiSt))().primitiveField() - / rho.primitiveField() - ); + StCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); - StCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); - - meanStCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); - } + const scalar meanStCoNum = + 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); Info<< "St courant Number mean: " << meanStCoNum << " max: " << StCoNum << endl; diff --git a/applications/solvers/compressible/rhoCentralFoam/centralCourantNo.H b/applications/solvers/compressible/rhoCentralFoam/centralCourantNo.H index 551a1a0175..3b7c1bc745 100644 --- a/applications/solvers/compressible/rhoCentralFoam/centralCourantNo.H +++ b/applications/solvers/compressible/rhoCentralFoam/centralCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,17 +29,16 @@ Description \*---------------------------------------------------------------------------*/ -if (mesh.nInternalFaces()) { - scalarField sumAmaxSf(fvc::surfaceSum(amaxSf)().primitiveField()); + const scalarField sumAmaxSf(fvc::surfaceSum(amaxSf)().primitiveField()); CoNum = 0.5*gMax(sumAmaxSf/mesh.V().field())*runTime.deltaTValue(); meanCoNum = 0.5*(gSum(sumAmaxSf)/gSum(mesh.V().field()))*runTime.deltaTValue(); + + Info<< "Mean and max Courant Numbers = " + << meanCoNum << " " << CoNum << endl; } -Info<< "Mean and max Courant Numbers = " - << meanCoNum << " " << CoNum << endl; - // ************************************************************************* // diff --git a/applications/solvers/incompressible/shallowWaterFoam/CourantNo.H b/applications/solvers/incompressible/shallowWaterFoam/CourantNo.H index e165f703b9..d8b64271a6 100644 --- a/applications/solvers/incompressible/shallowWaterFoam/CourantNo.H +++ b/applications/solvers/incompressible/shallowWaterFoam/CourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,39 +29,33 @@ Description \*---------------------------------------------------------------------------*/ - -scalar CoNum = 0.0; -scalar meanCoNum = 0.0; -scalar waveCoNum = 0.0; - -if (mesh.nInternalFaces()) { - scalarField sumPhi + const scalarField sumPhi ( fvc::surfaceSum(mag(phi))().primitiveField() - / h.primitiveField() + /h.primitiveField() ); - CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + const scalar CoNum = + 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); - meanCoNum = + const scalar meanCoNum = 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); // Gravity wave Courant number - waveCoNum = 0.25*gMax + const scalar waveCoNum = 0.25*gMax ( fvc::surfaceSum ( fvc::interpolate(sqrt(h))*mesh.magSf() )().primitiveField()/mesh.V().field() )*sqrt(magg).value()*runTime.deltaTValue(); + + Info<< "Courant number mean: " << meanCoNum + << " max: " << CoNum << endl; + + Info<< "Gravity wave Courant number max: " << waveCoNum + << endl; } -Info<< "Courant number mean: " << meanCoNum - << " max: " << CoNum << endl; - -Info<< "Gravity wave Courant number max: " << waveCoNum - << endl; - - // ************************************************************************* // diff --git a/applications/solvers/lagrangian/denseParticleFoam/CourantNo.H b/applications/solvers/lagrangian/denseParticleFoam/CourantNo.H index f0ef70106c..63c2e2bb63 100644 --- a/applications/solvers/lagrangian/denseParticleFoam/CourantNo.H +++ b/applications/solvers/lagrangian/denseParticleFoam/CourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,23 +29,18 @@ Description \*---------------------------------------------------------------------------*/ -scalar CoNum = 0.0; -scalar meanCoNum = 0.0; +scalar CoNum = 0; -if (mesh.nInternalFaces()) { - scalarField sumPhi - ( - fvc::surfaceSum(mag(phic))().primitiveField() - ); + const scalarField sumPhi(fvc::surfaceSum(mag(phic))().primitiveField()); CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); - meanCoNum = + const scalar meanCoNum = 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + + Info<< "Courant Number mean: " << meanCoNum + << " max: " << CoNum << endl; } -Info<< "Courant Number mean: " << meanCoNum - << " max: " << CoNum << endl; - // ************************************************************************* // diff --git a/applications/solvers/multiphase/cavitatingFoam/CourantNo.H b/applications/solvers/multiphase/cavitatingFoam/CourantNo.H index 8704d02b16..deeec2c66a 100644 --- a/applications/solvers/multiphase/cavitatingFoam/CourantNo.H +++ b/applications/solvers/multiphase/cavitatingFoam/CourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,20 +29,15 @@ Description \*---------------------------------------------------------------------------*/ -scalar CoNum = 0.0; -scalar meanCoNum = 0.0; -scalar acousticCoNum = 0.0; +scalar CoNum = 0; +scalar acousticCoNum = 0; -if (mesh.nInternalFaces()) { - scalarField sumPhi - ( - fvc::surfaceSum(mag(phi))().primitiveField() - ); + const scalarField sumPhi(fvc::surfaceSum(mag(phi))().primitiveField()); CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); - meanCoNum = + const scalar meanCoNum = 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); acousticCoNum = 0.5*gMax @@ -52,11 +47,11 @@ if (mesh.nInternalFaces()) fvc::interpolate(scalar(1)/sqrt(psi))*mesh.magSf() )().primitiveField()/mesh.V().field() )*runTime.deltaTValue(); + + Info<< "phi Courant Number mean: " << meanCoNum + << " max: " << CoNum + << " acoustic max: " << acousticCoNum + << endl; } -Info<< "phi Courant Number mean: " << meanCoNum - << " max: " << CoNum - << " acoustic max: " << acousticCoNum - << endl; - // ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseMixture/VoF/alphaCourantNo.H b/src/twoPhaseModels/twoPhaseMixture/VoF/alphaCourantNo.H index 95bb0a3682..cf0ae763a1 100644 --- a/src/twoPhaseModels/twoPhaseMixture/VoF/alphaCourantNo.H +++ b/src/twoPhaseModels/twoPhaseMixture/VoF/alphaCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,17 +29,10 @@ Description \*---------------------------------------------------------------------------*/ -scalar maxAlphaCo -( - runTime.controlDict().lookup("maxAlphaCo") -); +scalar alphaCoNum = 0; -scalar alphaCoNum = 0.0; -scalar meanAlphaCoNum = 0.0; - -if (mesh.nInternalFaces()) { - scalarField sumPhi + const scalarField sumPhi ( mixture.nearInterface()().primitiveField() *fvc::surfaceSum(mag(phi))().primitiveField() @@ -47,11 +40,11 @@ if (mesh.nInternalFaces()) alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); - meanAlphaCoNum = + const scalar meanAlphaCoNum = 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + + Info<< "Interface Courant Number mean: " << meanAlphaCoNum + << " max: " << alphaCoNum << endl; } -Info<< "Interface Courant Number mean: " << meanAlphaCoNum - << " max: " << alphaCoNum << endl; - // ************************************************************************* // diff --git a/src/twoPhaseModels/twoPhaseMixture/VoF/setDeltaT.H b/src/twoPhaseModels/twoPhaseMixture/VoF/setDeltaT.H index 4ec4138744..31e1d2ff9b 100644 --- a/src/twoPhaseModels/twoPhaseMixture/VoF/setDeltaT.H +++ b/src/twoPhaseModels/twoPhaseMixture/VoF/setDeltaT.H @@ -33,6 +33,11 @@ Description if (adjustTimeStep) { + const scalar maxAlphaCo + ( + runTime.controlDict().lookup("maxAlphaCo") + ); + scalar deltaT = 1.2*runTime.deltaTValue(); if (CoNum > small)