From 428085d0a0b22cfcc7844a8161d26c33cf002758 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 6 Jan 2011 09:27:43 +0000 Subject: [PATCH 01/34] BUG: writeMeshObject.H : compactIOList not handled (setting typeName to word::null only handled by IOdictionary) --- .../foamFormatConvert/writeMeshObject.H | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H b/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H index 45c75a66db..aad7742353 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H +++ b/applications/utilities/miscellaneous/foamFormatConvert/writeMeshObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,7 +44,8 @@ inline bool writeMeshObject ( const word& name, const fileName& meshDir, - Time& runTime + Time& runTime, + bool disableHeaderChecking = false ) { IOobject io @@ -67,14 +68,21 @@ inline bool writeMeshObject // Switch off type checking (for reading e.g. faceZones as // generic list of dictionaries). - const word oldTypeName = T::typeName; - const_cast(T::typeName) = word::null; + word oldTypeName; + if (disableHeaderChecking) + { + oldTypeName = T::typeName; + const_cast(T::typeName) = word::null; + } T meshObject(io); - const_cast(T::typeName) = oldTypeName; - // Fake type back to what was in field - const_cast(meshObject.type()) = io.headerClassName(); + if (disableHeaderChecking) + { + const_cast(T::typeName) = oldTypeName; + // Fake type back to what was in field + const_cast(meshObject.type()) = io.headerClassName(); + } Info<< " Writing " << name << endl; writeOk = meshObject.regIOobject::write(); From 218382ac6af52cb47e10e118401281fdf4fbfb97 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 6 Jan 2011 11:45:27 +0000 Subject: [PATCH 02/34] BUG: paraview3/cshrc : csh syntax --- etc/apps/paraview3/cshrc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index 96f404db46..a703bb8aba 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -49,13 +49,12 @@ foreach cmake ( cmake-2.8.3 cmake-2.8.1 ) end # set VERSION and MAJOR (version) variables -if ( ! $?ParaView_VERSION ) -then +if ( ! $?ParaView_VERSION ) then setenv ParaView_VERSION 3.8.0 setenv ParaView_MAJOR unknown echo "Warning in app/paraview3/cshrc:" echo " ParaView_VERSION not set, using '$ParaView_VERSION'" -fi +endif if ( ! $?ParaView_MAJOR ) setenv ParaView_MAJOR unknown # if needed, set MAJOR version to correspond to VERSION From 380329dd04a1f938593a9e9b58ccd511636466ca Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 6 Jan 2011 11:45:54 +0000 Subject: [PATCH 03/34] ENH: cyclicPolyPatch : use transform from largest face. --- .../constraint/cyclic/cyclicPolyPatch.C | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index ac0595bf48..9a844e1eb5 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -276,9 +276,16 @@ void Foam::cyclicPolyPatch::calcTransforms if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1) { - const_cast(forwardT()).setSize(1); - const_cast(reverseT()).setSize(1); + // Get index of maximum area face to minimise truncation errors. + label max0I = findMaxArea(half0.points(), half0); + + const tensor fwdT = forwardT()[max0I]; + const_cast(forwardT()) = tensorField(1, fwdT); + const tensor revT = reverseT()[max0I]; + const_cast(reverseT()) = tensorField(1, revT); + const bool coll = collocated()[max0I]; const_cast(collocated()).setSize(1); + const_cast(collocated())[0] = coll; WarningIn ( @@ -293,8 +300,9 @@ void Foam::cyclicPolyPatch::calcTransforms ) << "For patch " << name() << " calculated non-uniform transform tensor even though" << " the transform type is " << transformTypeNames[transform_] - << ". Setting the transformation tensor to be a uniform" - << " rotation." + << "." << nl + << " Setting the transformation tensor to be a uniform" + << " rotation calculated from face " << max0I << endl; } } From f3a61b8e606389ba30ebab560ff1a759ed7e7abe Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jan 2011 14:30:41 +0000 Subject: [PATCH 04/34] ENH: processorCyclic : set transformation on both sides of underlying cyclic --- .../constraint/cyclic/cyclicPolyPatch.H | 6 ++++- .../processorCyclicPolyPatch.C | 22 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H index cd3c3081a9..7b0d369317 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -197,6 +197,10 @@ protected: public: + //- Declare friendship with processorCyclicPolyPatch + friend class processorCyclicPolyPatch; + + //- Runtime type information TypeName("cyclic"); diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C index 33264fc0d3..dddc152a79 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,6 +26,7 @@ License #include "processorCyclicPolyPatch.H" #include "addToRunTimeSelectionTable.H" #include "SubField.H" +#include "cyclicPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -171,9 +172,9 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs) // - or do we not auto-calculate the transformation but // have option of reading it. - // Update underlying cyclic + // Update underlying cyclic halves. Need to do both since only one + // half might be present as a processorCyclic. coupledPolyPatch& pp = const_cast(referPatch()); - pp.calcGeometry ( *this, @@ -184,6 +185,21 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs) neighbFaceAreas(), neighbFaceCellCentres() ); + + if (isA(pp)) + { + const cyclicPolyPatch& cpp = refCast(pp); + const_cast(cpp.neighbPatch()).calcGeometry + ( + *this, + neighbFaceCentres(), + neighbFaceAreas(), + neighbFaceCellCentres(), + faceCentres(), + faceAreas(), + faceCellCentres() + ); + } } } From c7b10acc7788d34256d94537762ff4d874255283 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jan 2011 14:41:39 +0000 Subject: [PATCH 05/34] ENH: metisDecomp : message about metis --- src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C b/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C index 4be4cd995b..1da6585c46 100644 --- a/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C +++ b/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,8 +33,10 @@ static const char* notImplementedMessage = "\n" "Please install metis and make sure that libmetis.so is in your " "LD_LIBRARY_PATH.\n" -"The metisDecomp library can then be built in " -"$FOAM_SRC/parallel/decompose/decompositionMethods/metisDecomp\n"; +"The metisDecomp library can then be built from " +"$FOAM_SRC/parallel/decompose/metisDecomp and dynamically loading or linking" +" this library will add metis as a decomposition method.\n" +"Please be aware that there are license restrictions on using Metis."; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 1e729a52a6f66c3ca4cd15b5834c775aabc98e0e Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jan 2011 14:42:59 +0000 Subject: [PATCH 06/34] ENH: timeVaryingMappedFV : improved debug message --- .../timeVaryingMappedFixedValueFvPatchField.C | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 007038b2bf..736ee1ab68 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -342,8 +342,6 @@ void timeVaryingMappedFixedValueFvPatchField::readSamplePoints() localVertices2D[i][1] = localVertices[i][1]; } - triSurface s(triSurfaceTools::delaunay2D(localVertices2D)); - tmp localFaceCentres ( referenceCS().localPosition @@ -352,6 +350,26 @@ void timeVaryingMappedFixedValueFvPatchField::readSamplePoints() ) ); + if (debug) + { + OFstream str + ( + this->db().time().path()/this->patch().name() + + "_localFaceCentres.obj" + ); + Pout<< "readSamplePoints :" + << " Dumping face centres to " << str.name() << endl; + + forAll(localFaceCentres(), i) + { + const point& p = localFaceCentres()[i]; + str<< "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl; + } + } + + + triSurface s(triSurfaceTools::delaunay2D(localVertices2D)); + if (debug) { Pout<< "readSamplePoints :" From a78ed5bade33bf67882bdc52f602f424ea41f019 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jan 2011 14:44:56 +0000 Subject: [PATCH 07/34] COMP: metisDecomp : remove from default compilation --- src/parallel/decompose/Allwmake | 1 - 1 file changed, 1 deletion(-) diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index cb053bcc3e..6236c1df2f 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -17,7 +17,6 @@ set -x wmakeLnInclude decompositionMethods wmake libso scotchDecomp -wmake libso metisDecomp if [ -d "$FOAM_MPI_LIBBIN" ] then From 90b24cbc9e8a923f33fa34dc5ad848312ec14af3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jan 2011 14:45:43 +0000 Subject: [PATCH 08/34] BUG: multiLevelDecomp : fix bug in subsetting addressing --- .../multiLevelDecomp/multiLevelDecomp.C | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C index cb9ec502c5..14b39d9655 100644 --- a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C +++ b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,6 +75,14 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells labelList allDist(dist); map.distribute(allDist); + // Now we have: + // oldToNew : the locally-compact numbering of all our cellCells. -1 if + // cellCell is not in set. + // allDist : destination domain for all our cellCells + // subCellCells : indexes into oldToNew and allDist + + // Globally compact numbering for cells in set. + globalIndex globalSubCells(set.size()); // Now subCellCells contains indices into oldToNew which are the // new locations of the neighbouring cells. @@ -90,14 +98,23 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells label newI = 0; forAll(cCells, i) { - label subCellI = oldToNew[cCells[i]]; - if (subCellI == -1) + // Get locally-compact cell index of neighbouring cell + label nbrCellI = oldToNew[cCells[i]]; + if (nbrCellI == -1) { cutConnections[allDist[cCells[i]]]++; } else { - cCells[newI++] = subCellI; + // Reconvert local cell index into global one + + // Get original neighbour + label cellI = set[subCellI]; + label oldNbrCellI = cellCells[cellI][i]; + // Get processor from original neighbour + label procI = globalCells.whichProcID(oldNbrCellI); + // Convert into global compact numbering + cCells[newI++] = globalSubCells.toGlobal(procI, nbrCellI); } } cCells.setSize(newI); From b09508cd1ba5c2c1a677627285a4efbd856697d8 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 7 Jan 2011 14:47:03 +0000 Subject: [PATCH 09/34] ENH: ptscotchDecomp : have graph file output --- .../decompose/ptscotchDecomp/ptscotchDecomp.C | 146 +++++++++++------- .../decompose/ptscotchDecomp/ptscotchDecomp.H | 4 +- 2 files changed, 95 insertions(+), 55 deletions(-) diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index c9728768dd..7478de9c9a 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,6 +102,14 @@ License } + + Note: writes out .dgr files for debugging. Run with e.g. + + mpirun -np 4 dgpart 2 'processor%r.grf' + + - %r gets replaced by current processor rank + - decompose into 2 domains + \*---------------------------------------------------------------------------*/ #include "ptscotchDecomp.H" @@ -161,6 +169,7 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str) //- Does prevention of 0 cell domains and calls ptscotch. Foam::label Foam::ptscotchDecomp::decomposeZeroDomains ( + const fileName& meshPath, const List& initadjncy, const List& initxadj, const scalarField& initcWeights, @@ -184,6 +193,7 @@ Foam::label Foam::ptscotchDecomp::decomposeZeroDomains { return decompose ( + meshPath, initadjncy, initxadj, initcWeights, @@ -287,7 +297,7 @@ Foam::label Foam::ptscotchDecomp::decomposeZeroDomains // Do decomposition as normal. Sets finalDecomp. - label result = decompose(adjncy, xadj, cWeights, finalDecomp); + label result = decompose(meshPath, adjncy, xadj, cWeights, finalDecomp); if (debug) @@ -344,6 +354,7 @@ Foam::label Foam::ptscotchDecomp::decomposeZeroDomains // Call scotch with options from dictionary. Foam::label Foam::ptscotchDecomp::decompose ( + const fileName& meshPath, const List& adjncy, const List& xadj, const scalarField& cWeights, @@ -356,58 +367,82 @@ Foam::label Foam::ptscotchDecomp::decompose Pout<< "ptscotchDecomp : entering with xadj:" << xadj.size() << endl; } -// // Dump graph -// if (decompositionDict_.found("ptscotchCoeffs")) -// { -// const dictionary& scotchCoeffs = -// decompositionDict_.subDict("ptscotchCoeffs"); -// -// if (scotchCoeffs.lookupOrDefault("writeGraph", false)) -// { -// OFstream str(mesh_.time().path() / mesh_.name() + ".grf"); -// -// Info<< "Dumping Scotch graph file to " << str.name() << endl -// << "Use this in combination with gpart." << endl; -// -// // Distributed graph file (.grf) -// label version = 2; -// str << version << nl; -// // Number of files -// // Number of files (procglbnbr) -// str << Pstream::nProcs(); -// // My file number (procloc) -// str << ' ' << Pstream::myProcNo() << nl; -// -// // Total number of vertices (vertglbnbr) -// str << returnReduce(mesh.nCells(), sumOp