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 "faceSet.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
#include "emptyPolyPatch.H"
|
||||||
|
|
||||||
Foam::label Foam::checkTopology
|
Foam::label Foam::checkTopology
|
||||||
(
|
(
|
||||||
@ -21,6 +22,29 @@ Foam::label Foam::checkTopology
|
|||||||
// Check if the boundary definition is unique
|
// Check if the boundary definition is unique
|
||||||
mesh.boundaryMesh().checkDefinition(true);
|
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
|
// Check if the boundary processor patches are correct
|
||||||
mesh.boundaryMesh().checkParallelSync(true);
|
mesh.boundaryMesh().checkParallelSync(true);
|
||||||
|
|
||||||
@ -41,6 +65,8 @@ Foam::label Foam::checkTopology
|
|||||||
noFailedChecks++;
|
noFailedChecks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
pointSet points(mesh, "unusedPoints", mesh.nPoints()/100);
|
pointSet points(mesh, "unusedPoints", mesh.nPoints()/100);
|
||||||
if (mesh.checkPoints(true, &points))
|
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)
|
if (allTopology)
|
||||||
{
|
{
|
||||||
cellSet cells(mesh, "zipUpCells", mesh.nCells()/100);
|
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)
|
if (allTopology)
|
||||||
{
|
{
|
||||||
faceSet faces(mesh, "edgeFaces", mesh.nFaces()/100);
|
faceSet faces(mesh, "edgeFaces", mesh.nFaces()/100);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -138,18 +138,21 @@ emptyFvPatchField<Type>::emptyFvPatchField
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void emptyFvPatchField<Type>::updateCoeffs()
|
void emptyFvPatchField<Type>::updateCoeffs()
|
||||||
{
|
{
|
||||||
if
|
//- Check moved to checkMesh. Test here breaks down if multiple empty
|
||||||
(
|
// patches.
|
||||||
this->patch().patch().size()
|
//if
|
||||||
% this->dimensionedInternalField().mesh().nCells()
|
//(
|
||||||
)
|
// 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"
|
// FatalErrorIn("emptyFvPatchField<Type>::updateCoeffs()")
|
||||||
" empty patch is not divisible by the number of cells."
|
// << "This mesh contains patches of type empty but is not"
|
||||||
<< exit(FatalError);
|
// << "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