diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 2bbc9b42fc..74d24954aa 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -212,7 +212,7 @@ snapControls //- Maximum relative distance for points to be attracted by surface. // True distance is this factor times local maximum edge length. // Note: changed(corrected) w.r.t 17x! (17x used 2* tolerance) - tolerance 1.0; + tolerance 2.0; //- Number of mesh displacement relaxation iterations. nSolveIter 30; diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index f512561058..1a47854895 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -1018,7 +1018,7 @@ int main(int argc, char *argv[]) is ); - if (!ok) + if (!ok && batch) { // Exit with error. quit = true; diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C index 5e5c15426c..5aedbdc775 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C +++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.C @@ -35,6 +35,10 @@ Description #include "pointSet.H" #include "globalMeshData.H" #include "timeSelector.H" +#include "IOobjectList.H" +#include "cellZoneSet.H" +#include "faceZoneSet.H" +#include "pointZoneSet.H" using namespace Foam; @@ -51,6 +55,96 @@ void printMesh(const Time& runTime, const polyMesh& mesh) } +template +void removeZone +( + ZoneMesh& zones, + const word& setName +) +{ + label zoneID = zones.findZoneID(setName); + + if (zoneID != -1) + { + Info<< "Removing zone " << setName << " at index " << zoneID << endl; + // Shuffle to last position + labelList oldToNew(zones.size()); + label newI = 0; + forAll(oldToNew, i) + { + if (i != zoneID) + { + oldToNew[i] = newI++; + } + } + oldToNew[zoneID] = newI; + zones.reorder(oldToNew); + // Remove last element + zones.setSize(zones.size()-1); + zones.clearAddressing(); + zones.write(); + } +} + + +// Physically remove a set +void removeSet +( + const polyMesh& mesh, + const word& setType, + const word& setName +) +{ + // Remove the file + IOobjectList objects + ( + mesh, + mesh.time().findInstance + ( + polyMesh::meshSubDir/"sets", + word::null, + IOobject::READ_IF_PRESENT, + mesh.facesInstance() + ), + polyMesh::meshSubDir/"sets" + ); + + if (objects.found(setName)) + { + // Remove file + fileName object = objects[setName]->objectPath(); + Info<< "Removing file " << object << endl; + rm(object); + } + + // See if zone + if (setType == cellZoneSet::typeName) + { + removeZone + ( + const_cast(mesh.cellZones()), + setName + ); + } + else if (setType == faceZoneSet::typeName) + { + removeZone + ( + const_cast(mesh.faceZones()), + setName + ); + } + else if (setType == pointZoneSet::typeName) + { + removeZone + ( + const_cast(mesh.pointZones()), + setName + ); + } +} + + polyMesh::readUpdateState meshReadUpdate(polyMesh& mesh) { polyMesh::readUpdateState stat = mesh.readUpdate(); @@ -284,6 +378,12 @@ int main(int argc, char *argv[]) currentSet().write(); break; + case topoSetSource::REMOVE: + Info<< " Removing set" << endl; + removeSet(mesh, setType, setName); + break; + + default: WarningIn(args.executable()) << "Unhandled action " << action << endl; diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 86e5b98f1c..9c910aa7ec 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -22,8 +22,15 @@ FoamFile // type cellSet; // // // action to perform on set. Two types: -// // - require no source : clear/invert +// // - require no source : clear/invert/remove +// // clear : clears set or zone +// // invert : select all currently non-selected elements +// // remove : removes set or zone // // - require source : new/add/delete/subset +// // new : create new set or zone from source +// // add : add source to contents +// // delete : deletes source from contents +// // subset : keeps elements both in contents and source // action new; // // The source entry varies according to the type of set: @@ -329,6 +336,7 @@ FoamFile // faceSet f0; // name of faceSet // cellSet c0; // name of cellSet of slave side // } +// actions ( diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C index d70c2794c8..0029fbe56e 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C @@ -650,6 +650,9 @@ void Foam::addPatchCellLayer::calcSidePatch // ------------------------------------------------------ const labelListList& edgeFaces = pp.edgeFaces(); + + DynamicList