From e905a4c12042d3bedf17f9fc5a1df92fc6354492 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs@hunt.opencfd.co.uk> Date: Thu, 26 Mar 2009 12:09:33 +0000 Subject: [PATCH] debug; neighbour truncated --- .../attachDetach/attachInterface.C | 19 +++++- .../attachDetach/detachInterface.C | 67 ++++++++++++++++--- 2 files changed, 74 insertions(+), 12 deletions(-) diff --git a/src/dynamicMesh/attachDetach/attachInterface.C b/src/dynamicMesh/attachDetach/attachInterface.C index 21e4f882fd6..4c4294f8f37 100644 --- a/src/dynamicMesh/attachDetach/attachInterface.C +++ b/src/dynamicMesh/attachDetach/attachInterface.C @@ -207,7 +207,20 @@ void Foam::attachDetach::attachInterface mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID) ]; } - + + + label patchID = mesh.boundaryMesh().whichPatch(curFaceID); + label neiCell; + if (patchID == -1) + { + neiCell = nei[curFaceID]; + } + else + { + neiCell = -1; + } + + // Modify the face ref.setAction ( @@ -216,9 +229,9 @@ void Foam::attachDetach::attachInterface newFace, // modified face curFaceID, // label of face being modified own[curFaceID], // owner - nei[curFaceID], // neighbour + neiCell, // neighbour false, // face flip - mesh.boundaryMesh().whichPatch(curFaceID),// patch for face + patchID, // patch for face false, // remove from zone modifiedFaceZone, // zone for face modifiedFaceZoneFlip // face flip in zone diff --git a/src/dynamicMesh/attachDetach/detachInterface.C b/src/dynamicMesh/attachDetach/detachInterface.C index 7e0ac0a933a..6b57ccb6858 100644 --- a/src/dynamicMesh/attachDetach/detachInterface.C +++ b/src/dynamicMesh/attachDetach/detachInterface.C @@ -73,6 +73,37 @@ void Foam::attachDetach::detachInterface const polyMesh& mesh = topoChanger().mesh(); const faceZoneMesh& zoneMesh = mesh.faceZones(); + // Check that zone is in increasing order (needed since adding faces + // in same order - otherwise polyTopoChange face ordering will mess up + // correspondence) + if (debug) + { + const labelList& faceLabels = zoneMesh[faceZoneID_.index()]; + if (faceLabels.size() > 0) + { + for (label i = 1; i < faceLabels.size(); i++) + { + if (faceLabels[i] <= faceLabels[i-1]) + { + FatalErrorIn + ( + "attachDetach::detachInterface" + "(polyTopoChange&) const" + ) << "faceZone " << zoneMesh[faceZoneID_.index()].name() + << " does not have mesh face labels in" + << " increasing order." << endl + << "Face label " << faceLabels[i] + << " at position " << i + << " is smaller than the previous value " + << faceLabels[i-1] + << exit(FatalError); + } + } + } + } + + + const primitiveFacePatch& masterFaceLayer = zoneMesh[faceZoneID_.index()](); const pointField& points = mesh.points(); const labelListList& meshEdgeFaces = mesh.edgeFaces(); @@ -109,14 +140,11 @@ void Foam::attachDetach::detachInterface if (edgeIsInternal) { -// Pout<< "Internal edge found: (" << mp[zoneLocalEdges[curEdgeID].start()] << " " << mp[zoneLocalEdges[curEdgeID].end()] << ")" << endl; + const edge& e = zoneLocalEdges[curEdgeID]; // Reset the point creation - addedPoints[zoneLocalEdges[curEdgeID].start()] = - mp[zoneLocalEdges[curEdgeID].start()]; - - addedPoints[zoneLocalEdges[curEdgeID].end()] = - mp[zoneLocalEdges[curEdgeID].end()]; + addedPoints[e.start()] = mp[e.start()]; + addedPoints[e.end()] = mp[e.end()]; } } // Pout << "addedPoints before point creation: " << addedPoints << endl; @@ -137,7 +165,10 @@ void Foam::attachDetach::detachInterface true // supports a cell ) ); -// Pout << "Adding point " << points[mp[pointI]] << " for original point " << mp[pointI] << endl; + //Pout<< "Adding point " << addedPoints[pointI] + // << " coord1:" << points[mp[pointI]] + // << " coord2:" << masterFaceLayer.localPoints()[pointI] + // << " for original point " << mp[pointI] << endl; } } @@ -185,6 +216,7 @@ void Foam::attachDetach::detachInterface ); // Add renumbered face into the slave patch + //label addedFaceI = ref.setAction ( polyAddFace @@ -201,7 +233,15 @@ void Foam::attachDetach::detachInterface false // zone flip ) ); -// Pout << "Flip. Modifying face: " << faces[curFaceID].reverseFace() << " next to cell: " << nei[curFaceID] << " and adding face: " << newFace << " next to cell: " << own[curFaceID] << endl; + //{ + // pointField newPts(ref.points()); + //Pout<< "Flip. Modifying face: " << ref.faces()[curFaceID] + // << " fc:" << ref.faces()[curFaceID].centre(newPts) + // << " next to cell: " << nei[curFaceID] + // << " and adding face: " << newFace + // << " fc:" << ref.faces()[addedFaceI].centre(newPts) + // << " next to cell: " << own[curFaceID] << endl; + //} } else { @@ -223,6 +263,7 @@ void Foam::attachDetach::detachInterface ); // Add renumbered face into the slave patch + //label addedFaceI = ref.setAction ( polyAddFace @@ -239,7 +280,15 @@ void Foam::attachDetach::detachInterface false // face flip in zone ) ); -// Pout << "No flip. Modifying face: " << faces[curFaceID] << " next to cell: " << own[curFaceID] << " and adding face: " << newFace << " next to cell: " << nei[curFaceID] << endl; + //{ + // pointField newPts(ref.points()); + //Pout<< "No flip. Modifying face: " << ref.faces()[curFaceID] + // << " fc:" << ref.faces()[curFaceID].centre(newPts) + // << " next to cell: " << own[curFaceID] + // << " and adding face: " << newFace + // << " fc:" << ref.faces()[addedFaceI].centre(newPts) + // << " next to cell: " << nei[curFaceID] << endl; + //} } } -- GitLab