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,24 +237,28 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
autoPtr<IOdictionary> qualDict;
|
PtrList<IOdictionary> qualDict(meshes.size());
|
||||||
if (meshQuality)
|
if (meshQuality)
|
||||||
{
|
{
|
||||||
qualDict.reset
|
forAll(meshes, meshi)
|
||||||
|
{
|
||||||
|
qualDict.set
|
||||||
(
|
(
|
||||||
|
meshi,
|
||||||
new IOdictionary
|
new IOdictionary
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"meshQualityDict",
|
"meshQualityDict",
|
||||||
mesh.time().system(),
|
meshes[meshi].time().system(),
|
||||||
mesh,
|
meshes[meshi],
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
autoPtr<surfaceWriter> surfWriter;
|
autoPtr<surfaceWriter> surfWriter;
|
||||||
@ -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,6 +291,10 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
forAll(meshes, meshi)
|
||||||
|
{
|
||||||
|
const auto& mesh = meshes[meshi];
|
||||||
|
|
||||||
// Reconstruct globalMeshData
|
// Reconstruct globalMeshData
|
||||||
mesh.globalData();
|
mesh.globalData();
|
||||||
|
|
||||||
@ -303,12 +324,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (meshQuality)
|
if (meshQuality)
|
||||||
{
|
{
|
||||||
nFailedChecks += checkMeshQuality(mesh, qualDict(), surfWriter);
|
nFailedChecks +=
|
||||||
|
checkMeshQuality(mesh, qualDict[meshi], surfWriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Note: no reduction in nFailedChecks necessary since is
|
// Note: no reduction in nFailedChecks necessary since is
|
||||||
// counter of checks, not counter of failed cells,faces etc.
|
// counter of checks, not counter of failed cells,faces
|
||||||
|
// etc.
|
||||||
|
|
||||||
if (nFailedChecks == 0)
|
if (nFailedChecks == 0)
|
||||||
{
|
{
|
||||||
@ -324,10 +347,15 @@ int main(int argc, char *argv[])
|
|||||||
// Write selected fields
|
// Write selected fields
|
||||||
Foam::writeFields(mesh, selectedFields, writeFaceFields);
|
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;
|
||||||
|
|
||||||
|
forAll(meshes, meshi)
|
||||||
|
{
|
||||||
|
const auto& mesh = meshes[meshi];
|
||||||
|
|
||||||
label nFailedChecks = checkGeometry
|
label nFailedChecks = checkGeometry
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
@ -338,7 +366,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (meshQuality)
|
if (meshQuality)
|
||||||
{
|
{
|
||||||
nFailedChecks += checkMeshQuality(mesh, qualDict(), surfWriter);
|
nFailedChecks +=
|
||||||
|
checkMeshQuality(mesh, qualDict[meshi], surfWriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -357,6 +386,7 @@ int main(int argc, char *argv[])
|
|||||||
Foam::writeFields(mesh, selectedFields, writeFaceFields);
|
Foam::writeFields(mesh, selectedFields, writeFaceFields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
|||||||
@ -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>());
|
||||||
|
|||||||
@ -57,6 +57,8 @@ Description
|
|||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
#include "processorMeshes.H"
|
#include "processorMeshes.H"
|
||||||
#include "hexRef8Data.H"
|
#include "hexRef8Data.H"
|
||||||
|
#include "regionProperties.H"
|
||||||
|
#include "polyMeshTools.H"
|
||||||
|
|
||||||
#ifdef HAVE_ZOLTAN
|
#ifdef HAVE_ZOLTAN
|
||||||
#include "zoltanRenumber.H"
|
#include "zoltanRenumber.H"
|
||||||
@ -613,7 +615,7 @@ int main(int argc, char *argv[])
|
|||||||
"Renumber mesh cells to reduce the bandwidth"
|
"Renumber mesh cells to reduce the bandwidth"
|
||||||
);
|
);
|
||||||
|
|
||||||
#include "addRegionOption.H"
|
#include "addAllRegionOptions.H"
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
#include "addTimeOptions.H"
|
#include "addTimeOptions.H"
|
||||||
|
|
||||||
@ -629,7 +631,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
#include "getAllRegionOptions.H"
|
||||||
|
|
||||||
// Force linker to include zoltan symbols. This section is only needed since
|
// Force linker to include zoltan symbols. This section is only needed since
|
||||||
// Zoltan is a static library
|
// Zoltan is a static library
|
||||||
@ -638,7 +640,6 @@ int main(int argc, char *argv[])
|
|||||||
(void)zoltanRenumber::typeName;
|
(void)zoltanRenumber::typeName;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Get times list
|
// Get times list
|
||||||
instantList Times = runTime.times();
|
instantList Times = runTime.times();
|
||||||
|
|
||||||
@ -647,14 +648,20 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
runTime.setTime(Times[startTime], startTime);
|
runTime.setTime(Times[startTime], startTime);
|
||||||
|
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMeshes.H"
|
||||||
|
|
||||||
const word oldInstance = mesh.pointsInstance();
|
|
||||||
|
|
||||||
const bool readDict = args.found("dict");
|
const bool readDict = args.found("dict");
|
||||||
const bool doFrontWidth = args.found("frontWidth");
|
const bool doFrontWidth = args.found("frontWidth");
|
||||||
const bool overwrite = args.found("overwrite");
|
const bool overwrite = args.found("overwrite");
|
||||||
|
|
||||||
|
|
||||||
|
for (fvMesh& mesh : meshes)
|
||||||
|
{
|
||||||
|
// Reset time in case of multiple meshes and not overwrite
|
||||||
|
runTime.setTime(Times[startTime], startTime);
|
||||||
|
|
||||||
|
const word oldInstance = mesh.pointsInstance();
|
||||||
|
|
||||||
label band;
|
label band;
|
||||||
scalar profile;
|
scalar profile;
|
||||||
scalar sumSqrIntersect;
|
scalar sumSqrIntersect;
|
||||||
@ -680,7 +687,8 @@ int main(int argc, char *argv[])
|
|||||||
)/mesh.globalData().nTotalCells()
|
)/mesh.globalData().nTotalCells()
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Mesh size: " << mesh.globalData().nTotalCells() << nl
|
Info<< "Mesh " << mesh.name()
|
||||||
|
<< " size: " << mesh.globalData().nTotalCells() << nl
|
||||||
<< "Before renumbering :" << nl
|
<< "Before renumbering :" << nl
|
||||||
<< " band : " << band << nl
|
<< " band : " << band << nl
|
||||||
<< " profile : " << profile << nl;
|
<< " profile : " << profile << nl;
|
||||||
@ -729,7 +737,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Info<< "Ordering cells into regions of size " << blockSize
|
Info<< "Ordering cells into regions of size " << blockSize
|
||||||
<< " (using decomposition);"
|
<< " (using decomposition);"
|
||||||
<< " ordering faces into region-internal and region-external."
|
<< " ordering faces into region-internal"
|
||||||
|
<< " and region-external."
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
if (blockSize < 0 || blockSize >= mesh.nCells())
|
if (blockSize < 0 || blockSize >= mesh.nCells())
|
||||||
@ -745,7 +754,8 @@ int main(int argc, char *argv[])
|
|||||||
orderPoints = renumberDict.getOrDefault("orderPoints", false);
|
orderPoints = renumberDict.getOrDefault("orderPoints", false);
|
||||||
if (orderPoints)
|
if (orderPoints)
|
||||||
{
|
{
|
||||||
Info<< "Ordering points into internal and boundary points." << nl
|
Info<< "Ordering points into internal and boundary points."
|
||||||
|
<< nl
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,7 +773,8 @@ int main(int argc, char *argv[])
|
|||||||
renumberPtr.reset(new CuthillMcKeeRenumber(renumberDict));
|
renumberPtr.reset(new CuthillMcKeeRenumber(renumberDict));
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Selecting renumberMethod " << renumberPtr().type() << nl << endl;
|
Info<< "Selecting renumberMethod " << renumberPtr().type() << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -996,7 +1007,8 @@ int main(int argc, char *argv[])
|
|||||||
if (reverseCellOrder[celli] != -1)
|
if (reverseCellOrder[celli] != -1)
|
||||||
{
|
{
|
||||||
bndCells[nBndCells] = celli;
|
bndCells[nBndCells] = celli;
|
||||||
bndCellMap[nBndCells++] = reverseCellOrder[celli];
|
bndCellMap[nBndCells++] =
|
||||||
|
reverseCellOrder[celli];
|
||||||
reverseCellOrder[celli] = -1;
|
reverseCellOrder[celli] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1018,7 +1030,8 @@ int main(int argc, char *argv[])
|
|||||||
newReverseCellOrder[origCelli] = --sortedI;
|
newReverseCellOrder[origCelli] = --sortedI;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Ordered all " << nBndCells << " cells with a coupled face"
|
Info<< "Ordered all " << nBndCells
|
||||||
|
<< " cells with a coupled face"
|
||||||
<< " to the end of the cell list, starting at " << sortedI
|
<< " to the end of the cell list, starting at " << sortedI
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
@ -1139,7 +1152,8 @@ int main(int argc, char *argv[])
|
|||||||
if (masterFacei == 0)
|
if (masterFacei == 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< " masterFacei:" << masterFacei << exit(FatalError);
|
<< " masterFacei:" << masterFacei
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1254,8 +1268,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (orderPoints)
|
if (orderPoints)
|
||||||
{
|
{
|
||||||
// Force edge calculation (since only reason that points would need to
|
// Force edge calculation (since only reason that points would
|
||||||
// be sorted)
|
// need to be sorted)
|
||||||
(void)mesh.edges();
|
(void)mesh.edges();
|
||||||
|
|
||||||
label nTotPoints = returnReduce
|
label nTotPoints = returnReduce
|
||||||
@ -1364,9 +1378,9 @@ int main(int argc, char *argv[])
|
|||||||
identity(mesh.nCells())
|
identity(mesh.nCells())
|
||||||
)().write();
|
)().write();
|
||||||
|
|
||||||
Info<< nl << "Written current cellID and origCellID as volScalarField"
|
Info<< nl
|
||||||
<< " for use in postprocessing."
|
<< "Written current cellID and origCellID as volScalarField"
|
||||||
<< nl << endl;
|
<< " for use in postprocessing." << nl << endl;
|
||||||
|
|
||||||
labelIOList
|
labelIOList
|
||||||
(
|
(
|
||||||
@ -1413,7 +1427,7 @@ int main(int argc, char *argv[])
|
|||||||
map().pointMap()
|
map().pointMap()
|
||||||
).write();
|
).write();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
|||||||
@ -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