diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C index ae2b589bd6cc64421fa64659dae298eee50a6e7e..df24250066087ce3740304d8edcbb9e81f570dca 100644 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C +++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg); + phi = aphiv_pos*rho_pos + aphiv_neg*rho_neg; surfaceVectorField phiUp ( diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 2bbc9b42fc655d8bfc0d880a266142dce8430280..74d24954aaf0f5ba14a0f5af85945c396abd4a0a 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 f51256105828414a9d0cb2389d6c638a4302b54d..1a47854895ee39e7cf2d5500930dea99384b48d5 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 5e5c15426c8742f8bd5ee9b7769618c9339a851c..5aedbdc775083ba7178456dc9d5ec955bda544b5 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<class ZoneType> +void removeZone +( + ZoneMesh<ZoneType, polyMesh>& 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<cellZoneMesh&>(mesh.cellZones()), + setName + ); + } + else if (setType == faceZoneSet::typeName) + { + removeZone + ( + const_cast<faceZoneMesh&>(mesh.faceZones()), + setName + ); + } + else if (setType == pointZoneSet::typeName) + { + removeZone + ( + const_cast<pointZoneMesh&>(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 86e5b98f1c1cc0d2e7e9187458354428d176fbe0..9c910aa7ec9c26643114cc28a8b3449a2d4963b1 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/bin/foamCheckJobs b/bin/foamCheckJobs index 408dee58988b5d02fe86a56ec8be03579596cc53..02923b928979f0bb81c5ab188a5036a693dca544 100755 --- a/bin/foamCheckJobs +++ b/bin/foamCheckJobs @@ -236,9 +236,9 @@ rm -f $TMPFILE; touch $TMPFILE RUNJOBS=`getAllJobs $FOAM_JOB_DIR/runningJobs` for f in $RUNJOBS do - machinePid=`basename $f` - machine=`echo $machinePid | sed -e 's/\.[0-9][0-9]*$//'` - pid=`echo $machinePid | sed -e 's/.*\.\([0-9][0-9]*\)$/\1/'` + machinePid=`basename $f | sed -e 's/^"//' -e 's/"$//'` + machine=`echo "$machinePid" | sed -e 's/\.[0-9][0-9]*$//'` + pid=`echo "$machinePid" | sed -e 's/.*\.\([0-9][0-9]*\)$/\1/'` fgrep "$machine" $TMPFILE >/dev/null 2>&1 if [ $? -ne 0 ] diff --git a/bin/foamPrintJobs b/bin/foamPrintJobs index 1ddc9d0fc0aa120e60ccdaa74966c9f9f068dac5..7213e95e1f7c5405115133084f00dbc93a06f113 100755 --- a/bin/foamPrintJobs +++ b/bin/foamPrintJobs @@ -214,7 +214,7 @@ then fi nProcs=`rightStr 3 "$nProcs"` - user=`getEntry $f 'username'` + user=`getEntry $f 'userName'` user=${user:-'---'} user=`leftStr 8 "$user"` @@ -273,7 +273,7 @@ then fi nProcs=`rightStr 3 "$nProcs"` - user=`getEntry $f 'username'` + user=`getEntry $f 'userName'` user=${user:-'---'} user=`leftStr 8 "$user"` diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C index be7c7d2bfccbf6ea2acccb0d6a93ccbc4f98465d..99ac35648118db62825e802a1b79b1e8a6421b7d 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C @@ -77,6 +77,18 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io) zoneID_(-1), pointIDs_() { + if (undisplacedPoints_.size() != nPoints()) + { + FatalIOErrorIn + ( + "solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject&)", + dynamicMeshCoeffs_ + ) << "Read " << undisplacedPoints_.size() + << " undisplaced points from " << undisplacedPoints_.objectPath() + << " but the current mesh has " << nPoints() + << exit(FatalError); + } + word cellZoneName = dynamicMeshCoeffs_.lookupOrDefault<word>("cellZone", "none"); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C index d70c2794c854250c66ff076d187ab681dc63eb49..0029fbe56ef5754a1e6fd77e8c6ef358f14872e1 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<label> dynMeshEdgeFaces; + forAll(edgeFaces, edgeI) { if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1) @@ -660,7 +663,11 @@ void Foam::addPatchCellLayer::calcSidePatch // Pick up any boundary face on this edge and use its properties label meshEdgeI = meshEdges[edgeI]; - const labelList& meshFaces = mesh.edgeFaces()[meshEdgeI]; + const labelList& meshFaces = mesh.edgeFaces + ( + meshEdgeI, + dynMeshEdgeFaces + ); forAll(meshFaces, k) { @@ -716,7 +723,11 @@ void Foam::addPatchCellLayer::calcSidePatch // Pick up any boundary face on this edge and use its properties label meshEdgeI = meshEdges[edgeI]; - const labelList& meshFaces = mesh.edgeFaces()[meshEdgeI]; + const labelList& meshFaces = mesh.edgeFaces + ( + meshEdgeI, + dynMeshEdgeFaces + ); forAll(meshFaces, k) { diff --git a/src/meshTools/cellDist/cellDistFuncs.C b/src/meshTools/cellDist/cellDistFuncs.C index cd575e683a2a958c1715826bca4f07a3d0d8cfc9..2637c4e99e89379e65b11f73804bc4d8e7722a42 100644 --- a/src/meshTools/cellDist/cellDistFuncs.C +++ b/src/meshTools/cellDist/cellDistFuncs.C @@ -330,7 +330,6 @@ void Foam::cellDistFuncs::correctBoundaryPointCells { // Correct all (non-visited) cells with point on wall - const labelListList& pointCells = mesh().pointCells(); const vectorField& cellCentres = mesh().cellCentres(); forAll(mesh().boundaryMesh(), patchI) @@ -346,7 +345,7 @@ void Foam::cellDistFuncs::correctBoundaryPointCells { label vertI = meshPoints[meshPointI]; - const labelList& neighbours = pointCells[vertI]; + const labelList& neighbours = mesh().pointCells(vertI); forAll(neighbours, neighbourI) { diff --git a/src/meshTools/sets/topoSets/cellZoneSet.C b/src/meshTools/sets/topoSets/cellZoneSet.C index d3498f19988b3da6385536a9e78a0b5daacd379a..80528e3192d5da189e138c82b8da3a0ba33dbc3e 100644 --- a/src/meshTools/sets/topoSets/cellZoneSet.C +++ b/src/meshTools/sets/topoSets/cellZoneSet.C @@ -136,17 +136,30 @@ cellZoneSet::~cellZoneSet() void cellZoneSet::invert(const label maxLen) { + // Count label n = 0; for (label cellI = 0; cellI < maxLen; cellI++) { if (!found(cellI)) { - addressing_[n] = cellI; n++; } } + + // Fill addressing_.setSize(n); + n = 0; + + for (label cellI = 0; cellI < maxLen; cellI++) + { + if (!found(cellI)) + { + addressing_[n] = cellI; + n++; + } + } + updateSet(); } diff --git a/src/meshTools/sets/topoSets/faceZoneSet.C b/src/meshTools/sets/topoSets/faceZoneSet.C index 5d7cd831db7630bd96953c03e507d81a8d534233..10d9c0b9bfd0887e88a67969651c880822601cba 100644 --- a/src/meshTools/sets/topoSets/faceZoneSet.C +++ b/src/meshTools/sets/topoSets/faceZoneSet.C @@ -141,19 +141,31 @@ faceZoneSet::~faceZoneSet() void faceZoneSet::invert(const label maxLen) { + // Count label n = 0; for (label faceI = 0; faceI < maxLen; faceI++) { if (!found(faceI)) { - addressing_[n] = faceI; - flipMap_[n] = false; //? or true? n++; } } + + // Fill addressing_.setSize(n); flipMap_.setSize(n); + n = 0; + + for (label faceI = 0; faceI < maxLen; faceI++) + { + if (!found(faceI)) + { + addressing_[n] = faceI; + flipMap_[n] = false; //? or true? + n++; + } + } updateSet(); } diff --git a/src/meshTools/sets/topoSets/pointZoneSet.C b/src/meshTools/sets/topoSets/pointZoneSet.C index 783cd78431a493443ba04888a06f314d35b34d0a..8a02f718a24342ee6ec7b35c71dd9e443da92ca5 100644 --- a/src/meshTools/sets/topoSets/pointZoneSet.C +++ b/src/meshTools/sets/topoSets/pointZoneSet.C @@ -138,17 +138,29 @@ pointZoneSet::~pointZoneSet() void pointZoneSet::invert(const label maxLen) { + // Count label n = 0; for (label pointI = 0; pointI < maxLen; pointI++) { if (!found(pointI)) { - addressing_[n] = pointI; n++; } } + + // Fill addressing_.setSize(n); + n = 0; + + for (label pointI = 0; pointI < maxLen; pointI++) + { + if (!found(pointI)) + { + addressing_[n] = pointI; + n++; + } + } updateSet(); }