diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index d3aefb6445..1ca6b3f29a 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -154,6 +154,12 @@ castellatedMeshControls //faceZone sphere; //cellZone sphere; //cellZoneInside inside; //outside/insidePoint + //- Optional specification of what to do with faceZone faces: + // internal : keep them as internal faces (default) + // baffle : create baffles from them. This gives more + // freedom in mesh motion + // boundary : create loose-standing boundary faces. + //faceType internal; } } diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index 5b2e78ca96..144196edf8 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -592,7 +592,7 @@ int main(int argc, char *argv[]) if (extractionMethod == "extractFromFile") { const fileName featureEdgeFile = - surfaceDict.subDict("extractFromFile").lookup + surfaceDict.subDict("extractFromFileCoeffs").lookup ( "featureEdgeFile" ); @@ -612,7 +612,7 @@ int main(int argc, char *argv[]) const scalar includedAngle = readScalar ( - surfaceDict.subDict("extractFromSurface").lookup + surfaceDict.subDict("extractFromSurfaceCoeffs").lookup ( "includedAngle" ) @@ -747,10 +747,10 @@ int main(int argc, char *argv[]) surfaceFeatures newSet(surf); newSet.setFromStatus(edgeStat); - if (writeObj) - { - newSet.writeObj("final"); - } + //if (writeObj) + //{ + // newSet.writeObj("final"); + //} Info<< nl << "Final feature set after trimming and subsetting:" << nl @@ -775,7 +775,7 @@ int main(int argc, char *argv[]) if (writeObj) { - feMesh.writeObj(surfFileName.lessExt().name()); + feMesh.writeObj(feMesh.path()/surfFileName.lessExt().name()); } feMesh.write(); diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict index ef97d13889..f201e49413 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict @@ -16,10 +16,34 @@ FoamFile surface1.stl { - // extractFromFile || extractFromSurface + // How to obtain raw features (extractFromFile || extractFromSurface) + extractionMethod extractFromSurface; + + extractFromSurfaceCoeffs + { + // Mark edges whose adjacent surface normals are at an angle less + // than includedAngle as features + // - 0 : selects no edges + // - 180: selects all edges + includedAngle 120; + } + + // Write options + + // Write .eMesh file (for snappyHexMesh) + writeFeatureEdgeMesh yes; + + // Write features to obj format for postprocessing + writeObj yes; +} + + +surface2.nas +{ + // How to obtain raw features (extractFromFile || extractFromSurface) extractionMethod extractFromFile; - extractFromFile + extractFromFileCoeffs { // Load from an existing feature edge file featureEdgeFile "constant/triSurface/featureEdges.nas"; @@ -62,25 +86,18 @@ surface1.stl closeness no; // Write options - writeVTK no; - writeObj yes; - writeFeatureEdgeMesh no; + + // Write .eMesh file (for snappyHexMesh) + writeFeatureEdgeMesh no; + + // Write features to obj format for postprocessing + writeObj yes; + + // Write surface proximity and curvature fields to vtk format + // for postprocessing + writeVTK no; } -surface2.nas -{ - extractionMethod extractFromSurface; - - extractFromSurface - { - // Mark edges whose adjacent surface normals are at an angle less - // than includedAngle as features - // - 0 : selects no edges - // - 180: selects all edges - includedAngle 120; - } -} - // ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index ea29efbb84..41769eb935 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.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 @@ -40,6 +40,7 @@ Description #include "snapParameters.H" #include "refinementSurfaces.H" #include "unitConversion.H" +#include "localPointRegion.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -1267,6 +1268,121 @@ void Foam::autoSnapDriver::doSnap meshRefiner_.createZoneBaffles(globalToPatch_, baffles); + // Selectively 'forget' about the baffles, i.e. not check across them + // or merge across them. + { + const faceZoneMesh& fZones = mesh.faceZones(); + const refinementSurfaces& surfaces = meshRefiner_.surfaces(); + const wordList& faceZoneNames = surfaces.faceZoneNames(); + const List& faceType = + surfaces.faceType(); + + // Determine which + // - faces to remove from list of baffles (so not merge) + // - points to duplicate + labelList filterFace(mesh.nFaces(), -1); + label nFilterFaces = 0; + PackedBoolList duplicatePoint(mesh.nPoints()); + label nDuplicatePoints = 0; + forAll(faceZoneNames, surfI) + { + if + ( + faceType[surfI] == refinementSurfaces::BAFFLE + || faceType[surfI] == refinementSurfaces::BOUNDARY + ) + { + if (faceZoneNames[surfI].size()) + { + // Filter out all faces for this zone. + label zoneI = fZones.findZoneID(faceZoneNames[surfI]); + const faceZone& fZone = fZones[zoneI]; + forAll(fZone, i) + { + label faceI = fZone[i]; + filterFace[faceI] = zoneI; + nFilterFaces++; + } + + if (faceType[surfI] == refinementSurfaces::BOUNDARY) + { + forAll(fZone, i) + { + label faceI = fZone[i]; + const face& f = mesh.faces()[faceI]; + forAll(f, fp) + { + if (!duplicatePoint[f[fp]]) + { + duplicatePoint[f[fp]] = 1; + nDuplicatePoints++; + } + } + } + } + + Info<< "Surface : " << surfaces.names()[surfI] << nl + << " faces to become baffle : " + << returnReduce(nFilterFaces, sumOp