From 3f1ddab78407172e4e9f68f454ebbf95836f51f9 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 24 Jun 2009 13:05:39 +0100 Subject: [PATCH] reinstate stitchMesh functionality --- .../mesh/generation/blockMesh/blockMeshApp.C | 9 +- .../{mergePatchPairs.C => mergePatchPairs.H} | 4 +- .../mesh/manipulation/stitchMesh/stitchMesh.C | 69 +++---- .../slidingInterface/coupleSlidingInterface.C | 210 +++++++++++++-------- .../slidingInterface/decoupleSlidingInterface.C | 2 +- .../slidingInterface/slidingInterface.C | 21 ++- .../slidingInterface/slidingInterface.H | 2 +- .../slidingInterfaceAttachedAddressing.C | 2 +- .../slidingInterface/slidingInterfaceClearCouple.C | 2 +- .../slidingInterfaceProjectPoints.C | 2 +- src/topoChangerFvMesh/Make/files | 2 + 11 files changed, 187 insertions(+), 138 deletions(-) rename applications/utilities/mesh/generation/blockMesh/{mergePatchPairs.C => mergePatchPairs.H} (98%) diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index e73a526..d1f271e 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -235,14 +235,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 98% rename from applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C rename to applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H index 2efd9b1..ebc779e 100644 --- a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C +++ b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H @@ -1,7 +1,7 @@ - Info<< nl << "Creating merge patch pairs" << nl << endl; - if (mergePatchPairs.size() > 0) { + Info<< nl << "Creating merge patch pairs" << nl << endl; + // Create and add point and face zones and mesh modifiers List pz(mergePatchPairs.size()); List fz(3*mergePatchPairs.size()); diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index e3c558c..8c730f8 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,10 +60,10 @@ Description #include "polyTopoChanger.H" #include "mapPolyMesh.H" #include "ListOps.H" -#include "IndirectList.H" #include "slidingInterface.H" #include "perfectInterface.H" #include "IOobjectList.H" +#include "ReadFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -91,34 +91,6 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name) } -// Read field -template -void readFields -( - const fvMesh& mesh, - const IOobjectList& objects, - PtrList& 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[]) @@ -135,7 +107,9 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + runTime.functionObjects().off(); # include "createMesh.H" + const word oldInstance = mesh.pointsInstance(); word masterPatchName(args.additionalArgs()[0]); @@ -342,7 +316,8 @@ int main(int argc, char *argv[]) cutZoneName, masterPatchName, slavePatchName, - tom // integral or partial + tom, // integral or partial + true // couple/decouple mode ) ); } @@ -354,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 volScalarFields; - readFields(mesh, objects, volScalarFields); + ReadFields(mesh, objects, volScalarFields); PtrList volVectorFields; - readFields(mesh, objects, volVectorFields); + ReadFields(mesh, objects, volVectorFields); PtrList volSphericalTensorFields; - readFields(mesh, objects, volSphericalTensorFields); + ReadFields(mesh, objects, volSphericalTensorFields); PtrList volSymmTensorFields; - readFields(mesh, objects, volSymmTensorFields); + ReadFields(mesh, objects, volSymmTensorFields); PtrList 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 surfaceScalarFields; - //readFields(mesh, objects, surfaceScalarFields); + //ReadFields(mesh, objects, surfaceScalarFields); // //PtrList surfaceVectorFields; - //readFields(mesh, objects, surfaceVectorFields); + //ReadFields(mesh, objects, surfaceVectorFields); // //PtrList surfaceTensorFields; - //readFields(mesh, objects, surfaceTensorFields); + //ReadFields(mesh, objects, surfaceTensorFields); if (!overwrite) { @@ -390,10 +365,24 @@ int main(int argc, char *argv[]) mesh.movePoints(morphMap->preMotionPoints()); // Write mesh + if (overwrite) + { + mesh.setInstance(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 cce2f1c..c4bee71 100644 --- a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C +++ b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -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 * * * * * * * * * * * * * // @@ -372,7 +374,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const // sliding intergace coupling in order to allow the point // projection to be done separately from the actual cutting. // Please change consistently with slidingInterfaceProjectPoints.C - // + // if (debug) { Pout << "Processing slave edges " << endl; @@ -543,7 +545,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const forAll (curFaces, faceI) { // Pout<< "face: " << curFaces[faceI] << " " -// << masterPatch[curFaces[faceI]] +// << masterPatch[curFaces[faceI]] // << " local: " // << masterPatch.localFaces()[curFaces[faceI]] // << endl; @@ -566,7 +568,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const // The edge cutting code is repeated in // slidingInterface::modifyMotionPoints. This is done for // efficiency reasons and avoids multiple creation of cutting - // planes. Please update both simultaneously. + // planes. Please update both simultaneously. const point& a = projectedSlavePoints[curEdge.start()]; const point& b = projectedSlavePoints[curEdge.end()]; @@ -623,7 +625,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const if (slaveCut.hit()) { // Strict checking of slave cut to avoid capturing - // end points. + // end points. scalar cutOnSlave = ( ( @@ -739,9 +741,6 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const } // End if both ends missing } // End for all slave edges -// Pout << "pointsIntoMasterEdges: " << pointsIntoMasterEdges << endl; -// Pout << "pointsIntoSlaveEdges: " << pointsIntoSlaveEdges << endl; - // Re-pack the points into edges lists labelListList pime(pointsIntoMasterEdges.size()); @@ -765,6 +764,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 +1111,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 +1142,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])); } } @@ -1403,21 +1413,42 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const // 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 +1719,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 +1787,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/decoupleSlidingInterface.C b/src/dynamicMesh/slidingInterface/decoupleSlidingInterface.C index ce08c9a..7269a7b 100644 --- a/src/dynamicMesh/slidingInterface/decoupleSlidingInterface.C +++ b/src/dynamicMesh/slidingInterface/decoupleSlidingInterface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C index 2fbc02d..191dc8d 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -664,14 +664,17 @@ void Foam::slidingInterface::updateMesh(const mapPolyMesh& m) masterPatchID_.update(mesh.boundaryMesh()); slavePatchID_.update(mesh.boundaryMesh()); - if (!attached()) - { - calcAttachedAddressing(); - } - else - { - renumberAttachedAddressing(m); - } + +//Pout<< "**Mj: disabled updating." << endl; + +// if (!attached()) +// { +// calcAttachedAddressing(); +// } +// else +// { +// renumberAttachedAddressing(m); +// } } diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.H b/src/dynamicMesh/slidingInterface/slidingInterface.H index e017016..376c969 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.H +++ b/src/dynamicMesh/slidingInterface/slidingInterface.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C b/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C index 522b576..49af1fa 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C +++ b/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/dynamicMesh/slidingInterface/slidingInterfaceClearCouple.C b/src/dynamicMesh/slidingInterface/slidingInterfaceClearCouple.C index eaa8f1b..f530f61 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterfaceClearCouple.C +++ b/src/dynamicMesh/slidingInterface/slidingInterfaceClearCouple.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C b/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C index 821eb33..a34fd0f 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C +++ b/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/topoChangerFvMesh/Make/files b/src/topoChangerFvMesh/Make/files index e51b8df..838500f 100644 --- a/src/topoChangerFvMesh/Make/files +++ b/src/topoChangerFvMesh/Make/files @@ -5,6 +5,8 @@ linearValveFvMesh/linearValveFvMesh.C linearValveLayersFvMesh/linearValveLayersFvMesh.C */ movingConeTopoFvMesh/movingConeTopoFvMesh.C +/* mixerFvMesh/mixerFvMesh.C +*/ LIB = $(FOAM_LIBBIN)/libtopoChangerFvMesh -- 2.11.4.GIT