Skip to content
Snippets Groups Projects
Commit 239c96bf authored by mattijs's avatar mattijs
Browse files

ENH: checkMesh: minTetVolume field. Fixes #763.

parent 69ebe127
No related merge requests found
......@@ -149,6 +149,7 @@ int main(int argc, char *argv[])
selectedFields.insert("cellShapes");
selectedFields.insert("cellVolume");
selectedFields.insert("cellVolumeRatio");
selectedFields.insert("minTetVolume");
}
......
......@@ -3,6 +3,7 @@
#include "polyMeshTools.H"
#include "zeroGradientFvPatchFields.H"
#include "syncTools.H"
#include "tetPointRef.H"
using namespace Foam;
......@@ -273,6 +274,7 @@ void Foam::writeFields
// cell type
// ~~~~~~~~~
if (selectedFields.found("cellShapes"))
{
volScalarField shape
......@@ -356,5 +358,72 @@ void Foam::writeFields
cellVolumeRatio.write();
}
// minTetVolume
if (selectedFields.found("minTetVolume"))
{
volScalarField minTetVolume
(
IOobject
(
"minTetVolume",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("minTetVolume", dimless, GREAT),
zeroGradientFvPatchScalarField::typeName
);
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
const pointField& p = mesh.points();
forAll(own, facei)
{
const face& f = mesh.faces()[facei];
const point& fc = mesh.faceCentres()[facei];
{
const point& ownCc = mesh.cellCentres()[own[facei]];
scalar& ownVol = minTetVolume[own[facei]];
forAll(f, fp)
{
scalar tetQual = tetPointRef
(
p[f[fp]],
p[f.nextLabel(fp)],
ownCc,
fc
).quality();
ownVol = min(ownVol, tetQual);
}
}
if (mesh.isInternalFace(facei))
{
const point& neiCc = mesh.cellCentres()[nei[facei]];
scalar& neiVol = minTetVolume[nei[facei]];
forAll(f, fp)
{
scalar tetQual = tetPointRef
(
p[f[fp]],
p[f.nextLabel(fp)],
fc,
neiCc
).quality();
neiVol = min(neiVol, tetQual);
}
}
}
minTetVolume.correctBoundaryConditions();
Info<< " Writing minTetVolume to " << minTetVolume.name() << endl;
minTetVolume.write();
}
Info<< endl;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment