diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 1bcee69984d1f8b32fed33fc9be7b434e78f2954..1d034714efe91a489d0f6a90b5f8c2d67988ea6c 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -243,14 +243,7 @@ int main(int argc, char *argv[]) meshDict.lookup("mergePatchPairs") ); - if (mergePatchPairs.size()) - { - FatalErrorIn(args.executable()) - << "mergePatchPairs not currently supported." - << exit(FatalError); - } - - //// #include "mergePatchPairs.H" +# include "mergePatchPairs.H" } else { diff --git a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H similarity index 100% rename from applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C rename to applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index e3536a5ad05862bd0370cf9e000992673797d944..859ddf20a277f137d522f75bc779f6bd98f7623d 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C @@ -63,6 +63,7 @@ Description #include "slidingInterface.H" #include "perfectInterface.H" #include "IOobjectList.H" +#include "ReadFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -90,34 +91,6 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name) } -// Read field -template<class GeoField> -void readFields -( - const fvMesh& mesh, - const IOobjectList& objects, - PtrList<GeoField>& fields -) -{ - // Search list of objects for volScalarFields - IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); - - // Construct the vol scalar fields - fields.setSize(fieldObjects.size()); - - label fieldi = 0; - for - ( - IOobjectList::iterator iter = fieldObjects.begin(); - iter != fieldObjects.end(); - ++iter - ) - { - fields.set(fieldi++, new GeoField(*iter(), mesh)); - } -} - - // Main program: int main(int argc, char *argv[]) @@ -343,7 +316,8 @@ int main(int argc, char *argv[]) cutZoneName, masterPatchName, slavePatchName, - tom // integral or partial + tom, // integral or partial + true // couple/decouple mode ) ); } @@ -355,30 +329,30 @@ int main(int argc, char *argv[]) // Read all current fvFields so they will get mapped Info<< "Reading all current volfields" << endl; PtrList<volScalarField> volScalarFields; - readFields(mesh, objects, volScalarFields); + ReadFields(mesh, objects, volScalarFields); PtrList<volVectorField> volVectorFields; - readFields(mesh, objects, volVectorFields); + ReadFields(mesh, objects, volVectorFields); PtrList<volSphericalTensorField> volSphericalTensorFields; - readFields(mesh, objects, volSphericalTensorFields); + ReadFields(mesh, objects, volSphericalTensorFields); PtrList<volSymmTensorField> volSymmTensorFields; - readFields(mesh, objects, volSymmTensorFields); + ReadFields(mesh, objects, volSymmTensorFields); PtrList<volTensorField> volTensorFields; - readFields(mesh, objects, volTensorFields); + ReadFields(mesh, objects, volTensorFields); //- uncomment if you want to interpolate surface fields (usually bad idea) //Info<< "Reading all current surfaceFields" << endl; //PtrList<surfaceScalarField> surfaceScalarFields; - //readFields(mesh, objects, surfaceScalarFields); + //ReadFields(mesh, objects, surfaceScalarFields); // //PtrList<surfaceVectorField> surfaceVectorFields; - //readFields(mesh, objects, surfaceVectorFields); + //ReadFields(mesh, objects, surfaceVectorFields); // //PtrList<surfaceTensorField> surfaceTensorFields; - //readFields(mesh, objects, surfaceTensorFields); + //ReadFields(mesh, objects, surfaceTensorFields); if (!overwrite) { @@ -394,11 +368,22 @@ int main(int argc, char *argv[]) if (overwrite) { mesh.setInstance(oldInstance); + stitcher.instance() = oldInstance; } Info << nl << "Writing polyMesh to time " << runTime.timeName() << endl; IOstream::defaultPrecision(10); - if (!mesh.write()) + + // Bypass runTime write (since only writes at outputTime) + if + ( + !runTime.objectRegistry::writeObject + ( + runTime.writeFormat(), + IOstream::currentVersion, + runTime.writeCompression() + ) + ) { FatalErrorIn(args.executable()) << "Failed writing polyMesh." diff --git a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C index 82e77d76740542a500cfe0be5ccfbd7302bde215..18d1170c0073161c32dd6d9023aa0aef7fbc2d45 100644 --- a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C +++ b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C @@ -35,9 +35,11 @@ License #include "plane.H" #include "polyTopoChanger.H" #include "polyAddPoint.H" +#include "polyRemovePoint.H" #include "polyAddFace.H" #include "polyModifyPoint.H" #include "polyModifyFace.H" +#include "polyRemoveFace.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -765,6 +767,9 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const projectedSlavePoints ); + // Demand driven calculate the cut faces. Apart from the + // cutFaces/cutFaceMaster/cutFaceSlave no information from the cutPatch + // is used anymore! const faceList& cutFaces = cutPatch.cutFaces(); const labelList& cutFaceMaster = cutPatch.cutFaceMaster(); const labelList& cutFaceSlave = cutPatch.cutFaceSlave(); @@ -1109,22 +1114,26 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const { nOrphanedMasters++; - // Recover original orientation - ref.setAction - ( - polyModifyFace - ( - masterPatch[faceI], // new face - masterPatchAddr[faceI], // master face index - -1, // owner - -1, // neighbour - false, // flux flip - -1, // patch ID - false, // remove from zone - masterFaceZoneID_.index(), // zone ID - false // zone flip - ) - ); + //// Recover original orientation + //ref.setAction + //( + // polyModifyFace + // ( + // masterPatch[faceI], // new face + // masterPatchAddr[faceI], // master face index + // -1, // owner + // -1, // neighbour + // false, // flux flip + // -1, // patch ID + // false, // remove from zone + // masterFaceZoneID_.index(), // zone ID + // false // zone flip + // ) + //); + + //Pout<< "**MJ:deleting master face " << masterPatchAddr[faceI] + // << " old verts:" << masterPatch[faceI] << endl; + ref.setAction(polyRemoveFace(masterPatchAddr[faceI])); } } @@ -1136,22 +1145,26 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const { nOrphanedSlaves++; - // Recover original orientation - ref.setAction - ( - polyModifyFace - ( - slavePatch[faceI], // new face - slavePatchAddr[faceI], // slave face index - -1, // owner - -1, // neighbour - false, // flux flip - -1, // patch ID - false, // remove from zone - slaveFaceZoneID_.index(), // zone ID - false // zone flip - ) - ); + //// Recover original orientation + //ref.setAction + //( + // polyModifyFace + // ( + // slavePatch[faceI], // new face + // slavePatchAddr[faceI], // slave face index + // -1, // owner + // -1, // neighbour + // false, // flux flip + // -1, // patch ID + // false, // remove from zone + // slaveFaceZoneID_.index(), // zone ID + // false // zone flip + // ) + //); + + //Pout<< "**MJ:deleting slave face " << slavePatchAddr[faceI] + // << " old verts:" << slavePatch[faceI] << endl; + ref.setAction(polyRemoveFace(slavePatchAddr[faceI])); } } @@ -1400,24 +1413,46 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const face newFace; newFace.transfer(newFaceLabels); -// Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl; + //Pout << "Modifying master stick-out face " << curFaceID + // << " old face: " << oldFace << " new face: " << newFace << endl; // Modify the face - ref.setAction - ( - polyModifyFace + if (mesh.isInternalFace(curFaceID)) + { + ref.setAction ( - newFace, // modified face - curFaceID, // label of face being modified - own[curFaceID], // owner - nei[curFaceID], // neighbour - false, // face flip - mesh.boundaryMesh().whichPatch(curFaceID), // patch for face - false, // remove from zone - modifiedFaceZone, // zone for face - modifiedFaceZoneFlip // face flip in zone - ) - ); + polyModifyFace + ( + newFace, // modified face + curFaceID, // label of face being modified + own[curFaceID], // owner + nei[curFaceID], // neighbour + false, // face flip + -1, // patch for face + false, // remove from zone + modifiedFaceZone, // zone for face + modifiedFaceZoneFlip // face flip in zone + ) + ); + } + else + { + ref.setAction + ( + polyModifyFace + ( + newFace, // modified face + curFaceID, // label of face being modified + own[curFaceID], // owner + -1, // neighbour + false, // face flip + mesh.boundaryMesh().whichPatch(curFaceID), // patch for face + false, // remove from zone + modifiedFaceZone, // zone for face + modifiedFaceZoneFlip // face flip in zone + ) + ); + } } } @@ -1688,21 +1723,42 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const // Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl; // Modify the face - ref.setAction - ( - polyModifyFace + if (mesh.isInternalFace(curFaceID)) + { + ref.setAction ( - newFace, // modified face - curFaceID, // label of face being modified - own[curFaceID], // owner - nei[curFaceID], // neighbour - false, // face flip - mesh.boundaryMesh().whichPatch(curFaceID), // patch for face - false, // remove from zone - modifiedFaceZone, // zone for face - modifiedFaceZoneFlip // face flip in zone - ) - ); + polyModifyFace + ( + newFace, // modified face + curFaceID, // label of face being modified + own[curFaceID], // owner + nei[curFaceID], // neighbour + false, // face flip + -1, // patch for face + false, // remove from zone + modifiedFaceZone, // zone for face + modifiedFaceZoneFlip // face flip in zone + ) + ); + } + else + { + ref.setAction + ( + polyModifyFace + ( + newFace, // modified face + curFaceID, // label of face being modified + own[curFaceID], // owner + -1, // neighbour + false, // face flip + mesh.boundaryMesh().whichPatch(curFaceID), // patch for face + false, // remove from zone + modifiedFaceZone, // zone for face + modifiedFaceZoneFlip // face flip in zone + ) + ); + } } } @@ -1735,15 +1791,25 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const // slave patch nRetiredPoints++; + //ref.setAction + //( + // polyModifyPoint + // ( + // slaveMeshPoints[pointI], // point ID + // points[slaveMeshPoints[pointI]], // point + // false, // remove from zone + // mesh.pointZones().whichZone(slaveMeshPoints[pointI]),// zone + // false // in a cell + // ) + //); + //Pout<< "MJ retire slave point " << slaveMeshPoints[pointI] + // << " coord " << points[slaveMeshPoints[pointI]] + // << endl; ref.setAction ( - polyModifyPoint + polyRemovePoint ( - slaveMeshPoints[pointI], // point ID - points[slaveMeshPoints[pointI]], // point - false, // remove from zone - mesh.pointZones().whichZone(slaveMeshPoints[pointI]),// zone - false // in a cell + slaveMeshPoints[pointI] ) ); diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.C index 11c401027d3f92e3780991ad3b3c036798543e5b..eb191b3f0f124bfd971fa91d9e6e3bcb5fb6bf4a 100644 --- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.C +++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.C @@ -28,6 +28,8 @@ Description #include "enrichedPatch.H" #include "demandDrivenData.H" +#include "OFstream.H" +#include "meshTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -249,6 +251,33 @@ bool Foam::enrichedPatch::checkSupport() const } +void Foam::enrichedPatch::writeOBJ(const fileName& fName) const +{ + OFstream str(fName); + + const pointField& lp = localPoints(); + + forAll(lp, pointI) + { + meshTools::writeOBJ(str, lp[pointI]); + } + + const faceList& faces = localFaces(); + + forAll(faces, faceI) + { + const face& f = faces[faceI]; + + str << 'f'; + forAll(f, fp) + { + str << ' ' << f[fp]+1; + } + str << nl; + } +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H index 0bf22c513cb7df9510b7ed9bfa3c7d53728f1ba5..f8f7e8f5e9812f399669891852f5204f830e45d8 100644 --- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H +++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H @@ -199,9 +199,9 @@ public: ( const primitiveFacePatch& masterPatch, const primitiveFacePatch& slavePatch, - const labelList& slavePointPointHits, - const labelList& slavePointEdgeHits, - const List<objectHit>& slavePointFaceHits + const labelList& slavePointPointHits,// -1 or common point snapped to + const labelList& slavePointEdgeHits, // -1 or common edge snapped to + const List<objectHit>& slavePointFaceHits // master face snapped to ); @@ -276,6 +276,10 @@ public: //- Check if the patch is fully supported bool checkSupport() const; + + + //- Debugging: dump graphical representation to obj format file + void writeOBJ(const fileName&) const; }; diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C index 0f8dd3603af39d6de31a581a915de396546a7d93..80d68749e84ae89a39ec3d900c418fd34457126a 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -664,14 +664,15 @@ void Foam::slidingInterface::updateMesh(const mapPolyMesh& m) masterPatchID_.update(mesh.boundaryMesh()); slavePatchID_.update(mesh.boundaryMesh()); - if (!attached()) - { - calcAttachedAddressing(); - } - else - { - renumberAttachedAddressing(m); - } +//MJ:Disabled updating +// if (!attached()) +// { +// calcAttachedAddressing(); +// } +// else +// { +// renumberAttachedAddressing(m); +// } }