ENH: checkMesh: write minPyrVol. Fixes #1543.

This commit is contained in:
mattijs
2020-01-06 13:59:16 +00:00
parent 28eb349a30
commit 0fc4b79dde
2 changed files with 64 additions and 0 deletions

View File

@ -161,6 +161,7 @@ int main(int argc, char *argv[])
"cellVolume",
"cellVolumeRatio",
"minTetVolume",
"minPyrVolume",
"cellRegion",
"wallDistance"
});

View File

@ -472,6 +472,69 @@ void Foam::writeFields
minTetVolume.write();
}
// minPyrVolume
if (selectedFields.found("minPyrVolume"))
{
volScalarField minPyrVolume
(
IOobject
(
"minPyrVolume",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("minPyrVolume", dimless, GREAT),
zeroGradientFvPatchScalarField::typeName
);
// Get owner and neighbour pyr volumes
scalarField ownPyrVol(mesh.nFaces());
scalarField neiPyrVol(mesh.nInternalFaces());
primitiveMeshTools::facePyramidVolume
(
mesh,
mesh.points(),
mesh.cellCentres(),
ownPyrVol,
neiPyrVol
);
// Get min pyr vol per cell
scalarField& cellFld = minPyrVolume.ref();
cellFld = GREAT;
const labelUList& own = mesh.owner();
const labelUList& nei = mesh.neighbour();
// Internal faces
forAll(own, facei)
{
cellFld[own[facei]] = min(cellFld[own[facei]], ownPyrVol[facei]);
cellFld[nei[facei]] = min(cellFld[nei[facei]], neiPyrVol[facei]);
}
// Patch faces
for (const auto& fvp : minPyrVolume.boundaryField())
{
const labelUList& fc = fvp.patch().faceCells();
forAll(fc, i)
{
const label meshFacei = fvp.patch().start();
cellFld[fc[i]] = min(cellFld[fc[i]], ownPyrVol[meshFacei]);
}
}
minPyrVolume.correctBoundaryConditions();
Info<< " Writing minPyrVolume to " << minPyrVolume.name() << endl;
minPyrVolume.write();
}
if (selectedFields.found("cellRegion"))
{
volScalarField cellRegion