mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: emptyFvPatchField: moved check to checkMesh
It now handles multiple empty patches
This commit is contained in:
@ -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);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user