ENH: checkMesh: add stabilisation. Fixes #2171

This commit is contained in:
mattijs
2021-07-28 17:56:48 +01:00
parent 9ab8c525cf
commit 60aeca32a8
3 changed files with 25 additions and 10 deletions

View File

@ -180,7 +180,7 @@ void Foam::writeFields
( (
radToDeg radToDeg
( (
Foam::acos(min(scalar(1), faceOrthogonality)) Foam::acos(min(scalar(1), max(scalar(-1), faceOrthogonality)))
) )
); );

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -117,7 +117,15 @@ Foam::tmp<Foam::surfaceScalarField> Foam::basicFvGeometryScheme::weights() const
// but the result will be poor. // but the result will be poor.
scalar SfdOwn = mag(Sf[facei] & (Cf[facei] - C[owner[facei]])); scalar SfdOwn = mag(Sf[facei] & (Cf[facei] - C[owner[facei]]));
scalar SfdNei = mag(Sf[facei] & (C[neighbour[facei]] - Cf[facei])); scalar SfdNei = mag(Sf[facei] & (C[neighbour[facei]] - Cf[facei]));
w[facei] = SfdNei/(SfdOwn + SfdNei);
if (mag(SfdOwn + SfdNei) > ROOTVSMALL)
{
w[facei] = SfdNei/(SfdOwn + SfdNei);
}
else
{
w[facei] = 0.5;
}
} }
surfaceScalarField::Boundary& wBf = weights.boundaryFieldRef(); surfaceScalarField::Boundary& wBf = weights.boundaryFieldRef();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -101,14 +101,21 @@ void Foam::cellAspectRatio::calcAspectRatio()
} }
sumA /= cFaces.size(); sumA /= cFaces.size();
// Local length scale aRatio[celli] = 1.0;
const scalar length = cellVolumes[celli]/sumA; if (sumA > ROOTVSMALL)
{
// Local length scale
const scalar length = cellVolumes[celli]/sumA;
// Max edge length if (length > ROOTVSMALL)
maxMag = Foam::sqrt(maxMag); {
// Max edge length
maxMag = Foam::sqrt(maxMag);
//aRatio[celli] = Foam::sqrt(4.0/3.0)*maxMag/length; //aRatio[celli] = Foam::sqrt(4.0/3.0)*maxMag/length;
aRatio[celli] = 2.0*maxMag/length; aRatio[celli] = 2.0*maxMag/length;
}
}
} }
if (debug) if (debug)