diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index 3085ff1897f4d66374dc31d36d7930fd657be124..b223446c26ea40370d0fbb03680e0ded793bd218 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,7 @@ Description #include "faceCoupleInfo.H" #include "fvMeshAdder.H" #include "polyTopoChange.H" +#include "zeroGradientFvPatchFields.H" using namespace Foam; @@ -297,6 +298,12 @@ int main(int argc, char *argv[]) "fullMatch", "do (slower) geometric matching on all boundary faces" ); + argList::addBoolOption + ( + "cellDist", + "write cell distribution as a labelList - for use with 'manual' " + "decomposition method or as a volScalarField for post-processing." + ); #include "addTimeOptions.H" #include "addRegionOption.H" @@ -362,6 +369,7 @@ int main(int argc, char *argv[]) << nl << "This assumes a correct decomposition." << endl; } + bool writeCellDist = args.optionFound("cellDist"); int nProcs = 0; @@ -507,7 +515,7 @@ int main(int argc, char *argv[]) { // Construct empty mesh. Info<< "Constructing empty mesh to add to." << nl << endl; - polyMesh masterMesh + fvMesh masterMesh ( IOobject ( @@ -528,7 +536,7 @@ int main(int argc, char *argv[]) << " for time = " << databases[procI].timeName() << nl << endl; - polyMesh meshToAdd + fvMesh meshToAdd ( IOobject ( @@ -560,7 +568,7 @@ int main(int argc, char *argv[]) // Add elements to mesh Info<< "Adding to master mesh" << nl << endl; - autoPtr<mapAddedPolyMesh> map = polyMeshAdder::add + autoPtr<mapAddedPolyMesh> map = fvMeshAdder::add ( masterMesh, meshToAdd, @@ -608,6 +616,67 @@ int main(int argc, char *argv[]) << "Failed writing polyMesh." << exit(FatalError); } + + + + if (writeCellDist) + { + // Write the decomposition as labelList for use with 'manual' + // decomposition method. + labelIOList cellDecomposition + ( + IOobject + ( + "cellDecomposition", + masterMesh.facesInstance(), + masterMesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + masterMesh.nCells() + ); + + forAll(cellProcAddressing, procI) + { + const labelList& pCells = cellProcAddressing[procI]; + UIndirectList<label>(cellDecomposition, pCells) = procI; + } + + cellDecomposition.write(); + + Info<< nl << "Wrote decomposition to " + << cellDecomposition.objectPath() + << " for use in manual decomposition." << endl; + + + // Write as volScalarField for postprocessing. + volScalarField cellDist + ( + IOobject + ( + "cellDist", + runTime.timeName(), + masterMesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + masterMesh, + dimensionedScalar("cellDist", dimless, 0), + zeroGradientFvPatchScalarField::typeName + ); + + forAll(cellDecomposition, cellI) + { + cellDist[cellI] = cellDecomposition[cellI]; + } + + cellDist.write(); + + Info<< nl << "Wrote decomposition as volScalarField to " + << cellDist.name() << " for use in postprocessing." + << endl; + } } @@ -770,6 +839,7 @@ int main(int argc, char *argv[]) Info<< endl; } + Info<< "End.\n" << endl; return 0; diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index 9bcc1b64b2ae061945c45e3b4e028e159a636276..407828e0389db1790da490ef5d54ab148c05b810 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -974,28 +974,6 @@ int main(int argc, char *argv[]) const word extractionMethod = surfaceDict.lookup("extractionMethod"); -#ifndef ENABLE_CURVATURE - if (curvature) - { - WarningIn(args.executable()) - << "Curvature calculation has been requested but " - << args.executable() << " has not " << nl - << " been compiled with CGAL. " - << "Skipping the curvature calculation." << endl; - } -#else - if (curvature && env("FOAM_SIGFPE")) - { - WarningIn(args.executable()) - << "Detected floating point exception trapping (FOAM_SIGFPE)." - << " This might give" << nl - << " problems when calculating curvature on straight angles" - << " (infinite curvature)" << nl - << " Switch it off in case of problems." << endl; - } -#endif - - Info<< nl << "Feature line extraction is only valid on closed manifold " << "surfaces." << endl; diff --git a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H index e74ef023184e4b82f1918bb75b8ea54be803dd56..f133ed0ee52dce540a2e8300c3c1ed0904d18378 100644 --- a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H +++ b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H @@ -223,11 +223,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[] ) { label start = offsets_[i]; - return UList<T> - ( - (m_.size() ? m_.begin() + start : NULL), - offsets_[i+1] - start - ); + return UList<T>(m_.begin() + start, offsets_[i+1] - start); } @@ -241,7 +237,7 @@ Foam::CompactListList<T, Container>::operator[] label start = offsets_[i]; return UList<T> ( - (m_.size() ? const_cast<T*>(m_.begin() + start) : NULL), + const_cast<T*>(m_.begin() + start), offsets_[i+1] - start ); } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H index ca03ce8d162f325dfc584ad66bd6632595f9ef8e..6eed70e62895ff0a18dfff9f8b5dc77bd8f8d70e 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H @@ -34,10 +34,11 @@ SourceFiles PatchToolsCheck.C PatchToolsEdgeOwner.C PatchToolsGatherAndMerge.C + PatchToolsMatch.C + PatchToolsNormals.C PatchToolsSearch.C PatchToolsSortEdges.C - PatchToolsNormals.C - PatchToolsMatch.C + PatchToolsSortPoints.C \*---------------------------------------------------------------------------*/ diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 82bfa13522c573e57f274d02e34174f8b0179251..12b3e8b2bf70b3b04f0300fca632d35e855afa13 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -1047,7 +1047,12 @@ void Foam::autoRefineDriver::splitAndMergeBaffles } // Remove any now dangling parts - meshRefiner_.splitMeshRegions(refineParams.keepPoints()[0]); + meshRefiner_.splitMeshRegions + ( + globalToMasterPatch_, + globalToSlavePatch_, + refineParams.keepPoints()[0] + ); if (debug) { diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 22f2d7e3db40587249aa4fe19cc16089b8550b84..a3629c8e13f1eb185bb8dbed77f9362b655ec33f 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -131,7 +131,7 @@ void Foam::meshRefinement::calcNeighbourData // Other cell more refined. Adjust normal distance d *= 0.5; } - neiLevel[bFaceI] = cellLevel[ownLevel]; + neiLevel[bFaceI] = faceLevel; // Calculate other cell centre by extrapolation neiCc[bFaceI] = faceCentres[i] + d*fn; bFaceI++; @@ -1901,8 +1901,6 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const forAll(patches, patchI) { - const polyPatch& pp = patches[patchI]; - // Check all coupled. Avoid using .coupled() so we also pick up AMI. if (isA<coupledPolyPatch>(patches[patchI])) { @@ -1913,9 +1911,9 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const if (cpp.separated() || !cpp.parallel()) { - forAll(pp, i) + forAll(cpp, i) { - selected[pp.start()+i] = true; + selected[cpp.start()+i] = true; } } } @@ -1925,6 +1923,8 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions ( + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, const point& keepPoint ) { @@ -1933,7 +1933,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions // Determine connected regions. regionSplit is the labelList with the // region per cell. - regionSplit cellRegion(mesh_); + + boolList blockedFace(mesh_.nFaces(), false); + selectSeparatedCoupledFaces(blockedFace); + + regionSplit cellRegion(mesh_, blockedFace); label regionI = -1; @@ -1985,22 +1989,39 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions removeCells cellRemover(mesh_); labelList exposedFaces(cellRemover.getExposedFaces(cellsToRemove)); + labelList exposedPatch; - if (exposedFaces.size()) + label nExposedFaces = returnReduce(exposedFaces.size(), sumOp<label>()); + if (nExposedFaces) { - FatalErrorIn + //FatalErrorIn + //( + // "meshRefinement::splitMeshRegions(const point&)" + //) << "Removing non-reachable cells should only expose" + // << " boundary faces" << nl + // << "ExposedFaces:" << exposedFaces << abort(FatalError); + + // Patch for exposed faces for lack of anything sensible. + label defaultPatch = 0; + if (globalToMasterPatch.size()) + { + defaultPatch = globalToMasterPatch[0]; + } + + WarningIn ( "meshRefinement::splitMeshRegions(const point&)" - ) << "Removing non-reachable cells should only expose boundary faces" - << nl - << "ExposedFaces:" << exposedFaces << abort(FatalError); + ) << "Removing non-reachable cells exposes " + << nExposedFaces << " internal or coupled faces." << endl + << " These get put into patch " << defaultPatch << endl; + exposedPatch.setSize(exposedFaces.size(), defaultPatch); } return doRemoveCells ( cellsToRemove, exposedFaces, - labelList(exposedFaces.size(),-1), // irrelevant since 0 size. + exposedPatch, cellRemover ); } diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H index 085f096c721cf72a3f2bf0a9fe8bb10961692e18..1b5662db3228440dee19e2fa19b4d3e2fd28ef68 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H @@ -868,7 +868,12 @@ public: void selectSeparatedCoupledFaces(boolList&) const; //- Split mesh. Keep part containing point. - autoPtr<mapPolyMesh> splitMeshRegions(const point& keepPoint); + autoPtr<mapPolyMesh> splitMeshRegions + ( + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, + const point& keepPoint + ); //- Update local numbering for mesh redistribution void distribute(const mapDistributePolyMesh&); diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index 16528d3ea781c8057f3a68bf7be6a791c8cbd44f..5dc6cb1c22d466d83d1e2123748bd00725145944 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -1411,6 +1411,7 @@ void Foam::meshRefinement::findCellZoneInsideWalk { // Analyse regions. Reuse regionsplit boolList blockedFace(mesh_.nFaces()); + //selectSeparatedCoupledFaces(blockedFace); forAll(namedSurfaceIndex, faceI) { @@ -2055,7 +2056,7 @@ void Foam::meshRefinement::baffleAndSplitMesh runTime++; } - splitMeshRegions(keepPoint); + splitMeshRegions(globalToMasterPatch, globalToSlavePatch, keepPoint); if (debug) {