Commit a44a993d authored by mattijs's avatar mattijs
Browse files

ENH: emptyFvPatchField: moved check to checkMesh

It now handles multiple empty patches
parent da6239c9
......@@ -6,6 +6,7 @@
#include "faceSet.H"
#include "pointSet.H"
#include "IOmanip.H"
#include "emptyPolyPatch.H"
Foam::label Foam::checkTopology
(
......@@ -21,6 +22,29 @@ Foam::label Foam::checkTopology
// Check if the boundary definition is unique
mesh.boundaryMesh().checkDefinition(true);
// Check that empty patches cover all sides of the mesh
{
label nEmpty = 0;
forAll(mesh.boundaryMesh(), patchI)
{
if (isA<emptyPolyPatch>(mesh.boundaryMesh()[patchI]))
{
nEmpty += mesh.boundaryMesh()[patchI].size();
}
}
reduce(nEmpty, sumOp<label>());
label nTotCells = returnReduce(mesh.cells().size(), sumOp<label>());
// These are actually warnings, not errors.
if (nEmpty % nTotCells)
{
Info<< " ***Total number of faces on empty patches"
<< " is not divisible by the number of cells in the mesh."
<< " Hence this mesh is not 1D or 2D."
<< endl;
}
}
// Check if the boundary processor patches are correct
mesh.boundaryMesh().checkParallelSync(true);
......@@ -41,6 +65,8 @@ Foam::label Foam::checkTopology
noFailedChecks++;
}
{
pointSet points(mesh, "unusedPoints", mesh.nPoints()/100);
if (mesh.checkPoints(true, &points))
......@@ -74,6 +100,22 @@ Foam::label Foam::checkTopology
}
}
{
faceSet faces(mesh, "outOfRangeFaces", mesh.nFaces()/100);
if (mesh.checkFaceVertices(true, &faces))
{
noFailedChecks++;
label nFaces = returnReduce(faces.size(), sumOp<label>());
Info<< " <<Writing " << nFaces
<< " faces with out-of-range or duplicate vertices to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
if (allTopology)
{
cellSet cells(mesh, "zipUpCells", mesh.nCells()/100);
......@@ -91,22 +133,6 @@ Foam::label Foam::checkTopology
}
}
{
faceSet faces(mesh, "outOfRangeFaces", mesh.nFaces()/100);
if (mesh.checkFaceVertices(true, &faces))
{
noFailedChecks++;
label nFaces = returnReduce(faces.size(), sumOp<label>());
Info<< " <<Writing " << nFaces
<< " faces with out-of-range or duplicate vertices to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
if (allTopology)
{
faceSet faces(mesh, "edgeFaces", mesh.nFaces()/100);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -138,18 +138,21 @@ emptyFvPatchField<Type>::emptyFvPatchField
template<class Type>
void emptyFvPatchField<Type>::updateCoeffs()
{
if
(
this->patch().patch().size()
% this->dimensionedInternalField().mesh().nCells()
)
{
FatalErrorIn("emptyFvPatchField<Type>::updateCoeffs()")
<< "This mesh contains patches of type empty but is not 1D or 2D\n"
" by virtue of the fact that the number of faces of this\n"
" empty patch is not divisible by the number of cells."
<< exit(FatalError);
}
//- Check moved to checkMesh. Test here breaks down if multiple empty
// patches.
//if
//(
// this->patch().patch().size()
// % this->dimensionedInternalField().mesh().nCells()
//)
//{
// FatalErrorIn("emptyFvPatchField<Type>::updateCoeffs()")
// << "This mesh contains patches of type empty but is not"
// << "1D or 2D\n"
// " by virtue of the fact that the number of faces of this\n"
// " empty patch is not divisible by the number of cells."
// << exit(FatalError);
//}
}
......
Supports Markdown
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