mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: checkMesh: minTetVolume field. Fixes #763.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user