diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/Make/options b/applications/utilities/mesh/advanced/combinePatchFaces/Make/options index 7d4e1304f0..4f26f666de 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/Make/options +++ b/applications/utilities/mesh/advanced/combinePatchFaces/Make/options @@ -5,4 +5,5 @@ EXE_INC = \ EXE_LIBS = \ -lmeshTools \ + -lsampling \ -ldynamicMesh diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index 877579fa5f..8c8be624f0 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,105 +53,19 @@ Description #include "polyMesh.H" #include "mapPolyMesh.H" #include "unitConversion.H" +#include "motionSmoother.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Same check as snapMesh -void checkSnapMesh -( - const Time& runTime, - const polyMesh& mesh, - labelHashSet& wrongFaces -) -{ - IOdictionary snapDict - ( - IOobject - ( - "snapMeshDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); - - // Max nonorthogonality allowed - scalar maxNonOrtho(readScalar(snapDict.lookup("maxNonOrtho"))); - // Max concaveness allowed. - scalar maxConcave(readScalar(snapDict.lookup("maxConcave"))); - // Min volume allowed (factor of minimum cellVolume) - scalar relMinVol(readScalar(snapDict.lookup("minVol"))); - const scalar minCellVol = min(mesh.cellVolumes()); - const scalar minPyrVol = relMinVol*minCellVol; - // Min area - scalar minArea(readScalar(snapDict.lookup("minArea"))); - - if (maxNonOrtho < 180.0-SMALL) - { - Pout<< "Checking non orthogonality" << endl; - - label nOldSize = wrongFaces.size(); - mesh.setNonOrthThreshold(maxNonOrtho); - mesh.checkFaceOrthogonality(false, &wrongFaces); - - Pout<< "Detected " << wrongFaces.size() - nOldSize - << " faces with non-orthogonality > " << maxNonOrtho << " degrees" - << endl; - } - - if (minPyrVol > -GREAT) - { - Pout<< "Checking face pyramids" << endl; - - label nOldSize = wrongFaces.size(); - mesh.checkFacePyramids(false, minPyrVol, &wrongFaces); - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with illegal face pyramids" << endl; - } - - if (maxConcave < 180.0-SMALL) - { - Pout<< "Checking face angles" << endl; - - label nOldSize = wrongFaces.size(); - mesh.checkFaceAngles(false, maxConcave, &wrongFaces); - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with concavity > " << maxConcave << " degrees" - << endl; - } - - if (minArea > -SMALL) - { - Pout<< "Checking face areas" << endl; - - label nOldSize = wrongFaces.size(); - - const scalarField magFaceAreas(mag(mesh.faceAreas())); - - forAll(magFaceAreas, faceI) - { - if (magFaceAreas[faceI] < minArea) - { - wrongFaces.insert(faceI); - } - } - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with area < " << minArea << " m^2" << endl; - } -} - - // Merge faces on the same patch (usually from exposing refinement) // Can undo merges if these cause problems. label mergePatchFaces ( const scalar minCos, const scalar concaveSin, - const bool snapMeshDict, + const autoPtr& qualDictPtr, const Time& runTime, polyMesh& mesh ) @@ -212,9 +126,9 @@ label mergePatchFaces // Faces in error. labelHashSet errorFaces; - if (snapMeshDict) + if (qualDictPtr.valid()) { - checkSnapMesh(runTime, mesh, errorFaces); + motionSmoother::checkMesh(false, mesh, qualDictPtr(), errorFaces); } else { @@ -437,8 +351,8 @@ int main(int argc, char *argv[]) ); argList::addBoolOption ( - "snapMesh", - "use system/snapMeshDict" + "meshQuality", + "read user-defined mesh quality criterions from system/meshQualityDict" ); # include "setRootCase.H" @@ -455,8 +369,8 @@ int main(int argc, char *argv[]) scalar concaveAngle = args.optionLookupOrDefault("concaveAngle", 30.0); scalar concaveSin = Foam::sin(degToRad(concaveAngle)); - const bool snapMeshDict = args.optionFound("snapMesh"); const bool overwrite = args.optionFound("overwrite"); + const bool meshQuality = args.optionFound("meshQuality"); Info<< "Merging all faces of a cell" << nl << " - which are on the same patch" << nl @@ -468,23 +382,47 @@ int main(int argc, char *argv[]) << " (sin:" << concaveSin << ')' << nl << endl; + autoPtr qualDict; + if (meshQuality) + { + Info<< "Enabling user-defined geometry checks." << nl << endl; + + qualDict.reset + ( + new IOdictionary + ( + IOobject + ( + "meshQualityDict", + mesh.time().system(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ) + ); + } + + if (!overwrite) { runTime++; } + + // Merge faces on same patch label nChanged = mergePatchFaces ( minCos, concaveSin, - snapMeshDict, + qualDict, runTime, mesh ); // Merge points on straight edges and remove unused points - if (snapMeshDict) + if (qualDict.valid()) { Info<< "Merging all 'loose' points on surface edges, " << "regardless of the angle they make." << endl; diff --git a/applications/utilities/mesh/generation/cvMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/Make/options index 2255a9a271..2228fc2b12 100644 --- a/applications/utilities/mesh/generation/cvMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/Make/options @@ -17,6 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude @@ -29,5 +30,6 @@ EXE_LIBS = \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -ledgeMesh \ + -lsampling \ -ltriSurface \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options index 97e045f305..62649cf232 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options @@ -17,6 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I../vectorTools diff --git a/applications/utilities/mesh/generation/cvMesh/cvMesh.C b/applications/utilities/mesh/generation/cvMesh/cvMesh.C index ecd7f102ba..f15ebea29a 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/cvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ Description #include "argList.H" #include "conformalVoronoiMesh.H" +#include "vtkSetWriter.H" using namespace Foam; @@ -48,6 +49,11 @@ int main(int argc, char *argv[]) "noFilter", "Do not filter the mesh" ); + Foam::argList::addBoolOption + ( + "checkGeometry", + "check all surface geometry for quality" + ); #include "setRootCase.H" #include "createTime.H" @@ -55,6 +61,7 @@ int main(int argc, char *argv[]) runTime.functionObjects().off(); const bool noFilter = !args.optionFound("noFilter"); + const bool checkGeometry = args.optionFound("checkGeometry"); Info<< "Mesh filtering is " << (noFilter ? "on" : "off") << endl; @@ -74,6 +81,29 @@ int main(int argc, char *argv[]) conformalVoronoiMesh mesh(runTime, cvMeshDict); + + if (checkGeometry) + { + const searchableSurfaces& allGeometry = mesh.allGeometry(); + + // Write some stats + allGeometry.writeStats(List(0), Info); + // Check topology + allGeometry.checkTopology(true); + // Check geometry + allGeometry.checkGeometry + ( + 100.0, // max size ratio + 1e-9, // intersection tolerance + autoPtr >(new vtkSetWriter()), + 0.01, // min triangle quality + true + ); + + return 0; + } + + while (runTime.loop()) { Info<< nl << "Time = " << runTime.timeName() << endl; diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options b/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options index c7c073ab17..35c90b1f48 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options @@ -9,6 +9,7 @@ EXE_INC = \ -I$(FASTDUALOCTREE_SRC_PATH) \ -I../conformalVoronoiMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude @@ -21,6 +22,7 @@ EXE_LIBS = \ -lconformalVoronoiMesh \ -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lscotchDecomp \ -ledgeMesh \ + -lsampling \ -ltriSurface \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index b7fd6d3bd2..94ff17ee99 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/mesh/autoMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ @@ -13,5 +14,6 @@ EXE_LIBS = \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -lmeshTools \ + -lsampling \ -ldynamicMesh \ -lautoMesh diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 2372b144ec..6b63430918 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -46,7 +46,7 @@ Description #include "refinementParameters.H" #include "snapParameters.H" #include "layerParameters.H" - +#include "vtkSetWriter.H" using namespace Foam; @@ -122,6 +122,12 @@ void writeMesh int main(int argc, char *argv[]) { # include "addOverwriteOption.H" + Foam::argList::addBoolOption + ( + "checkGeometry", + "check all surface geometry for quality" + ); + # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); @@ -131,6 +137,7 @@ int main(int argc, char *argv[]) << runTime.cpuTimeIncrement() << " s" << endl; const bool overwrite = args.optionFound("overwrite"); + const bool checkGeometry = args.optionFound("checkGeometry"); // Check patches and faceZones are synchronised mesh.boundaryMesh().checkParallelSync(true); @@ -244,6 +251,56 @@ int main(int argc, char *argv[]) << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + // Checking only? + + if (checkGeometry) + { + // Extract patchInfo + List patchTypes(allGeometry.size()); + + const PtrList& patchInfo = surfaces.patchInfo(); + const labelList& surfaceGeometry = surfaces.surfaces(); + forAll(surfaceGeometry, surfI) + { + label geomI = surfaceGeometry[surfI]; + const wordList& regNames = allGeometry.regionNames()[geomI]; + + patchTypes[geomI].setSize(regNames.size()); + forAll(regNames, regionI) + { + label globalRegionI = surfaces.globalRegion(surfI, regionI); + + if (patchInfo.set(globalRegionI)) + { + patchTypes[geomI][regionI] = + word(patchInfo[globalRegionI].lookup("type")); + } + else + { + patchTypes[geomI][regionI] = wallPolyPatch::typeName; + } + } + } + + // Write some stats + allGeometry.writeStats(patchTypes, Info); + // Check topology + allGeometry.checkTopology(true); + // Check geometry + allGeometry.checkGeometry + ( + 100.0, // max size ratio + 1e-9, // intersection tolerance + autoPtr >(new vtkSetWriter()), + 0.01, // min triangle quality + true + ); + + return 0; + } + + + // Read refinement shells // ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/applications/utilities/mesh/manipulation/setsToZones/Make/options b/applications/utilities/mesh/manipulation/setsToZones/Make/options index 54c035b8f5..ec38e1cbdb 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/Make/options +++ b/applications/utilities/mesh/manipulation/setsToZones/Make/options @@ -2,4 +2,5 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lmeshTools + -lmeshTools \ + -lsampling diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C index 2f56bb5693..c3d3d6297a 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C +++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,7 @@ Description #include "IFstream.H" #include "IOobjectList.H" #include "SortableList.H" +#include "timeSelector.H" using namespace Foam; @@ -57,6 +58,7 @@ using namespace Foam; int main(int argc, char *argv[]) { + timeSelector::addOptions(true, false); argList::addNote ( "add point/face/cell Zones from similar named point/face/cell Sets" @@ -76,15 +78,7 @@ int main(int argc, char *argv[]) const bool noFlipMap = args.optionFound("noFlipMap"); // Get times list - instantList Times = runTime.times(); - - label startTime = Times.size()-1; - label endTime = Times.size(); - - // check -time and -latestTime options - #include "checkTimeOption.H" - - runTime.setTime(Times[startTime], startTime); + (void)timeSelector::selectIfPresent(runTime, args); #include "createNamedPolyMesh.H" diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 397dc7ecc2..363f09d7f3 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -446,13 +446,6 @@ class vtkPV3Foam template vtkPolyData* patchVTKMesh(const word& name, const PatchType&); - //- Add face zone mesh - vtkPolyData* faceZoneVTKMesh - ( - const fvMesh&, - const labelList& faceLabels - ); - //- Add point zone vtkPolyData* pointZoneVTKMesh ( diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C index b229da9479..b80acb4949 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C @@ -450,7 +450,8 @@ void Foam::vtkPV3Foam::convertMeshFaceZones << zoneName << endl; } - vtkPolyData* vtkmesh = faceZoneVTKMesh(mesh, zMesh[zoneId]); + vtkPolyData* vtkmesh = patchVTKMesh(zoneName, zMesh[zoneId]()); + if (vtkmesh) { AddToBlock(output, vtkmesh, range, datasetNo, zoneName); diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C index 28a1fd4c5f..bfa3e1acc9 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,78 +35,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh -( - const fvMesh& mesh, - const labelList& faceLabels -) -{ - vtkPolyData* vtkmesh = vtkPolyData::New(); - - if (debug) - { - Info<< " Foam::vtkPV3Foam::faceZoneVTKMesh" << endl; - printMemory(); - } - - // Construct primitivePatch of faces in faceZone - - const faceList& meshFaces = mesh.faces(); - faceList patchFaces(faceLabels.size()); - forAll(faceLabels, faceI) - { - patchFaces[faceI] = meshFaces[faceLabels[faceI]]; - } - primitiveFacePatch p(patchFaces, mesh.points()); - - - // The balance of this routine should be identical to patchVTKMesh - - // Convert OpenFOAM mesh vertices to VTK - const pointField& points = p.localPoints(); - - vtkPoints* vtkpoints = vtkPoints::New(); - vtkpoints->Allocate(points.size()); - forAll(points, i) - { - vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); - } - - vtkmesh->SetPoints(vtkpoints); - vtkpoints->Delete(); - - - // Add faces as polygons - const faceList& faces = p.localFaces(); - - vtkCellArray* vtkcells = vtkCellArray::New(); - vtkcells->Allocate(faces.size()); - - forAll(faces, faceI) - { - const face& f = faces[faceI]; - vtkIdType nodeIds[f.size()]; - - forAll(f, fp) - { - nodeIds[fp] = f[fp]; - } - vtkcells->InsertNextCell(f.size(), nodeIds); - } - - vtkmesh->SetPolys(vtkcells); - vtkcells->Delete(); - - if (debug) - { - Info<< " Foam::vtkPV3Foam::faceZoneVTKMesh" << endl; - printMemory(); - } - - return vtkmesh; -} - - vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh ( const fvMesh& mesh, diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H index 78582fe7e3..e74937cd2f 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,42 @@ void Foam::vtkPV3Foam::convertPointFields datasetNo ); } + + // + // Convert faceZones - if activated + // + for + ( + int partId = arrayRangeFaceZones_.start(); + partId < arrayRangeFaceZones_.end(); + ++partId + ) + { + const word zoneName = getPartName(partId); + const label datasetNo = partDataset_[partId]; + const label zoneId = mesh.faceZones().findZoneID(zoneName); + + if (!partStatus_[partId] || datasetNo < 0 || zoneId < 0) + { + continue; + } + + // Extract the field on the zone + Field fld + ( + ptf.internalField(), + mesh.faceZones()[zoneId]().meshPoints() + ); + + convertPatchPointField + ( + fieldName, + fld, + output, + arrayRangeFaceZones_, + datasetNo + ); + } } } diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 758627a29a..8a6301a545 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -101,7 +101,7 @@ cleanCase() rm -rf constant/tetDualMesh > /dev/null 2>&1 rm -rf VTK > /dev/null 2>&1 - rm -f 0/cellLevel 0/pointLevel + rm -f 0/cellLevel 0/pointLevel 0/cellDist constant/cellDecomposition if [ -e constant/polyMesh/blockMeshDict.m4 ] then diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 2fb7c7dfe2..d1061458e8 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -526,7 +526,7 @@ $(Fields)/symmTensorField/symmTensorField.C $(Fields)/tensorField/tensorField.C $(Fields)/complexFields/complexFields.C -$(Fields)/labelField/labelIOField. +$(Fields)/labelField/labelIOField.C $(Fields)/labelField/labelFieldIOField.C $(Fields)/scalarField/scalarIOField.C $(Fields)/scalarField/scalarFieldIOField.C diff --git a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C index 43d14a5740..1ea9ae6e11 100644 --- a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "SlicedGeometricField.H" +#include "processorFvPatch.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // @@ -40,7 +41,8 @@ slicedBoundaryField ( const Mesh& mesh, const Field& completeField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly ) { tmp > tbf @@ -52,7 +54,15 @@ slicedBoundaryField forAll(mesh.boundary(), patchi) { - if (preserveCouples && mesh.boundary()[patchi].coupled()) + if + ( + preserveCouples + && mesh.boundary()[patchi].coupled() + && ( + !preserveProcessorOnly + || isA(mesh.boundary()[patchi]) + ) + ) { // For coupled patched construct the correct patch field type bf.set @@ -243,7 +253,8 @@ SlicedGeometricField const dimensionSet& ds, const Field& completeIField, const Field& completeBField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly ) : GeometricField @@ -252,7 +263,13 @@ SlicedGeometricField mesh, ds, Field(), - slicedBoundaryField(mesh, completeBField, preserveCouples) + slicedBoundaryField + ( + mesh, + completeBField, + preserveCouples, + preserveProcessorOnly + ) ) { // Set the internalField to the slice of the complete field diff --git a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H index e04690e042..dd23712e67 100644 --- a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,7 +83,8 @@ private: ( const Mesh& mesh, const Field& completeField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly = false ); //- Slice the given field and a create a PtrList of SlicedPatchField @@ -133,7 +134,8 @@ public: const dimensionSet&, const Field& completeIField, const Field& completeBField, - const bool preserveCouples=true + const bool preserveCouples=true, + const bool preserveProcessorOnly = false ); //- Construct from GeometricField. Reuses full internal and diff --git a/src/conversion/meshReader/createPolyBoundary.C b/src/conversion/meshReader/createPolyBoundary.C index e0c898156a..47fb2008f7 100644 --- a/src/conversion/meshReader/createPolyBoundary.C +++ b/src/conversion/meshReader/createPolyBoundary.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -303,14 +303,12 @@ void Foam::meshReader::createPolyBoundary() Info<< "Added " << nMissingFaces << " unmatched faces" << endl; + // Add missing faces to last patch ('Default_Empty' etc.) if (nMissingFaces > 0) { patchSizes_.last() = nMissingFaces; } - else - { - patchStarts_.setSize(patchStarts_.size() - 1); - } + // reset the size of the face list meshFaces_.setSize(nCreatedFaces); diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index 0a06ef7364..5abdb45d11 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.C @@ -133,6 +133,8 @@ void fvMesh::makeC() const << abort(FatalError); } + // Construct as slices. Only preserve processor (not e.g. cyclic) + CPtr_ = new slicedVolVectorField ( IOobject @@ -148,33 +150,10 @@ void fvMesh::makeC() const *this, dimLength, cellCentres(), - faceCentres() + faceCentres(), + true, //preserveCouples + true //preserveProcOnly ); - - - // Need to correct for cyclics transformation since absolute quantity. - // Ok on processor patches since hold opposite cell centre (no - // transformation) - slicedVolVectorField& C = *CPtr_; - - forAll(C.boundaryField(), patchi) - { - if - ( - isA(C.boundaryField()[patchi]) - || isA(C.boundaryField()[patchi]) - ) - { - // Note: cyclic is not slice but proper field - C.boundaryField()[patchi] == static_cast - ( - static_cast&> - ( - boundary_[patchi].patchSlice(faceCentres()) - ) - ); - } - } } diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index 7c440dd78f..fa13513b50 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ LIB_LIBS = \ diff --git a/src/mesh/autoMesh/Make/options b/src/mesh/autoMesh/Make/options index ca8cb9e2e4..0ee4f07bb0 100644 --- a/src/mesh/autoMesh/Make/options +++ b/src/mesh/autoMesh/Make/options @@ -4,6 +4,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index 7cf1e79f61..e4cea95be2 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -167,7 +167,7 @@ class autoSnapDriver void correctAttraction ( const DynamicList& surfacePoints, - const DynamicList