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,8 +117,16 @@ 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]));
if (mag(SfdOwn + SfdNei) > ROOTVSMALL)
{
w[facei] = SfdNei/(SfdOwn + SfdNei); 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,15 +101,22 @@ void Foam::cellAspectRatio::calcAspectRatio()
} }
sumA /= cFaces.size(); sumA /= cFaces.size();
aRatio[celli] = 1.0;
if (sumA > ROOTVSMALL)
{
// Local length scale // Local length scale
const scalar length = cellVolumes[celli]/sumA; const scalar length = cellVolumes[celli]/sumA;
if (length > ROOTVSMALL)
{
// Max edge length // Max edge length
maxMag = Foam::sqrt(maxMag); 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)
{ {