Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
sergio
2012-04-04 15:17:04 +01:00
11 changed files with 355 additions and 60 deletions

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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;
}
}
// ************************************************************************* //

View File

@ -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<refinementSurfaces::faceZoneType>& 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<label>()) << nl
<< " points to duplicate : "
<< returnReduce(nDuplicatePoints, sumOp<label>())
<< endl;
}
}
}
// Duplicate points
if (returnReduce(nDuplicatePoints, sumOp<label>()) > 0)
{
// Collect all points
labelList candidatePoints(nDuplicatePoints);
nDuplicatePoints = 0;
forAll(duplicatePoint, pointI)
{
if (duplicatePoint[pointI])
{
candidatePoints[nDuplicatePoints++] = pointI;
}
}
localPointRegion regionSide(mesh, candidatePoints);
autoPtr<mapPolyMesh> mapPtr = meshRefiner_.dupNonManifoldPoints
(
regionSide
);
meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace);
}
// Forget about baffles in a BAFFLE/BOUNDARY type zone
DynamicList<labelPair> newBaffles(baffles.size());
forAll(baffles, i)
{
const labelPair& baffle = baffles[i];
if
(
filterFace[baffle.first()] == -1
&& filterFace[baffles[i].second()] == -1
)
{
newBaffles.append(baffle);
}
}
if (newBaffles.size() < baffles.size())
{
//Info<< "Splitting baffles into" << nl
// << " internal : " << newBaffles.size() << nl
// << " baffle : " << baffles.size()-newBaffles.size()
// << nl << endl;
baffles.transfer(newBaffles);
}
Info<< endl;
}
bool doFeatures = false;
label nFeatIter = 1;
if (snapParams.nFeatureSnap() > 0)

View File

@ -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
@ -70,6 +70,7 @@ class searchableSurface;
class regionSplit;
class globalIndex;
class removePoints;
class localPointRegion;
/*---------------------------------------------------------------------------*\
Class meshRefinement Declaration
@ -141,15 +142,6 @@ private:
// Private Member Functions
//- Reorder list according to map.
template<class T>
static void updateList
(
const labelList& newToOld,
const T& nullValue,
List<T>& elems
);
//- Add patchfield of given type to all fields on mesh
template<class GeoField>
static void addPatchFields(fvMesh&, const word& patchFieldType);
@ -707,6 +699,10 @@ public:
const point& keepPoint
);
//- Find boundary points that connect to more than one cell
// region and split them.
autoPtr<mapPolyMesh> dupNonManifoldPoints(const localPointRegion&);
//- Find boundary points that connect to more than one cell
// region and split them.
autoPtr<mapPolyMesh> dupNonManifoldPoints();
@ -780,6 +776,15 @@ public:
const labelList& changedFaces
);
//- Helper: reorder list according to map.
template<class T>
static void updateList
(
const labelList& newToOld,
const T& nullValue,
List<T>& elems
);
// Restoring : is where other processes delete and reinsert data.

View File

@ -2206,15 +2206,14 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
// Find boundary points that connect to more than one cell region and
// split them.
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints
(
const localPointRegion& regionSide
)
{
// Topochange container
polyTopoChange meshMod(mesh_);
// Analyse which points need to be duplicated
localPointRegion regionSide(mesh_);
label nNonManifPoints = returnReduce
(
regionSide.meshPointMap().size(),
@ -2260,6 +2259,17 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
}
// Find boundary points that connect to more than one cell region and
// split them.
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
{
// Analyse which points need to be duplicated
localPointRegion regionSide(mesh_);
return dupNonManifoldPoints(regionSide);
}
// Zoning
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
(

View File

@ -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
@ -49,12 +49,28 @@ namespace Foam
"none"
};
}
const Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>
Foam::refinementSurfaces::areaSelectionAlgoNames;
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::refinementSurfaces::faceZoneType,
3
>::names[] =
{
"internal",
"baffle",
"boundary"
};
}
const Foam::NamedEnum<Foam::refinementSurfaces::faceZoneType, 3>
Foam::refinementSurfaces::faceZoneTypeNames;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::refinementSurfaces::refinementSurfaces
@ -70,6 +86,7 @@ Foam::refinementSurfaces::refinementSurfaces
cellZoneNames_(surfacesDict.size()),
zoneInside_(surfacesDict.size(), NONE),
zoneInsidePoints_(surfacesDict.size()),
faceType_(surfacesDict.size(), INTERNAL),
regionOffset_(surfacesDict.size())
{
// Wilcard specification : loop over all surface, all regions
@ -93,6 +110,7 @@ Foam::refinementSurfaces::refinementSurfaces
faceZoneNames_.setSize(surfI);
cellZoneNames_.setSize(surfI);
zoneInside_.setSize(surfI, NONE);
faceType_.setSize(surfI, INTERNAL),
regionOffset_.setSize(surfI);
labelList globalMinLevel(surfI, 0);
@ -183,8 +201,17 @@ Foam::refinementSurfaces::refinementSurfaces
<< " since no cellZone specified."
<< endl;
}
// How to handle faces on faceZone
word faceTypeMethod;
if (dict.readIfPresent("faceType", faceTypeMethod))
{
faceType_[surfI] = faceZoneTypeNames[faceTypeMethod];
}
}
// Global perpendicular angle
if (dict.found("patchInfo"))
{

View File

@ -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
@ -70,6 +70,16 @@ public:
static const NamedEnum<areaSelectionAlgo, 4> areaSelectionAlgoNames;
//- What to do with faceZone faces
enum faceZoneType
{
INTERNAL,
BAFFLE,
BOUNDARY
};
static const NamedEnum<faceZoneType, 3> faceZoneTypeNames;
private:
// Private data
@ -97,6 +107,10 @@ private:
//- If zoneInside=location gives the corresponding inside point
pointField zoneInsidePoints_;
//- Per 'interface' surface :
// Waht to do with outside
List<faceZoneType> faceType_;
//- From local region number to global region number
labelList regionOffset_;
@ -187,6 +201,12 @@ public:
return zoneInsidePoints_;
}
//- How to handle face of surfaces with a faceZone
const List<faceZoneType>& faceType() const
{
return faceType_;
}
//- From local region number to global region number
const labelList& regionOffset() const
{

View File

@ -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

View File

@ -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;
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 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
heater.stl
{
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 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
leftSolid.stl
{
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 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
rightSolid.stl
{
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 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
topAir.stl
{
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 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
// ************************************************************************* //

View File

@ -18,7 +18,7 @@ flange.obj
{
extractionMethod extractFromSurface;
extractFromSurface
extractFromSurfaceCoeffs
{
// Mark edges whose adjacent surface normals are at an angle less
// than includedAngle as features
@ -27,10 +27,14 @@ flange.obj
includedAngle 155;
}
// Write options
writeVTK no;
writeObj yes;
writeFeatureEdgeMesh no;
// Write .eMesh file (for snappyHexMesh)
writeFeatureEdgeMesh no;
// Write features to obj format for postprocessing
writeObj yes;
}