mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: checkMesh: -allRegions. See #2072
This commit is contained in:
@ -50,6 +50,9 @@ Usage
|
|||||||
- \par -region \<name\>
|
- \par -region \<name\>
|
||||||
Specify an alternative mesh region.
|
Specify an alternative mesh region.
|
||||||
|
|
||||||
|
- \par -allRegions
|
||||||
|
Check all regions in regionProperties.
|
||||||
|
|
||||||
\param -writeSets \<surfaceFormat\> \n
|
\param -writeSets \<surfaceFormat\> \n
|
||||||
Reconstruct all cellSets and faceSets geometry and write to postProcessing
|
Reconstruct all cellSets and faceSets geometry and write to postProcessing
|
||||||
directory according to surfaceFormat (e.g. vtk or ensight). Additionally
|
directory according to surfaceFormat (e.g. vtk or ensight). Additionally
|
||||||
@ -74,6 +77,8 @@ Usage
|
|||||||
#include "vtkSetWriter.H"
|
#include "vtkSetWriter.H"
|
||||||
#include "vtkSurfaceWriter.H"
|
#include "vtkSurfaceWriter.H"
|
||||||
#include "IOdictionary.H"
|
#include "IOdictionary.H"
|
||||||
|
#include "regionProperties.H"
|
||||||
|
#include "polyMeshTools.H"
|
||||||
|
|
||||||
#include "checkTools.H"
|
#include "checkTools.H"
|
||||||
#include "checkTopology.H"
|
#include "checkTopology.H"
|
||||||
@ -93,7 +98,8 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
timeSelector::addOptions();
|
timeSelector::addOptions();
|
||||||
#include "addRegionOption.H"
|
#include "addAllRegionOptions.H"
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noTopology",
|
"noTopology",
|
||||||
@ -139,8 +145,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
#include "getAllRegionOptions.H"
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMeshes.H"
|
||||||
|
|
||||||
const bool noTopology = args.found("noTopology");
|
const bool noTopology = args.found("noTopology");
|
||||||
const bool allGeometry = args.found("allGeometry");
|
const bool allGeometry = args.found("allGeometry");
|
||||||
@ -230,23 +237,27 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
autoPtr<IOdictionary> qualDict;
|
PtrList<IOdictionary> qualDict(meshes.size());
|
||||||
if (meshQuality)
|
if (meshQuality)
|
||||||
{
|
{
|
||||||
qualDict.reset
|
forAll(meshes, meshi)
|
||||||
(
|
{
|
||||||
new IOdictionary
|
qualDict.set
|
||||||
(
|
(
|
||||||
IOobject
|
meshi,
|
||||||
|
new IOdictionary
|
||||||
(
|
(
|
||||||
"meshQualityDict",
|
IOobject
|
||||||
mesh.time().system(),
|
(
|
||||||
mesh,
|
"meshQualityDict",
|
||||||
IOobject::MUST_READ,
|
meshes[meshi].time().system(),
|
||||||
IOobject::NO_WRITE
|
meshes[meshi],
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -263,7 +274,13 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
runTime.setTime(timeDirs[timeI], timeI);
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
polyMesh::readUpdateState state = mesh.readUpdate();
|
// Get most changed of all meshes
|
||||||
|
polyMesh::readUpdateState state = polyMesh::UNCHANGED;
|
||||||
|
for (auto& mesh : meshes)
|
||||||
|
{
|
||||||
|
state = polyMeshTools::combine(state, mesh.readUpdate());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -274,87 +291,100 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
// Reconstruct globalMeshData
|
forAll(meshes, meshi)
|
||||||
mesh.globalData();
|
|
||||||
|
|
||||||
printMeshStats(mesh, allTopology);
|
|
||||||
|
|
||||||
label nFailedChecks = 0;
|
|
||||||
|
|
||||||
if (!noTopology)
|
|
||||||
{
|
{
|
||||||
nFailedChecks += checkTopology
|
const auto& mesh = meshes[meshi];
|
||||||
|
|
||||||
|
// Reconstruct globalMeshData
|
||||||
|
mesh.globalData();
|
||||||
|
|
||||||
|
printMeshStats(mesh, allTopology);
|
||||||
|
|
||||||
|
label nFailedChecks = 0;
|
||||||
|
|
||||||
|
if (!noTopology)
|
||||||
|
{
|
||||||
|
nFailedChecks += checkTopology
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
allTopology,
|
||||||
|
allGeometry,
|
||||||
|
surfWriter,
|
||||||
|
setWriter
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
nFailedChecks += checkGeometry
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
allTopology,
|
|
||||||
allGeometry,
|
allGeometry,
|
||||||
surfWriter,
|
surfWriter,
|
||||||
setWriter
|
setWriter
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (meshQuality)
|
||||||
|
{
|
||||||
|
nFailedChecks +=
|
||||||
|
checkMeshQuality(mesh, qualDict[meshi], surfWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Note: no reduction in nFailedChecks necessary since is
|
||||||
|
// counter of checks, not counter of failed cells,faces
|
||||||
|
// etc.
|
||||||
|
|
||||||
|
if (nFailedChecks == 0)
|
||||||
|
{
|
||||||
|
Info<< "\nMesh OK.\n" << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write selected fields
|
||||||
|
Foam::writeFields(mesh, selectedFields, writeFaceFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
nFailedChecks += checkGeometry
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
allGeometry,
|
|
||||||
surfWriter,
|
|
||||||
setWriter
|
|
||||||
);
|
|
||||||
|
|
||||||
if (meshQuality)
|
|
||||||
{
|
|
||||||
nFailedChecks += checkMeshQuality(mesh, qualDict(), surfWriter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Note: no reduction in nFailedChecks necessary since is
|
|
||||||
// counter of checks, not counter of failed cells,faces etc.
|
|
||||||
|
|
||||||
if (nFailedChecks == 0)
|
|
||||||
{
|
|
||||||
Info<< "\nMesh OK.\n" << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write selected fields
|
|
||||||
Foam::writeFields(mesh, selectedFields, writeFaceFields);
|
|
||||||
}
|
}
|
||||||
else if (state == polyMesh::POINTS_MOVED)
|
else if (state == polyMesh::POINTS_MOVED)
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
label nFailedChecks = checkGeometry
|
forAll(meshes, meshi)
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
allGeometry,
|
|
||||||
surfWriter,
|
|
||||||
setWriter
|
|
||||||
);
|
|
||||||
|
|
||||||
if (meshQuality)
|
|
||||||
{
|
{
|
||||||
nFailedChecks += checkMeshQuality(mesh, qualDict(), surfWriter);
|
const auto& mesh = meshes[meshi];
|
||||||
|
|
||||||
|
label nFailedChecks = checkGeometry
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
allGeometry,
|
||||||
|
surfWriter,
|
||||||
|
setWriter
|
||||||
|
);
|
||||||
|
|
||||||
|
if (meshQuality)
|
||||||
|
{
|
||||||
|
nFailedChecks +=
|
||||||
|
checkMeshQuality(mesh, qualDict[meshi], surfWriter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (nFailedChecks)
|
||||||
|
{
|
||||||
|
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "\nMesh OK.\n" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write selected fields
|
||||||
|
Foam::writeFields(mesh, selectedFields, writeFaceFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (nFailedChecks)
|
|
||||||
{
|
|
||||||
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "\nMesh OK.\n" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write selected fields
|
|
||||||
Foam::writeFields(mesh, selectedFields, writeFaceFields);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -50,10 +50,18 @@ License
|
|||||||
|
|
||||||
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
|
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
|
||||||
{
|
{
|
||||||
Info<< "Mesh stats" << nl
|
if (mesh.name() == Foam::polyMesh::defaultRegion)
|
||||||
<< " points: "
|
{
|
||||||
|
Info<< "Mesh stats" << nl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Mesh " << mesh.name() << " stats" << nl;
|
||||||
|
}
|
||||||
|
Info<< " points: "
|
||||||
<< returnReduce(mesh.points().size(), sumOp<label>()) << nl;
|
<< returnReduce(mesh.points().size(), sumOp<label>()) << nl;
|
||||||
|
|
||||||
|
|
||||||
// Count number of internal points (-1 if not sorted; 0 if no internal
|
// Count number of internal points (-1 if not sorted; 0 if no internal
|
||||||
// points)
|
// points)
|
||||||
const label minInt = returnReduce(mesh.nInternalPoints(), minOp<label>());
|
const label minInt = returnReduce(mesh.nInternalPoints(), minOp<label>());
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -280,4 +281,35 @@ Foam::tmp<Foam::scalarField> Foam::polyMeshTools::volRatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::polyMesh::readUpdateState Foam::polyMeshTools::combine
|
||||||
|
(
|
||||||
|
const polyMesh::readUpdateState& state0,
|
||||||
|
const polyMesh::readUpdateState& state1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(
|
||||||
|
state0 == polyMesh::UNCHANGED
|
||||||
|
&& state1 != polyMesh::UNCHANGED
|
||||||
|
)
|
||||||
|
|| (
|
||||||
|
state0 == polyMesh::POINTS_MOVED
|
||||||
|
&& (state1 != polyMesh::UNCHANGED && state1 != polyMesh::POINTS_MOVED)
|
||||||
|
)
|
||||||
|
|| (
|
||||||
|
state0 == polyMesh::TOPO_CHANGE
|
||||||
|
&& state1 == polyMesh::TOPO_PATCH_CHANGE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return state1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return state0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2013 OpenFOAM Foundation
|
Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -92,6 +93,13 @@ public:
|
|||||||
const scalarField& vol
|
const scalarField& vol
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Combine readUpdateState. topo change trumps geom-only
|
||||||
|
// change etc.
|
||||||
|
static polyMesh::readUpdateState combine
|
||||||
|
(
|
||||||
|
const polyMesh::readUpdateState& state0,
|
||||||
|
const polyMesh::readUpdateState& state1
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user