pplications/solvers::*CourantNo: Removed unnecessary nInternalFaces() test

Resolves bug-report https://bugs.openfoam.org/view.php?id=3929
This commit is contained in:
Henry Weller
2022-11-10 14:49:50 +00:00
parent e1c0207695
commit f088d89127
7 changed files with 56 additions and 80 deletions

View File

@ -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;

View File

@ -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;
// ************************************************************************* //

View File

@ -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;
// ************************************************************************* //

View File

@ -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;
// ************************************************************************* //

View File

@ -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;
// ************************************************************************* //

View File

@ -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<scalar>("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;
// ************************************************************************* //

View File

@ -33,6 +33,11 @@ Description
if (adjustTimeStep)
{
const scalar maxAlphaCo
(
runTime.controlDict().lookup<scalar>("maxAlphaCo")
);
scalar deltaT = 1.2*runTime.deltaTValue();
if (CoNum > small)