From 9821123c86f17d3c4c0dbb5d86a1345214fc7886 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 2 Apr 2012 17:58:45 +0100 Subject: [PATCH 1/3] ENH: snappyMultiRegionHeater: adapt for surfaceFeatureExtractDict --- .../snappyMultiRegionHeater/Allrun | 11 +-- .../system/surfaceFeatureExtractDict | 99 +++++++++++++++++++ 2 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/surfaceFeatureExtractDict diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun index e6b1c579ee..7fa0f0dc78 100755 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun @@ -8,16 +8,7 @@ cd ${0%/*} || exit 1 # run from this directory rm -rf constant/polyMesh/sets runApplication blockMesh -runApplication surfaceFeatureExtract -includedAngle 150 constant/triSurface/bottomAir.stl bottomAir -mv log.surfaceFeatureExtract log.surfaceFeatureExtract.bottom -runApplication surfaceFeatureExtract -includedAngle 150 constant/triSurface/heater.stl heater -mv log.surfaceFeatureExtract log.surfaceFeatureExtract.heater -runApplication surfaceFeatureExtract -includedAngle 150 constant/triSurface/leftSolid.stl leftSolid -mv log.surfaceFeatureExtract log.surfaceFeatureExtract.leftSolid -runApplication surfaceFeatureExtract -includedAngle 150 constant/triSurface/rightSolid.stl rightSolid -mv log.surfaceFeatureExtract log.surfaceFeatureExtract.rightSolid -runApplication surfaceFeatureExtract -includedAngle 150 constant/triSurface/topAir.stl topAir -mv log.surfaceFeatureExtract log.surfaceFeatureExtract.topAir +runApplication surfaceFeatureExtract runApplication snappyHexMesh -overwrite runApplication splitMeshRegions -cellZones -overwrite diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/surfaceFeatureExtractDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/surfaceFeatureExtractDict new file mode 100644 index 0000000000..58e3443201 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/surfaceFeatureExtractDict @@ -0,0 +1,99 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object surfaceFeatureExtractDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +bottomAir.stl +{ + 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 150; + } + + // Write options + writeFeatureEdgeMesh yes; +} +heater.stl +{ + 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 150; + } + + // Write options + writeFeatureEdgeMesh yes; +} +leftSolid.stl +{ + 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 150; + } + + // Write options + writeFeatureEdgeMesh yes; +} +rightSolid.stl +{ + 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 150; + } + + // Write options + writeFeatureEdgeMesh yes; +} +topAir.stl +{ + 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 150; + } + + // Write options + writeFeatureEdgeMesh yes; +} + + +// ************************************************************************* // From 124295b3c9a5b7081f254432bf17305728a43a06 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 2 Apr 2012 18:02:16 +0100 Subject: [PATCH 2/3] ENH: autoSnapDriver: preserve baffles on faceZone surfaces --- .../snappyHexMesh/snappyHexMeshDict | 6 + .../autoHexMeshDriver/autoSnapDriver.C | 118 +++++++++++++++++- .../meshRefinement/meshRefinement.H | 25 ++-- .../meshRefinement/meshRefinementBaffles.C | 20 ++- .../refinementSurfaces/refinementSurfaces.C | 33 ++++- .../refinementSurfaces/refinementSurfaces.H | 22 +++- 6 files changed, 204 insertions(+), 20 deletions(-) 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/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