diff --git a/.gitignore b/.gitignore index 43c7337ec1..1b8ce3cde3 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ linuxming*/ SiCortex*Gcc*/ solaris*Gcc*/ SunOS*Gcc*/ +platforms/ # reinstate wmake/rules that might look like build folders !wmake/rules/*/ diff --git a/ReleaseNotes-dev b/ReleaseNotes-dev index 227041536f..230a116826 100644 --- a/ReleaseNotes-dev +++ b/ReleaseNotes-dev @@ -104,6 +104,11 @@ taking film into account + Parallel aware *** *New* ptscotch decomposition method +*** *Updated* scotch decomposition method to run in parallel by doing + decomposition on the master. Unfortunately scotch and ptscotch cannot + be linked in to the same executable. +*** *Updated* simple decomposition method to run in parallel by doing + decomposition on the master. *** *Updated* decomposePar maps polyPatches instead of recreating them so polyPatches holding data can map the data. *** *Updated* particle tracking algorithm @@ -183,6 +188,9 @@ e.g. pitzDailyDirectMapped tutorial. + =setSet=: allows time range (e.g. 0:100) in combination with -batch argument to execute the commands for multiple times. + + =extrudeMesh=: + - option to add extrusion to existing mesh. + - works in parallel * Post-processing + =paraFoam=, =foamToVTK=: full support for polyhedral cell type in recent Paraview versions. diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H index cac8e52a8e..8f1ad9df8e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H @@ -2,8 +2,8 @@ word scheme("div(phi,alpha)"); word schemer("div(phir,alpha)"); - surfaceScalarField phic(phi); - surfaceScalarField phir(phia - phib); + surfaceScalarField phic("phic", phi); + surfaceScalarField phir("phir", phia - phib); if (g0.value() > 0.0) { @@ -41,7 +41,7 @@ alphaEqn.relax(); alphaEqn.solve(); -# include "packingLimiter.H" + #include "packingLimiter.H" beta = scalar(1) - alpha; diff --git a/applications/test/globalMeshData/Test-globalMeshData.C b/applications/test/globalMeshData/Test-globalMeshData.C index 6feaf5cc05..3c789748bf 100644 --- a/applications/test/globalMeshData/Test-globalMeshData.C +++ b/applications/test/globalMeshData/Test-globalMeshData.C @@ -70,7 +70,12 @@ int main(int argc, char *argv[]) ); // Exchange data. Apply positional transforms. - globalPointSlavesMap.distribute(transforms, coords, true); + globalPointSlavesMap.distribute + ( + transforms, + coords, + mapDistribute::transformPosition() + ); // Print forAll(slaves, pointI) @@ -127,7 +132,12 @@ int main(int argc, char *argv[]) } // Exchange data Apply positional transforms. - globalEdgeSlavesMap.distribute(transforms, ec, true); + globalEdgeSlavesMap.distribute + ( + transforms, + ec, + mapDistribute::transformPosition() + ); // Print forAll(slaves, edgeI) @@ -163,82 +173,131 @@ int main(int argc, char *argv[]) } - //// Test: (collocated) point to faces addressing - //{ - // const labelListList& globalPointBoundaryFaces = - // globalData.globalPointBoundaryFaces(); - // const mapDistribute& globalPointBoundaryFacesMap = - // globalData.globalPointBoundaryFacesMap(); - // - // label nBnd = mesh.nFaces()-mesh.nInternalFaces(); - // - // pointField fc(globalPointBoundaryFacesMap.constructSize()); - // SubList(fc, nBnd).assign - // ( - // primitivePatch - // ( - // SubList - // ( - // mesh.faces(), - // nBnd, - // mesh.nInternalFaces() - // ), - // mesh.points() - // ).faceCentres() - // ); - // - // // Exchange data - // globalPointBoundaryFacesMap.distribute(fc); - // - // // Print - // forAll(globalPointBoundaryFaces, pointI) - // { - // const labelList& bFaces = globalPointBoundaryFaces[pointI]; - // - // Pout<< "Point:" << pointI - // << " at:" << coupledPatch.localPoints()[pointI] - // << " connected to faces:" << endl; - // - // forAll(bFaces, i) - // { - // Pout<< " " << fc[bFaces[i]] << endl; - // } - // } - //} - // - // - //// Test:(collocated) point to cells addressing - //{ - // const labelList& boundaryCells = globalData.boundaryCells(); - // const labelListList& globalPointBoundaryCells = - // globalData.globalPointBoundaryCells(); - // const mapDistribute& globalPointBoundaryCellsMap = - // globalData.globalPointBoundaryCellsMap(); - // - // pointField cc(globalPointBoundaryCellsMap.constructSize()); - // forAll(boundaryCells, i) - // { - // cc[i] = mesh.cellCentres()[boundaryCells[i]]; - // } - // - // // Exchange data - // globalPointBoundaryCellsMap.distribute(cc); - // - // // Print - // forAll(globalPointBoundaryCells, pointI) - // { - // const labelList& bCells = globalPointBoundaryCells[pointI]; - // - // Pout<< "Point:" << pointI - // << " at:" << coupledPatch.localPoints()[pointI] - // << " connected to cells:" << endl; - // - // forAll(bCells, i) - // { - // Pout<< " " << cc[bCells[i]] << endl; - // } - // } - //} + // Test: point to faces addressing + { + const mapDistribute& globalPointBoundaryFacesMap = + globalData.globalPointBoundaryFacesMap(); + const labelListList& slaves = + globalData.globalPointBoundaryFaces(); + const labelListList& transformedSlaves = + globalData.globalPointTransformedBoundaryFaces(); + + label nBnd = mesh.nFaces()-mesh.nInternalFaces(); + + pointField fc(globalPointBoundaryFacesMap.constructSize()); + SubList(fc, nBnd).assign + ( + primitivePatch + ( + SubList + ( + mesh.faces(), + nBnd, + mesh.nInternalFaces() + ), + mesh.points() + ).faceCentres() + ); + + // Exchange data + globalPointBoundaryFacesMap.distribute + ( + transforms, + fc, + mapDistribute::transformPosition() + ); + + // Print + forAll(slaves, pointI) + { + const labelList& slaveFaces = slaves[pointI]; + + if (slaveFaces.size() > 0) + { + Pout<< "Master point:" << pointI + << " at:" << coupledPatch.localPoints()[pointI] + << " connected to " << slaveFaces.size() + << " untransformed faces:" << endl; + + forAll(slaveFaces, i) + { + Pout<< " " << fc[slaveFaces[i]] << endl; + } + } + + const labelList& transformedSlaveFaces = transformedSlaves[pointI]; + + if (transformedSlaveFaces.size() > 0) + { + Pout<< "Master point:" << pointI + << " connected to " << transformedSlaveFaces.size() + << " transformed faces:" << endl; + + forAll(transformedSlaveFaces, i) + { + Pout<< " " << fc[transformedSlaveFaces[i]] << endl; + } + } + } + } + + + // Test: point to cells addressing + { + const labelList& boundaryCells = globalData.boundaryCells(); + const mapDistribute& globalPointBoundaryCellsMap = + globalData.globalPointBoundaryCellsMap(); + const labelListList& slaves = globalData.globalPointBoundaryCells(); + const labelListList& transformedSlaves = + globalData.globalPointTransformedBoundaryCells(); + + pointField cc(globalPointBoundaryCellsMap.constructSize()); + forAll(boundaryCells, i) + { + cc[i] = mesh.cellCentres()[boundaryCells[i]]; + } + + // Exchange data + globalPointBoundaryCellsMap.distribute + ( + transforms, + cc, + mapDistribute::transformPosition() + ); + + // Print + forAll(slaves, pointI) + { + const labelList& pointCells = slaves[pointI]; + + if (pointCells.size() > 0) + { + Pout<< "Master point:" << pointI + << " at:" << coupledPatch.localPoints()[pointI] + << " connected to " << pointCells.size() + << " untransformed boundaryCells:" << endl; + + forAll(pointCells, i) + { + Pout<< " " << cc[pointCells[i]] << endl; + } + } + + const labelList& transformPointCells = transformedSlaves[pointI]; + + if (transformPointCells.size() > 0) + { + Pout<< "Master point:" << pointI + << " connected to " << transformPointCells.size() + << " transformed boundaryCells:" << endl; + + forAll(transformPointCells, i) + { + Pout<< " " << cc[transformPointCells[i]] << endl; + } + } + } + } Info<< "End\n" << endl; diff --git a/applications/test/syncTools/Test-syncTools.C b/applications/test/syncTools/Test-syncTools.C index 094068e94a..2638f0fb67 100644 --- a/applications/test/syncTools/Test-syncTools.C +++ b/applications/test/syncTools/Test-syncTools.C @@ -30,12 +30,12 @@ Description \*---------------------------------------------------------------------------*/ +#include "syncTools.H" #include "argList.H" #include "polyMesh.H" #include "Time.H" #include "Random.H" #include "PackedList.H" -#include "syncTools.H" using namespace Foam; @@ -210,7 +210,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) { // Create some data. Use slightly perturbed positions. Map sparseData; - pointField fullData(mesh.nPoints(), point::max); + pointField fullData(mesh.nPoints(), point(GREAT, GREAT, GREAT)); forAll(localPoints, i) { @@ -236,7 +236,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) mesh, fullData, minMagSqrEqOp(), - point::max + point(GREAT, GREAT, GREAT) // true // apply separation ); @@ -246,7 +246,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) { const point& fullPt = fullData[meshPointI]; - if (fullPt != point::max) + if (fullPt != point(GREAT, GREAT, GREAT)) { const point& sparsePt = sparseData[meshPointI]; @@ -285,8 +285,8 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) { // Create some data. Use slightly perturbed positions. - EdgeMap sparseData; - pointField fullData(mesh.nEdges(), point::max); + EdgeMap sparseData; + pointField fullData(mesh.nEdges(), point(GREAT, GREAT, GREAT)); const edgeList& edges = allBoundary.edges(); const labelList meshEdges = allBoundary.meshEdges @@ -313,14 +313,14 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) ( mesh, sparseData, - minEqOp() + minMagSqrEqOp() ); syncTools::syncEdgeList ( mesh, fullData, - minEqOp(), - point::max + minMagSqrEqOp(), + point(GREAT, GREAT, GREAT) ); // Compare. @@ -329,7 +329,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) { const point& fullPt = fullData[meshEdgeI]; - if (fullPt != point::max) + if (fullPt != point(GREAT, GREAT, GREAT)) { const point& sparsePt = sparseData[mesh.edges()[meshEdgeI]]; @@ -350,7 +350,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen) { const edge& e = mesh.edges()[meshEdgeI]; - EdgeMap::const_iterator iter = sparseData.find(e); + EdgeMap::const_iterator iter = sparseData.find(e); if (iter != sparseData.end()) { @@ -385,7 +385,7 @@ void testPointSync(const polyMesh& mesh, Random& rndGen) mesh, syncedPoints, minMagSqrEqOp(), - point::max + point(GREAT, GREAT, GREAT) ); forAll(syncedPoints, pointI) @@ -461,7 +461,7 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen) mesh, syncedMids, minMagSqrEqOp(), - point::max + point(GREAT, GREAT, GREAT) ); forAll(syncedMids, edgeI) diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 8a7296eca0..5804d962c8 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -43,6 +43,7 @@ Description #include "addPatchCellLayer.H" #include "fvMesh.H" #include "MeshedSurfaces.H" +#include "globalIndex.H" #include "extrudedMesh.H" #include "extrudeModel.H" @@ -261,6 +262,12 @@ int main(int argc, char *argv[]) sourceCasePath.expand(); fileName sourceRootDir = sourceCasePath.path(); fileName sourceCaseDir = sourceCasePath.name(); + if (Pstream::parRun()) + { + sourceCaseDir = + sourceCaseDir + /"processor" + Foam::name(Pstream::myProcNo()); + } wordList sourcePatches; dict.lookup("sourcePatches") >> sourcePatches; @@ -279,54 +286,173 @@ int main(int argc, char *argv[]) sourceRootDir, sourceCaseDir ); + #include "createMesh.H" const polyBoundaryMesh& patches = mesh.boundaryMesh(); - // Topo change container. Either copy an existing mesh or start - // with empty storage (number of patches only needed for checking) - autoPtr meshMod - ( - ( - mode == MESH - ? new polyTopoChange(mesh) - : new polyTopoChange(patches.size()) - ) - ); - // Extrusion engine. Either adding to existing mesh or // creating separate mesh. addPatchCellLayer layerExtrude(mesh, (mode == MESH)); + const labelList meshFaces(patchFaces(patches, sourcePatches)); indirectPrimitivePatch extrudePatch ( IndirectList ( mesh.faces(), - patchFaces(patches, sourcePatches) + meshFaces ), mesh.points() ); + // Determine extrudePatch normal + pointField extrudePatchPointNormals + ( + PatchTools::pointNormals //calcNormals + ( + mesh, + extrudePatch, + meshFaces + ) + ); + + + // Precalculate mesh edges for pp.edges. + const labelList meshEdges + ( + extrudePatch.meshEdges + ( + mesh.edges(), + mesh.pointEdges() + ) + ); + + // Global face indices engine + const globalIndex globalFaces(mesh.nFaces()); + + // Determine extrudePatch.edgeFaces in global numbering (so across + // coupled patches) + labelListList edgeGlobalFaces + ( + addPatchCellLayer::globalEdgeFaces + ( + mesh, + globalFaces, + extrudePatch + ) + ); + + + // Determine what patches boundary edges need to get extruded into. + // This might actually cause edge-connected processors to become + // face-connected so might need to introduce new processor boundaries. + // Calculates: + // - per pp.edge the patch to extrude into + // - any additional processor boundaries (patchToNbrProc = map from + // new patchID to neighbour processor) + // - number of new patches (nPatches) + + labelList sidePatchID; + label nPatches; + Map