diff --git a/applications/utilities/finiteArea/checkFaMesh/checkFaMesh.C b/applications/utilities/finiteArea/checkFaMesh/checkFaMesh.C index 2aaede0be8..bb34931e9a 100644 --- a/applications/utilities/finiteArea/checkFaMesh/checkFaMesh.C +++ b/applications/utilities/finiteArea/checkFaMesh/checkFaMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,6 +46,8 @@ Original Authors #include "edgeFields.H" #include "processorFaPatch.H" #include "foamVtkIndPatchWriter.H" +#include "foamVtkLineWriter.H" +#include "faMeshTools.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,11 +68,27 @@ int main(int argc, char *argv[]) "Write mesh as a vtp (vtk) file for display or debugging" ); + argList::addOption + ( + "geometryOrder", + "N", + "Test different geometry order - experimental!!", + true // Advanced option + ); + #include "addRegionOption.H" #include "setRootCase.H" #include "createTime.H" #include "createNamedPolyMesh.H" + int geometryOrder(1); + if (args.readIfPresent("geometryOrder", geometryOrder)) + { + Info<< "Setting faMesh::geometryOrder = " << geometryOrder << nl + << "(experimental)" << nl << endl; + + faMesh::geometryOrder(geometryOrder); + } // Create faMesh aMesh(mesh); diff --git a/applications/utilities/finiteArea/checkFaMesh/faMeshWriteVTK.H b/applications/utilities/finiteArea/checkFaMesh/faMeshWriteVTK.H index 1df8b4d312..c6edf85a3e 100644 --- a/applications/utilities/finiteArea/checkFaMesh/faMeshWriteVTK.H +++ b/applications/utilities/finiteArea/checkFaMesh/faMeshWriteVTK.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -16,7 +16,7 @@ Description \*---------------------------------------------------------------------------*/ { - // finiteArea + // finiteArea - faces vtk::uindirectPatchWriter writer ( aMesh.patch(), @@ -29,9 +29,23 @@ Description writer.writeGeometry(); + globalIndex procAddr(aMesh.nFaces()); + labelList cellIDs; + + if (Pstream::master()) + { + cellIDs.resize(procAddr.totalSize()); + for (const labelRange& range : procAddr.ranges()) + { + auto slice = cellIDs.slice(range); + slice = identity(range); + } + } + // CellData - writer.beginCellData(3); + writer.beginCellData(4); writer.writeProcIDs(); + writer.write("cellID", cellIDs); writer.write("area", aMesh.S().field()); writer.write("normal", aMesh.faceAreaNormals()); @@ -43,5 +57,79 @@ Description << "Wrote faMesh in vtk format: " << writer.output().name() << nl; } +{ + // finiteArea - edges + vtk::lineWriter writer + ( + aMesh.points(), + aMesh.edges(), + // vtk::formatType::INLINE_ASCII, + fileName + ( + aMesh.mesh().time().globalPath() / "finiteArea-edges" + ) + ); + + writer.writeGeometry(); + + // CellData + writer.beginCellData(4); + writer.writeProcIDs(); + { + // Use primitive patch order + Field fld + ( + faMeshTools::flattenEdgeField(aMesh.magLe(), true) + ); + writer.write("magLe", fld); + } + + // PointData + writer.beginPointData(1); + writer.write("normal", aMesh.pointAreaNormals()); + + Info<< nl + << "Wrote faMesh in vtk format: " << writer.output().name() << nl; +} + +{ + // finiteArea - edgeCentres + // (no other convenient way to display vectors on the edges) + vtk::lineWriter writer + ( + aMesh.edgeCentres(), + edgeList::null(), + // vtk::formatType::INLINE_ASCII, + fileName + ( + aMesh.mesh().time().globalPath() / "finiteArea-edgesCentres" + ) + ); + + writer.writeGeometry(); + + // PointData + writer.beginPointData(4); + { + // Use primitive patch order + Field fld + ( + faMeshTools::flattenEdgeField(aMesh.Le(), true) + ); + writer.write("Le", fld); + } + { + // Use primitive patch order + Field fld + ( + faMeshTools::flattenEdgeField(aMesh.edgeAreaNormals(), true) + ); + writer.write("normal", fld); + } + + Info<< nl + << "Wrote faMesh in vtk format: " << writer.output().name() << nl; +} + // ************************************************************************* // diff --git a/applications/utilities/finiteArea/checkFaMesh/printMeshSummary.H b/applications/utilities/finiteArea/checkFaMesh/printMeshSummary.H index 256d2b1371..e3d255d961 100644 --- a/applications/utilities/finiteArea/checkFaMesh/printMeshSummary.H +++ b/applications/utilities/finiteArea/checkFaMesh/printMeshSummary.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -20,24 +20,7 @@ Description const label nNonProcessor = patches.nNonProcessor(); const label nPatches = patches.size(); - Info<< "----------------" << nl - << "Mesh Information" << nl - << "----------------" << nl - << " " << "boundingBox: " << boundBox(aMesh.points()) << nl; - - Info<< " Number of points: " - << returnReduce(aMesh.nPoints(), sumOp