ENH: shm: support for automatic faceZones

This commit is contained in:
Mattijs Janssens
2020-01-16 12:22:02 +00:00
committed by Andrew Heather
parent 0c7140c967
commit b8c2c0acf6
26 changed files with 15695 additions and 322 deletions

View File

@ -585,35 +585,52 @@ void Foam::conformalVoronoiMesh::addZones
labelList namedSurfaces(surfaceZonesInfo::getNamedSurfaces(surfZones)); labelList namedSurfaces(surfaceZonesInfo::getNamedSurfaces(surfZones));
// Tbd. No support yet for multi-faceZones on outside of cellZone
forAll(namedSurfaces, i) forAll(namedSurfaces, i)
{ {
label surfI = namedSurfaces[i]; label surfI = namedSurfaces[i];
const wordList& fzNames = surfZones[surfI].faceZoneNames();
Info<< incrIndent << indent << "Surface : " Info<< incrIndent << indent << "Surface : "
<< geometryToConformTo().geometry().names()[surfI] << nl << geometryToConformTo().geometry().names()[surfI] << nl
<< indent << " faceZone : " << indent << " faceZone : "
<< surfZones[surfI].faceZoneName() << nl << (fzNames.size() ? fzNames[0] : "") << nl
<< indent << " cellZone : " << indent << " cellZone : "
<< surfZones[surfI].cellZoneName() << surfZones[surfI].cellZoneName()
<< decrIndent << endl; << decrIndent << endl;
} }
// Add zones to mesh // Add zones to mesh
labelList surfaceToFaceZone = labelList surfaceToFaceZone(surfZones.size(), -1);
surfaceZonesInfo::addFaceZonesToMesh {
const labelListList surfaceToFaceZones
( (
surfZones, surfaceZonesInfo::addFaceZonesToMesh
namedSurfaces, (
mesh surfZones,
namedSurfaces,
mesh
)
); );
forAll(surfaceToFaceZones, surfi)
{
if (surfaceToFaceZones[surfi].size())
{
surfaceToFaceZone[surfi] = surfaceToFaceZones[surfi][0];
}
}
}
labelList surfaceToCellZone = const labelList surfaceToCellZone
(
surfaceZonesInfo::addCellZonesToMesh surfaceZonesInfo::addCellZonesToMesh
( (
surfZones, surfZones,
namedSurfaces, namedSurfaces,
mesh mesh
); )
);
// Topochange container // Topochange container
polyTopoChange meshMod(mesh); polyTopoChange meshMod(mesh);

View File

@ -355,7 +355,16 @@ Foam::conformationSurfaces::conformationSurfaces
// Surface zones // Surface zones
if (dict.found("faceZone")) if (dict.found("faceZone"))
{ {
surfZones_.set(surfI, new surfaceZonesInfo(surface, dict)); surfZones_.set
(
surfI,
new surfaceZonesInfo
(
surface,
dict,
allGeometry_.regionNames()[surfaces_[surfI]]
)
);
} }
allGeometryToSurfaces_[surfaces_[surfI]] = surfI; allGeometryToSurfaces_[surfaces_[surfI]] = surfI;

View File

@ -163,7 +163,16 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
globalLevelIncr[surfi] = gapLevelIncrement; globalLevelIncr[surfi] = gapLevelIncrement;
// Surface zones // Surface zones
surfZones.set(surfi, new surfaceZonesInfo(surface, shapeDict)); surfZones.set
(
surfi,
new surfaceZonesInfo
(
surface,
shapeDict,
allGeometry.regionNames()[surfaces[surfi]]
)
);
// Global perpendicular angle // Global perpendicular angle
@ -1395,9 +1404,10 @@ int main(int argc, char *argv[])
Info<< surfaces.names()[surfi] << ':' << nl << nl; Info<< surfaces.names()[surfi] << ':' << nl << nl;
} }
const word& fzName = surfaces.surfZones()[surfi].faceZoneName(); const wordList& fzNames =
surfaces.surfZones()[surfi].faceZoneNames();
if (fzName.empty()) if (fzNames.empty())
{ {
// 'Normal' surface // 'Normal' surface
forAll(regNames, i) forAll(regNames, i)
@ -1520,15 +1530,19 @@ int main(int argc, char *argv[])
// region in surface for patch for zoning // region in surface for patch for zoning
if (regNames.size()) if (regNames.size())
{ {
label globalRegioni = surfaces.globalRegion(surfi, 0); forAll(fzNames, fzi)
{
const word& fzName = fzNames[fzi];
label globalRegioni = surfaces.globalRegion(surfi, fzi);
meshRefiner.addFaceZone meshRefiner.addFaceZone
( (
fzName, fzName,
pbm[globalToMasterPatch[globalRegioni]].name(), pbm[globalToMasterPatch[globalRegioni]].name(),
pbm[globalToSlavePatch[globalRegioni]].name(), pbm[globalToSlavePatch[globalRegioni]].name(),
surfaces.surfZones()[surfi].faceType() surfaces.surfZones()[surfi].faceType()
); );
}
} }
} }

View File

@ -597,14 +597,15 @@ private:
) const; ) const;
//- Calculate intersections on zoned faces. Return per face -1 //- Calculate intersections on zoned faces. Return per face -1
// or the index of the surface and the orientation w.r.t. surface // or the global region of the surface and the orientation
// w.r.t. surface
void getIntersections void getIntersections
( (
const labelList& surfacesToTest, const labelList& surfacesToTest,
const pointField& neiCc, const pointField& neiCc,
const labelList& testFaces, const labelList& testFaces,
labelList& namedSurfaceIndex, labelList& namedSurfaceRegion,
bitSet& posOrientation bitSet& posOrientation
) const; ) const;
@ -737,13 +738,13 @@ private:
//- Finds zone per cell for cells inside closed named surfaces. //- Finds zone per cell for cells inside closed named surfaces.
// (uses geometric test for insideness) // (uses geometric test for insideness)
// Adapts namedSurfaceIndex so all faces on boundary of cellZone // Adapts namedSurfaceRegion so all faces on boundary of cellZone
// have corresponding faceZone. // have corresponding faceZone.
void findCellZoneGeometric void findCellZoneGeometric
( (
const pointField& neiCc, const pointField& neiCc,
const labelList& closedNamedSurfaces, const labelList& closedNamedSurfaces,
labelList& namedSurfaceIndex, labelList& namedSurfaceRegion,
const labelList& surfaceToCellZone, const labelList& surfaceToCellZone,
labelList& cellToZone labelList& cellToZone
) const; ) const;
@ -781,14 +782,14 @@ private:
//- Finds zone per cell. Uses topological walk with all faces //- Finds zone per cell. Uses topological walk with all faces
// marked in unnamedSurfaceRegion (intersections with unnamed // marked in unnamedSurfaceRegion (intersections with unnamed
// surfaces) and namedSurfaceIndex (intersections with named // surfaces) and namedSurfaceRegion (intersections with named
// surfaces) regarded as blocked. // surfaces) regarded as blocked.
void findCellZoneTopo void findCellZoneTopo
( (
const label backgroundZoneID, const label backgroundZoneID,
const pointField& locationsInMesh, const pointField& locationsInMesh,
const labelList& unnamedSurfaceRegion, const labelList& unnamedSurfaceRegion,
const labelList& namedSurfaceIndex, const labelList& namedSurfaceRegion,
const labelList& surfaceToCellZone, const labelList& surfaceToCellZone,
labelList& cellToZone labelList& cellToZone
) const; ) const;
@ -800,17 +801,17 @@ private:
const label nErodeCellZones, const label nErodeCellZones,
const label backgroundZoneID, const label backgroundZoneID,
const labelList& unnamedSurfaceRegion, const labelList& unnamedSurfaceRegion,
const labelList& namedSurfaceIndex, const labelList& namedSurfaceRegion,
labelList& cellToZone labelList& cellToZone
) const; ) const;
//- Make namedSurfaceIndex consistent with cellToZone //- Make namedSurfaceRegion consistent with cellToZone
// - clear out any blocked faces inbetween same cell zone. // - clear out any blocked faces inbetween same cell zone.
void makeConsistentFaceIndex void makeConsistentFaceIndex
( (
const labelList& zoneToNamedSurface, const labelList& zoneToNamedSurface,
const labelList& cellToZone, const labelList& cellToZone,
labelList& namedSurfaceIndex labelList& namedSurfaceRegion
) const; ) const;
//- Calculate cellZone allocation //- Calculate cellZone allocation
@ -825,7 +826,7 @@ private:
labelList& cellToZone, labelList& cellToZone,
labelList& unnamedRegion1, labelList& unnamedRegion1,
labelList& unnamedRegion2, labelList& unnamedRegion2,
labelList& namedSurfaceIndex, labelList& namedSurfaceRegion,
bitSet& posOrientation bitSet& posOrientation
) const; ) const;

View File

@ -307,7 +307,7 @@ void Foam::meshRefinement::getBafflePatches
labelList cellToZone; labelList cellToZone;
labelList unnamedRegion1; labelList unnamedRegion1;
labelList unnamedRegion2; labelList unnamedRegion2;
labelList namedSurfaceIndex; labelList namedSurfaceRegion;
{ {
bitSet posOrientation; bitSet posOrientation;
zonify zonify
@ -321,7 +321,7 @@ void Foam::meshRefinement::getBafflePatches
cellToZone, cellToZone,
unnamedRegion1, unnamedRegion1,
unnamedRegion2, unnamedRegion2,
namedSurfaceIndex, namedSurfaceRegion,
posOrientation posOrientation
); );
} }
@ -381,8 +381,8 @@ void Foam::meshRefinement::getBafflePatches
|| (neiZone >= 0 && ownZone != -2) || (neiZone >= 0 && ownZone != -2)
) )
&& ( && (
namedSurfaceIndex.size() == 0 namedSurfaceRegion.size() == 0
|| namedSurfaceIndex[faceI] == -1 || namedSurfaceRegion[faceI] == -1
) )
) )
{ {
@ -426,17 +426,17 @@ Foam::Map<Foam::labelPair> Foam::meshRefinement::getZoneBafflePatches
forAll(surfZones, surfI) forAll(surfZones, surfI)
{ {
const word& faceZoneName = surfZones[surfI].faceZoneName(); const wordList& faceZoneNames = surfZones[surfI].faceZoneNames();
if (faceZoneName.size()) forAll(faceZoneNames, fzi)
{ {
// Get zone // Get zone
const word& faceZoneName = faceZoneNames[fzi];
label zoneI = fZones.findZoneID(faceZoneName); label zoneI = fZones.findZoneID(faceZoneName);
const faceZone& fZone = fZones[zoneI]; const faceZone& fZone = fZones[zoneI];
// Get patch allocated for zone // Get patch allocated for zone
label globalRegionI = surfaces_.globalRegion(surfI, 0); label globalRegionI = surfaces_.globalRegion(surfI, fzi);
labelPair zPatches labelPair zPatches
( (
globalToMasterPatch[globalRegionI], globalToMasterPatch[globalRegionI],
@ -1370,7 +1370,7 @@ void Foam::meshRefinement::findCellZoneGeometric
( (
const pointField& neiCc, const pointField& neiCc,
const labelList& closedNamedSurfaces, // indices of closed surfaces const labelList& closedNamedSurfaces, // indices of closed surfaces
labelList& namedSurfaceIndex, // per face index of named surface labelList& namedSurfaceRegion, // per face: named surface region
const labelList& surfaceToCellZone, // cell zone index per surface const labelList& surfaceToCellZone, // cell zone index per surface
labelList& cellToZone labelList& cellToZone
@ -1418,11 +1418,9 @@ void Foam::meshRefinement::findCellZoneGeometric
// Count points to test. // Count points to test.
label nCandidates = 0; label nCandidates = 0;
forAll(namedSurfaceIndex, faceI) forAll(namedSurfaceRegion, faceI)
{ {
label surfI = namedSurfaceIndex[faceI]; if (namedSurfaceRegion[faceI] != -1)
if (surfI != -1)
{ {
if (mesh_.isInternalFace(faceI)) if (mesh_.isInternalFace(faceI))
{ {
@ -1438,11 +1436,9 @@ void Foam::meshRefinement::findCellZoneGeometric
// Collect points. // Collect points.
pointField candidatePoints(nCandidates); pointField candidatePoints(nCandidates);
nCandidates = 0; nCandidates = 0;
forAll(namedSurfaceIndex, faceI) forAll(namedSurfaceRegion, faceI)
{ {
label surfI = namedSurfaceIndex[faceI]; if (namedSurfaceRegion[faceI] != -1)
if (surfI != -1)
{ {
label own = faceOwner[faceI]; label own = faceOwner[faceI];
const point& ownCc = cellCentres[own]; const point& ownCc = cellCentres[own];
@ -1482,11 +1478,9 @@ void Foam::meshRefinement::findCellZoneGeometric
// 3. Update zone information // 3. Update zone information
nCandidates = 0; nCandidates = 0;
forAll(namedSurfaceIndex, faceI) forAll(namedSurfaceRegion, faceI)
{ {
label surfI = namedSurfaceIndex[faceI]; if (namedSurfaceRegion[faceI] != -1)
if (surfI != -1)
{ {
label own = faceOwner[faceI]; label own = faceOwner[faceI];
@ -1518,8 +1512,8 @@ void Foam::meshRefinement::findCellZoneGeometric
} }
// Adapt the namedSurfaceIndex // Adapt the namedSurfaceRegion
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// for if any cells were not completely covered. // for if any cells were not completely covered.
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
@ -1527,7 +1521,7 @@ void Foam::meshRefinement::findCellZoneGeometric
label ownZone = cellToZone[mesh_.faceOwner()[faceI]]; label ownZone = cellToZone[mesh_.faceOwner()[faceI]];
label neiZone = cellToZone[mesh_.faceNeighbour()[faceI]]; label neiZone = cellToZone[mesh_.faceNeighbour()[faceI]];
if (namedSurfaceIndex[faceI] == -1 && (ownZone != neiZone)) if (namedSurfaceRegion[faceI] == -1 && (ownZone != neiZone))
{ {
// Give face the zone of min cell zone (but only if the // Give face the zone of min cell zone (but only if the
// cellZone originated from a closed, named surface) // cellZone originated from a closed, named surface)
@ -1546,12 +1540,14 @@ void Foam::meshRefinement::findCellZoneGeometric
minZone = min(ownZone, neiZone); minZone = min(ownZone, neiZone);
} }
// Make sure the cellZone originated from a closed surface // Make sure the cellZone originated from a closed surface. Use
// hardcoded region 0 inside named surface.
label geomSurfI = surfaceToCellZone.find(minZone); label geomSurfI = surfaceToCellZone.find(minZone);
if (geomSurfI != -1) if (geomSurfI != -1)
{ {
namedSurfaceIndex[faceI] = geomSurfI; namedSurfaceRegion[faceI] =
surfaces_.globalRegion(geomSurfI, 0);
} }
} }
} }
@ -1573,7 +1569,7 @@ void Foam::meshRefinement::findCellZoneGeometric
label ownZone = cellToZone[mesh_.faceOwner()[faceI]]; label ownZone = cellToZone[mesh_.faceOwner()[faceI]];
label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()]; label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()];
if (namedSurfaceIndex[faceI] == -1 && (ownZone != neiZone)) if (namedSurfaceRegion[faceI] == -1 && (ownZone != neiZone))
{ {
// Give face the min cell zone // Give face the min cell zone
label minZone; label minZone;
@ -1590,12 +1586,14 @@ void Foam::meshRefinement::findCellZoneGeometric
minZone = min(ownZone, neiZone); minZone = min(ownZone, neiZone);
} }
// Make sure the cellZone originated from a closed surface // Make sure the cellZone originated from a closed surface.
// Use hardcoded region 0 inside named surface.
label geomSurfI = surfaceToCellZone.find(minZone); label geomSurfI = surfaceToCellZone.find(minZone);
if (geomSurfI != -1) if (geomSurfI != -1)
{ {
namedSurfaceIndex[faceI] = geomSurfI; namedSurfaceRegion[faceI] =
surfaces_.globalRegion(geomSurfI, 0);
} }
} }
} }
@ -1603,7 +1601,7 @@ void Foam::meshRefinement::findCellZoneGeometric
} }
// Sync // Sync
syncTools::syncFaceList(mesh_, namedSurfaceIndex, maxEqOp<label>()); syncTools::syncFaceList(mesh_, namedSurfaceRegion, maxEqOp<label>());
} }
@ -1839,7 +1837,7 @@ void Foam::meshRefinement::findCellZoneTopo
const label backgroundZoneID, const label backgroundZoneID,
const pointField& locationsInMesh, const pointField& locationsInMesh,
const labelList& unnamedSurfaceRegion, const labelList& unnamedSurfaceRegion,
const labelList& namedSurfaceIndex, const labelList& namedSurfaceRegion,
const labelList& surfaceToCellZone, const labelList& surfaceToCellZone,
labelList& cellToZone labelList& cellToZone
) const ) const
@ -1848,7 +1846,7 @@ void Foam::meshRefinement::findCellZoneTopo
// (after all off the unreachable bits of the mesh have been removed). // (after all off the unreachable bits of the mesh have been removed).
// This routine splits the mesh into regions, based on the intersection // This routine splits the mesh into regions, based on the intersection
// with a surface. The problem is that we know the surface which // with a surface. The problem is that we know the surface which
// (intersected) face belongs to (in namedSurfaceIndex) but we don't // (intersected) face belongs to (in namedSurfaceRegion) but we don't
// know which side of the face it relates to. So all we are doing here // know which side of the face it relates to. So all we are doing here
// is get the correspondence between surface/cellZone and regionSplit // is get the correspondence between surface/cellZone and regionSplit
// region. See the logic in calcRegionToZone. // region. See the logic in calcRegionToZone.
@ -1862,14 +1860,18 @@ void Foam::meshRefinement::findCellZoneTopo
// Assumes: // Assumes:
// - region containing keepPoint does not go into a cellZone // - region containing keepPoint does not go into a cellZone
// - all other regions can be found by crossing faces marked in // - all other regions can be found by crossing faces marked in
// namedSurfaceIndex. // namedSurfaceRegion.
// Analyse regions. Reuse regionsplit // Analyse regions. Reuse regionsplit
boolList blockedFace(mesh_.nFaces()); boolList blockedFace(mesh_.nFaces());
forAll(unnamedSurfaceRegion, faceI) forAll(unnamedSurfaceRegion, faceI)
{ {
if (unnamedSurfaceRegion[faceI] == -1 && namedSurfaceIndex[faceI] == -1) if
(
unnamedSurfaceRegion[faceI] == -1
&& namedSurfaceRegion[faceI] == -1
)
{ {
blockedFace[faceI] = false; blockedFace[faceI] = false;
} }
@ -1878,7 +1880,7 @@ void Foam::meshRefinement::findCellZoneTopo
blockedFace[faceI] = true; blockedFace[faceI] = true;
} }
} }
// No need to sync since namedSurfaceIndex already is synced // No need to sync since namedSurfaceRegion already is synced
// Set region per cell based on walking // Set region per cell based on walking
regionSplit cellRegion(mesh_, blockedFace); regionSplit cellRegion(mesh_, blockedFace);
@ -1968,13 +1970,16 @@ void Foam::meshRefinement::findCellZoneTopo
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
{ {
label surfI = namedSurfaceIndex[faceI]; label regionI = namedSurfaceRegion[faceI];
// Connected even if no cellZone defined for surface // Connected even if no cellZone defined for surface
if (unnamedSurfaceRegion[faceI] == -1 && surfI != -1) if (unnamedSurfaceRegion[faceI] == -1 && regionI != -1)
{ {
// Calculate region to zone from cellRegions on either side // Calculate region to zone from cellRegions on either side
// of internal face. // of internal face.
label surfI = surfaces_.whichSurface(regionI).first();
bool changedCell = calcRegionToZone bool changedCell = calcRegionToZone
( (
backgroundZoneID, backgroundZoneID,
@ -2008,11 +2013,13 @@ void Foam::meshRefinement::findCellZoneTopo
{ {
label faceI = pp.start()+i; label faceI = pp.start()+i;
label surfI = namedSurfaceIndex[faceI]; label regionI = namedSurfaceRegion[faceI];
// Connected even if no cellZone defined for surface // Connected even if no cellZone defined for surface
if (unnamedSurfaceRegion[faceI] == -1 && surfI != -1) if (unnamedSurfaceRegion[faceI] == -1 && regionI != -1)
{ {
label surfI = surfaces_.whichSurface(regionI).first();
bool changedCell = calcRegionToZone bool changedCell = calcRegionToZone
( (
backgroundZoneID, backgroundZoneID,
@ -2070,7 +2077,7 @@ void Foam::meshRefinement::erodeCellZone
const label nErodeCellZones, const label nErodeCellZones,
const label backgroundZoneID, const label backgroundZoneID,
const labelList& unnamedSurfaceRegion, const labelList& unnamedSurfaceRegion,
const labelList& namedSurfaceIndex, const labelList& namedSurfaceRegion,
labelList& cellToZone labelList& cellToZone
) const ) const
{ {
@ -2097,7 +2104,7 @@ void Foam::meshRefinement::erodeCellZone
if if
( (
unnamedSurfaceRegion[facei] == -1 unnamedSurfaceRegion[facei] == -1
&& namedSurfaceIndex[facei] == -1 && namedSurfaceRegion[facei] == -1
) )
{ {
label own = mesh_.faceOwner()[facei]; label own = mesh_.faceOwner()[facei];
@ -2137,7 +2144,7 @@ void Foam::meshRefinement::erodeCellZone
if if
( (
unnamedSurfaceRegion[facei] == -1 unnamedSurfaceRegion[facei] == -1
&& namedSurfaceIndex[facei] == -1 && namedSurfaceRegion[facei] == -1
) )
{ {
label own = mesh_.faceOwner()[facei]; label own = mesh_.faceOwner()[facei];
@ -2174,14 +2181,14 @@ void Foam::meshRefinement::makeConsistentFaceIndex
( (
const labelList& surfaceMap, const labelList& surfaceMap,
const labelList& cellToZone, const labelList& cellToZone,
labelList& namedSurfaceIndex labelList& namedSurfaceRegion
) const ) const
{ {
// Make namedSurfaceIndex consistent with cellToZone - clear out any // Make namedSurfaceRegion consistent with cellToZone - clear out any
// blocked faces inbetween same cell zone (or background (=-1)) // blocked faces inbetween same cell zone (or background (=-1))
// Do not do this for surfaces relating to 'pure' faceZones i.e. // Do not do this for surfaces relating to 'pure' faceZones i.e.
// faceZones without a cellZone. Note that we cannot check here // faceZones without a cellZone. Note that we cannot check here
// for different cellZones on either side but no namedSurfaceIndex // for different cellZones on either side but no namedSurfaceRegion
// since cellZones can now originate from locationsInMesh as well // since cellZones can now originate from locationsInMesh as well
// (instead of only through named surfaces) // (instead of only through named surfaces)
@ -2192,15 +2199,16 @@ void Foam::meshRefinement::makeConsistentFaceIndex
{ {
label ownZone = cellToZone[faceOwner[faceI]]; label ownZone = cellToZone[faceOwner[faceI]];
label neiZone = cellToZone[faceNeighbour[faceI]]; label neiZone = cellToZone[faceNeighbour[faceI]];
label globalI = namedSurfaceRegion[faceI];
if if
( (
ownZone == neiZone ownZone == neiZone
&& namedSurfaceIndex[faceI] != -1 && globalI != -1
&& surfaceMap[namedSurfaceIndex[faceI]] == -1 && surfaceMap[surfaces_.whichSurface(globalI).first()] == -1
) )
{ {
namedSurfaceIndex[faceI] = -1; namedSurfaceRegion[faceI] = -1;
} }
} }
@ -2223,15 +2231,16 @@ void Foam::meshRefinement::makeConsistentFaceIndex
label ownZone = cellToZone[faceOwner[faceI]]; label ownZone = cellToZone[faceOwner[faceI]];
label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()]; label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()];
label globalI = namedSurfaceRegion[faceI];
if if
( (
ownZone == neiZone ownZone == neiZone
&& namedSurfaceIndex[faceI] != -1 && globalI != -1
&& surfaceMap[namedSurfaceIndex[faceI]] == -1 && surfaceMap[surfaces_.whichSurface(globalI).first()] == -1
) )
{ {
namedSurfaceIndex[faceI] = -1; namedSurfaceRegion[faceI] = -1;
} }
} }
} }
@ -2241,14 +2250,15 @@ void Foam::meshRefinement::makeConsistentFaceIndex
forAll(pp, i) forAll(pp, i)
{ {
label faceI = pp.start()+i; label faceI = pp.start()+i;
label globalI = namedSurfaceRegion[faceI];
if if
( (
namedSurfaceIndex[faceI] != -1 globalI != -1
&& surfaceMap[namedSurfaceIndex[faceI]] == -1 && surfaceMap[surfaces_.whichSurface(globalI).first()] == -1
) )
{ {
namedSurfaceIndex[faceI] = -1; namedSurfaceRegion[faceI] = -1;
} }
} }
} }
@ -2262,12 +2272,12 @@ void Foam::meshRefinement::getIntersections
const pointField& neiCc, const pointField& neiCc,
const labelList& testFaces, const labelList& testFaces,
labelList& namedSurfaceIndex, labelList& namedSurfaceRegion,
bitSet& posOrientation bitSet& posOrientation
) const ) const
{ {
namedSurfaceIndex.setSize(mesh_.nFaces()); namedSurfaceRegion.setSize(mesh_.nFaces());
namedSurfaceIndex = -1; namedSurfaceRegion = -1;
posOrientation.setSize(mesh_.nFaces()); posOrientation.setSize(mesh_.nFaces());
posOrientation = false; posOrientation = false;
@ -2300,31 +2310,30 @@ void Foam::meshRefinement::getIntersections
// the information already in surfaceIndex_. // the information already in surfaceIndex_.
labelList surface1; labelList surface1;
labelList region1;
List<pointIndexHit> hit1; List<pointIndexHit> hit1;
vectorField normal1; vectorField normal1;
labelList surface2; labelList surface2;
labelList region2;
List<pointIndexHit> hit2; List<pointIndexHit> hit2;
vectorField normal2; vectorField normal2;
{
labelList region1;
labelList region2;
surfaces_.findNearestIntersection
(
surfacesToTest,
start,
end,
surface1, surfaces_.findNearestIntersection
hit1, (
region1, surfacesToTest,
normal1, start,
end,
surface2, surface1,
hit2, hit1,
region2, region1,
normal2 normal1,
);
} surface2,
hit2,
region2,
normal2
);
forAll(testFaces, i) forAll(testFaces, i)
{ {
@ -2343,20 +2352,32 @@ void Foam::meshRefinement::getIntersections
) )
) )
{ {
namedSurfaceIndex[faceI] = surface2[i]; namedSurfaceRegion[faceI] = surfaces_.globalRegion
(
surface2[i],
region2[i]
);
posOrientation.set(faceI, ((area&normal2[i]) > 0)); posOrientation.set(faceI, ((area&normal2[i]) > 0));
nSurfFaces[surface2[i]]++; nSurfFaces[surface2[i]]++;
} }
else else
{ {
namedSurfaceIndex[faceI] = surface1[i]; namedSurfaceRegion[faceI] = surfaces_.globalRegion
(
surface1[i],
region1[i]
);
posOrientation.set(faceI, ((area&normal1[i]) > 0)); posOrientation.set(faceI, ((area&normal1[i]) > 0));
nSurfFaces[surface1[i]]++; nSurfFaces[surface1[i]]++;
} }
} }
else if (surface2[i] != -1) else if (surface2[i] != -1)
{ {
namedSurfaceIndex[faceI] = surface2[i]; namedSurfaceRegion[faceI] = surfaces_.globalRegion
(
surface2[i],
region2[i]
);
posOrientation.set(faceI, ((area&normal2[i]) > 0)); posOrientation.set(faceI, ((area&normal2[i]) > 0));
nSurfFaces[surface2[i]]++; nSurfFaces[surface2[i]]++;
} }
@ -2370,7 +2391,7 @@ void Foam::meshRefinement::getIntersections
syncTools::syncFaceList syncTools::syncFaceList
( (
mesh_, mesh_,
namedSurfaceIndex, namedSurfaceRegion,
maxEqOp<label>() maxEqOp<label>()
); );
@ -2399,7 +2420,7 @@ void Foam::meshRefinement::zonify
labelList& cellToZone, labelList& cellToZone,
labelList& unnamedRegion1, labelList& unnamedRegion1,
labelList& unnamedRegion2, labelList& unnamedRegion2,
labelList& namedSurfaceIndex, labelList& namedSurfaceRegion,
bitSet& posOrientation bitSet& posOrientation
) const ) const
{ {
@ -2408,9 +2429,9 @@ void Foam::meshRefinement::zonify
// -2 : unset // -2 : unset
// -1 : not in any zone (zone 'none' or background zone) // -1 : not in any zone (zone 'none' or background zone)
// >=0 : zoneID // >=0 : zoneID
// namedSurfaceIndex, posOrientation: // namedSurfaceRegion, posOrientation:
// -1 : face not intersected by named surface // -1 : face not intersected by named surface
// >=0 : index of named surface // >=0 : globalRegion (surface+region)
// (and posOrientation: surface normal v.s. face normal) // (and posOrientation: surface normal v.s. face normal)
const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones(); const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones();
@ -2441,7 +2462,7 @@ void Foam::meshRefinement::zonify
cellToZone.setSize(mesh_.nCells()); cellToZone.setSize(mesh_.nCells());
cellToZone = -2; cellToZone = -2;
namedSurfaceIndex.clear(); namedSurfaceRegion.clear();
posOrientation.clear(); posOrientation.clear();
@ -2466,7 +2487,7 @@ void Foam::meshRefinement::zonify
namedSurfaces, namedSurfaces,
neiCc, neiCc,
intersectedFaces(), intersectedFaces(),
namedSurfaceIndex, namedSurfaceRegion,
posOrientation posOrientation
); );
} }
@ -2551,12 +2572,12 @@ void Foam::meshRefinement::zonify
// Stop at unnamed or named surface // Stop at unnamed or named surface
labelList allRegion1(mesh_.nFaces(), -1); labelList allRegion1(mesh_.nFaces(), -1);
forAll(namedSurfaceIndex, faceI) forAll(namedSurfaceRegion, faceI)
{ {
allRegion1[faceI] = max allRegion1[faceI] = max
( (
unnamedRegion1[faceI], unnamedRegion1[faceI],
namedSurfaceIndex[faceI] namedSurfaceRegion[faceI]
); );
} }
@ -2595,7 +2616,7 @@ void Foam::meshRefinement::zonify
( (
neiCc, neiCc,
closedNamedSurfaces, // indices of closed surfaces closedNamedSurfaces, // indices of closed surfaces
namedSurfaceIndex, // per face index of named surface namedSurfaceRegion, // per face index of named surface + region
surfaceToCellZone, // cell zone index per surface surfaceToCellZone, // cell zone index per surface
cellToZone cellToZone
@ -2618,7 +2639,7 @@ void Foam::meshRefinement::zonify
backgroundZoneID, backgroundZoneID,
pointField(0), pointField(0),
unnamedRegion1, // Intersections with unnamed surfaces unnamedRegion1, // Intersections with unnamed surfaces
namedSurfaceIndex, // Intersections with named surfaces namedSurfaceRegion, // Intersections with named surfaces
surfaceToCellZone, surfaceToCellZone,
cellToZone cellToZone
); );
@ -2635,13 +2656,13 @@ void Foam::meshRefinement::zonify
nErodeCellZones, nErodeCellZones,
backgroundZoneID, backgroundZoneID,
unnamedRegion1, unnamedRegion1,
namedSurfaceIndex, namedSurfaceRegion,
cellToZone cellToZone
); );
} }
// Make sure namedSurfaceIndex is unset inbetween same cell zones. // Make sure namedSurfaceRegion is unset inbetween same cell zones.
if (!allowFreeStandingZoneFaces) if (!allowFreeStandingZoneFaces)
{ {
Info<< "Only keeping zone faces inbetween different cellZones." Info<< "Only keeping zone faces inbetween different cellZones."
@ -2668,7 +2689,7 @@ void Foam::meshRefinement::zonify
( (
surfaceMap, surfaceMap,
cellToZone, cellToZone,
namedSurfaceIndex namedSurfaceRegion
); );
} }
} }
@ -4476,7 +4497,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
// Add any faceZones, cellZones originating from surface to the mesh // Add any faceZones, cellZones originating from surface to the mesh
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList surfaceToCellZone; labelList surfaceToCellZone;
labelList surfaceToFaceZone; labelListList surfaceToFaceZones;
labelList namedSurfaces(surfaceZonesInfo::getNamedSurfaces(surfZones)); labelList namedSurfaces(surfaceZonesInfo::getNamedSurfaces(surfZones));
if (namedSurfaces.size()) if (namedSurfaces.size())
@ -4487,8 +4508,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
label surfI = namedSurfaces[i]; label surfI = namedSurfaces[i];
Info<< "Surface : " << surfaces_.names()[surfI] << nl Info<< "Surface : " << surfaces_.names()[surfI] << nl
<< " faceZone : " << surfZones[surfI].faceZoneName() << nl << " faceZones : " << surfZones[surfI].faceZoneNames() << nl
<< " cellZone : " << surfZones[surfI].cellZoneName() << endl; << " cellZone : " << surfZones[surfI].cellZoneName()
<< endl;
} }
Info<< endl; Info<< endl;
@ -4499,7 +4521,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
namedSurfaces, namedSurfaces,
mesh_ mesh_
); );
surfaceToFaceZone = surfaceZonesInfo::addFaceZonesToMesh surfaceToFaceZones = surfaceZonesInfo::addFaceZonesToMesh
( (
surfZones, surfZones,
namedSurfaces, namedSurfaces,
@ -4516,11 +4538,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
// -2 : unset : not allowed! // -2 : unset : not allowed!
// -1 : not in any zone (zone 'none') // -1 : not in any zone (zone 'none')
// >=0: zoneID // >=0: zoneID
// namedSurfaceIndex: // namedSurfaceRegion:
// -1 : face not intersecting a named surface // -1 : face not intersecting a named surface
// >=0 : index of named surface // >=0 : index of named surface
labelList cellToZone; labelList cellToZone;
labelList namedSurfaceIndex; labelList namedSurfaceRegion;
bitSet posOrientation; bitSet posOrientation;
{ {
labelList unnamedRegion1; labelList unnamedRegion1;
@ -4537,24 +4559,26 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
cellToZone, cellToZone,
unnamedRegion1, unnamedRegion1,
unnamedRegion2, unnamedRegion2,
namedSurfaceIndex, namedSurfaceRegion,
posOrientation posOrientation
); );
} }
// Convert namedSurfaceIndex (index of named surfaces) to // Convert namedSurfaceRegion (index of named surfaces) to
// actual faceZone index // actual faceZone index
//- Per face index of faceZone or -1 //- Per face index of faceZone or -1
labelList faceToZone(mesh_.nFaces(), -1); labelList faceToZone(mesh_.nFaces(), -1);
forAll(namedSurfaceIndex, faceI) forAll(namedSurfaceRegion, faceI)
{ {
label surfI = namedSurfaceIndex[faceI]; //label surfI = namedSurfaceIndex[faceI];
if (surfI != -1) label globalI = namedSurfaceRegion[faceI];
if (globalI != -1)
{ {
faceToZone[faceI] = surfaceToFaceZone[surfI]; const labelPair spr = surfaces_.whichSurface(globalI);
faceToZone[faceI] = surfaceToFaceZones[spr.first()][spr.second()];
} }
} }

View File

@ -123,6 +123,34 @@ Foam::labelList Foam::refinementSurfaces::findHigherLevel
} }
Foam::labelList Foam::refinementSurfaces::calcSurfaceIndex
(
const searchableSurfaces& allGeometry,
const labelList& surfaces
)
{
// Determine overall number of global regions
label globalI = 0;
forAll(surfaces, surfI)
{
globalI += allGeometry[surfaces[surfI]].regions().size();
}
labelList regionToSurface(globalI);
globalI = 0;
forAll(surfaces, surfI)
{
const label nLocal = allGeometry[surfaces[surfI]].regions().size();
for (label i = 0; i < nLocal; i++)
{
regionToSurface[globalI++] = surfI;
}
}
return regionToSurface;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::refinementSurfaces::refinementSurfaces Foam::refinementSurfaces::refinementSurfaces
@ -276,7 +304,16 @@ Foam::refinementSurfaces::refinementSurfaces
const searchableSurface& surface = allGeometry_[surfaces_[surfI]]; const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
// Surface zones // Surface zones
surfZones_.set(surfI, new surfaceZonesInfo(surface, dict)); surfZones_.set
(
surfI,
new surfaceZonesInfo
(
surface,
dict,
allGeometry_.regionNames()[surfaces_[surfI]]
)
);
// Global perpendicular angle // Global perpendicular angle
if (dict.found("patchInfo")) if (dict.found("patchInfo"))
@ -433,6 +470,10 @@ Foam::refinementSurfaces::refinementSurfaces
} }
// Rework surface specific information into information per global region // Rework surface specific information into information per global region
regionToSurface_ = calcSurfaceIndex(allGeometry_, surfaces_);
minLevel_.setSize(nRegions); minLevel_.setSize(nRegions);
minLevel_ = 0; minLevel_ = 0;
maxLevel_.setSize(nRegions); maxLevel_.setSize(nRegions);
@ -539,6 +580,7 @@ Foam::refinementSurfaces::refinementSurfaces
names_(names), names_(names),
surfZones_(surfZones), surfZones_(surfZones),
regionOffset_(regionOffset), regionOffset_(regionOffset),
regionToSurface_(calcSurfaceIndex(allGeometry, surfaces)),
minLevel_(minLevel), minLevel_(minLevel),
maxLevel_(maxLevel), maxLevel_(maxLevel),
gapLevel_(gapLevel), gapLevel_(gapLevel),
@ -558,6 +600,17 @@ Foam::refinementSurfaces::refinementSurfaces
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::labelPair Foam::refinementSurfaces::whichSurface
(
const label globalRegionI
) const
{
const label surfI = regionToSurface_[globalRegionI];
const label localI = globalRegionI-regionOffset_[surfI];
return labelPair(surfI, localI);
}
// // Count number of triangles per surface region // // Count number of triangles per surface region
// Foam::labelList Foam::refinementSurfaces::countRegions(const triSurface& s) // Foam::labelList Foam::refinementSurfaces::countRegions(const triSurface& s)
// { // {

View File

@ -77,9 +77,12 @@ class refinementSurfaces
//- List of surface zone (face and cell zone) information //- List of surface zone (face and cell zone) information
PtrList<surfaceZonesInfo> surfZones_; PtrList<surfaceZonesInfo> surfZones_;
//- From local region number to global region number //- From surface to starting global region
labelList regionOffset_; labelList regionOffset_;
//- From global region number to surface
labelList regionToSurface_;
//- From global region number to refinement level //- From global region number to refinement level
labelList minLevel_; labelList minLevel_;
@ -121,6 +124,13 @@ class refinementSurfaces
const labelList& surfaceLevel const labelList& surfaceLevel
) const; ) const;
//- Calculate global region to surface
static labelList calcSurfaceIndex
(
const searchableSurfaces& allGeometry,
const labelList& surfaces
);
//- No copy construct //- No copy construct
refinementSurfaces(const refinementSurfaces&) = delete; refinementSurfaces(const refinementSurfaces&) = delete;
@ -183,7 +193,7 @@ public:
return surfZones_; return surfZones_;
} }
//- From local region number to global region number //- From surface to starting global region
const labelList& regionOffset() const const labelList& regionOffset() const
{ {
return regionOffset_; return regionOffset_;
@ -252,6 +262,9 @@ public:
return regionOffset_[surfI]+regionI; return regionOffset_[surfI]+regionI;
} }
//- From global region to surface + region
labelPair whichSurface(const label globalRegionI) const;
//- Min level for surface and region on surface //- Min level for surface and region on surface
label minLevel(const label surfI, const label regionI) const label minLevel(const label surfI, const label regionI) const
{ {

View File

@ -47,6 +47,18 @@ Foam::surfaceZonesInfo::areaSelectionAlgoNames
}); });
const Foam::Enum
<
Foam::surfaceZonesInfo::faceZoneNaming
>
Foam::surfaceZonesInfo::faceZoneNamingNames
({
{ faceZoneNaming::NOZONE, "none" },
{ faceZoneNaming::SINGLE, "single" },
{ faceZoneNaming::REGION, "region" }
});
const Foam::Enum const Foam::Enum
< <
Foam::surfaceZonesInfo::faceZoneType Foam::surfaceZonesInfo::faceZoneType
@ -64,18 +76,77 @@ Foam::surfaceZonesInfo::faceZoneTypeNames
Foam::surfaceZonesInfo::surfaceZonesInfo Foam::surfaceZonesInfo::surfaceZonesInfo
( (
const searchableSurface& surface, const searchableSurface& surface,
const dictionary& surfacesDict const dictionary& surfacesDict,
const wordList& regionNames
) )
: :
faceZoneName_(), faceZoneNames_(),
cellZoneName_(), cellZoneName_(),
zoneInside_(NONE), zoneInside_(NONE),
zoneInsidePoint_(point::min), zoneInsidePoint_(point::min),
faceType_(INTERNAL) faceType_(INTERNAL)
{ {
// Global zone names per surface const label nRegions = surface.regions().size();
if (surfacesDict.readIfPresent("faceZone", faceZoneName_))
// Old syntax
surfaceZonesInfo::faceZoneNaming namingType = faceZoneNaming::NOZONE;
word namingMethod;
word faceZoneName;
if (surfacesDict.readIfPresent("faceZone", faceZoneName))
{ {
// Single zone name per surface
if (surfacesDict.found("faceZoneNaming"))
{
FatalIOErrorInFunction(surfacesDict)
<< "Cannot provide both \"faceZone\" and \"faceZoneNaming\""
<< exit(FatalIOError);
}
namingType = faceZoneNaming::SINGLE;
faceZoneNames_.setSize(nRegions, faceZoneName);
}
else if (surfacesDict.readIfPresent("faceZoneNaming", namingMethod))
{
//namingType = faceZoneNamingNames.get("faceZoneNaming", surfacesDict);
namingType = faceZoneNamingNames[namingMethod];
// Generate faceZone names. Maybe make runtime-selection table?
switch (namingType)
{
case faceZoneNaming::NOZONE:
break;
case faceZoneNaming::SINGLE:
{
// Should already be handled above
faceZoneNames_.setSize
(
nRegions,
surfacesDict.get<word>("faceZone")
);
}
break;
case faceZoneNaming::REGION:
{
faceZoneNames_ = regionNames;
}
break;
}
}
if (faceZoneNames_.size())
{
if (faceZoneNames_.size() != nRegions)
{
FatalIOErrorInFunction(surfacesDict)
<< "Number of faceZones (through 'faceZones' keyword)"
<< " does not correspond to the number of regions "
<< nRegions << " in surface " << surface.name()
<< exit(FatalIOError);
}
// Read optional entry to determine inside of faceZone // Read optional entry to determine inside of faceZone
word method; word method;
@ -116,8 +187,8 @@ Foam::surfaceZonesInfo::surfaceZonesInfo
IOWarningInFunction(surfacesDict) IOWarningInFunction(surfacesDict)
<< "Illegal entry zoneInside " << "Illegal entry zoneInside "
<< areaSelectionAlgoNames[zoneInside_] << areaSelectionAlgoNames[zoneInside_]
<< " for faceZone " << " for faceZones "
<< faceZoneName_ << faceZoneNames_
<< " since surface is not closed." << endl; << " since surface is not closed." << endl;
} }
} }
@ -125,7 +196,7 @@ Foam::surfaceZonesInfo::surfaceZonesInfo
{ {
IOWarningInFunction(surfacesDict) IOWarningInFunction(surfacesDict)
<< "Unused entry zoneInside for faceZone " << "Unused entry zoneInside for faceZone "
<< faceZoneName_ << faceZoneNames_
<< " since no cellZone specified." << " since no cellZone specified."
<< endl; << endl;
} }
@ -142,14 +213,14 @@ Foam::surfaceZonesInfo::surfaceZonesInfo
Foam::surfaceZonesInfo::surfaceZonesInfo Foam::surfaceZonesInfo::surfaceZonesInfo
( (
const word& faceZoneName, const wordList& faceZoneNames,
const word& cellZoneName, const word& cellZoneName,
const areaSelectionAlgo& zoneInside, const areaSelectionAlgo& zoneInside,
const point& zoneInsidePoint, const point& zoneInsidePoint,
const faceZoneType& faceType const faceZoneType& faceType
) )
: :
faceZoneName_(faceZoneName), faceZoneNames_(faceZoneNames),
cellZoneName_(cellZoneName), cellZoneName_(cellZoneName),
zoneInside_(zoneInside), zoneInside_(zoneInside),
zoneInsidePoint_(zoneInsidePoint), zoneInsidePoint_(zoneInsidePoint),
@ -159,7 +230,7 @@ Foam::surfaceZonesInfo::surfaceZonesInfo
Foam::surfaceZonesInfo::surfaceZonesInfo(const surfaceZonesInfo& surfZone) Foam::surfaceZonesInfo::surfaceZonesInfo(const surfaceZonesInfo& surfZone)
: :
faceZoneName_(surfZone.faceZoneName()), faceZoneNames_(surfZone.faceZoneNames()),
cellZoneName_(surfZone.cellZoneName()), cellZoneName_(surfZone.cellZoneName()),
zoneInside_(surfZone.zoneInside()), zoneInside_(surfZone.zoneInside()),
zoneInsidePoint_(surfZone.zoneInsidePoint()), zoneInsidePoint_(surfZone.zoneInsidePoint()),
@ -177,7 +248,7 @@ Foam::labelList Foam::surfaceZonesInfo::getUnnamedSurfaces
label i = 0; label i = 0;
forAll(surfList, surfI) forAll(surfList, surfI)
{ {
if (surfList[surfI].faceZoneName().empty()) if (surfList[surfI].faceZoneNames().empty())
{ {
anonymousSurfaces[i++] = surfI; anonymousSurfaces[i++] = surfI;
} }
@ -201,7 +272,7 @@ Foam::labelList Foam::surfaceZonesInfo::getNamedSurfaces
if if
( (
surfList.set(surfI) surfList.set(surfI)
&& surfList[surfI].faceZoneName().size() && surfList[surfI].faceZoneNames().size()
) )
{ {
namedSurfaces[namedI++] = surfI; namedSurfaces[namedI++] = surfI;
@ -226,7 +297,7 @@ Foam::labelList Foam::surfaceZonesInfo::getStandaloneNamedSurfaces
if if
( (
surfList.set(surfI) surfList.set(surfI)
&& surfList[surfI].faceZoneName().size() && surfList[surfI].faceZoneNames().size()
&& !surfList[surfI].cellZoneName().size() && !surfList[surfI].cellZoneName().size()
) )
{ {
@ -468,14 +539,14 @@ Foam::label Foam::surfaceZonesInfo::addFaceZone
} }
Foam::labelList Foam::surfaceZonesInfo::addFaceZonesToMesh Foam::labelListList Foam::surfaceZonesInfo::addFaceZonesToMesh
( (
const PtrList<surfaceZonesInfo>& surfList, const PtrList<surfaceZonesInfo>& surfList,
const labelList& namedSurfaces, const labelList& namedSurfaces,
polyMesh& mesh polyMesh& mesh
) )
{ {
labelList surfaceToFaceZone(surfList.size(), -1); labelListList surfaceToFaceZones(surfList.size());
faceZoneMesh& faceZones = mesh.faceZones(); faceZoneMesh& faceZones = mesh.faceZones();
@ -483,17 +554,23 @@ Foam::labelList Foam::surfaceZonesInfo::addFaceZonesToMesh
{ {
label surfI = namedSurfaces[i]; label surfI = namedSurfaces[i];
const word& faceZoneName = surfList[surfI].faceZoneName(); const wordList& faceZoneNames = surfList[surfI].faceZoneNames();
label zoneI = addFaceZone surfaceToFaceZones[surfI].setSize(faceZoneNames.size(), -1);
( forAll(faceZoneNames, j)
faceZoneName, //name {
labelList(0), //addressing const word& faceZoneName = faceZoneNames[j];
boolList(0), //flipmap
mesh
);
surfaceToFaceZone[surfI] = zoneI; label zoneI = addFaceZone
(
faceZoneName, //name
labelList(0), //addressing
boolList(0), //flipmap
mesh
);
surfaceToFaceZones[surfI][j] = zoneI;
}
} }
// Check they are synced // Check they are synced
@ -515,7 +592,7 @@ Foam::labelList Foam::surfaceZonesInfo::addFaceZonesToMesh
} }
} }
return surfaceToFaceZone; return surfaceToFaceZones;
} }

View File

@ -73,6 +73,16 @@ public:
static const Enum<areaSelectionAlgo> areaSelectionAlgoNames; static const Enum<areaSelectionAlgo> areaSelectionAlgoNames;
//- How to generate faceZone name
enum faceZoneNaming
{
NOZONE,
SINGLE,
REGION
};
static const Enum<faceZoneNaming> faceZoneNamingNames;
//- What to do with faceZone faces //- What to do with faceZone faces
enum faceZoneType enum faceZoneType
{ {
@ -88,8 +98,8 @@ private:
// Private data // Private data
//- Per 'interface' surface : name of faceZone to put faces into //- Per 'interface' surface : names of faceZones to put faces into
word faceZoneName_; wordList faceZoneNames_;
//- Per 'interface' surface : name of cellZone to put cells into //- Per 'interface' surface : name of cellZone to put cells into
word cellZoneName_; word cellZoneName_;
@ -117,17 +127,19 @@ public:
// Constructors // Constructors
//- Construct from surfaces and dictionary //- Construct from surfaces and dictionary and fully resolved
// region names (for optional automatic faceZone naming)
surfaceZonesInfo surfaceZonesInfo
( (
const searchableSurface& surface, const searchableSurface& surface,
const dictionary& surfacesDict const dictionary& surfacesDict,
const wordList& regionNames
); );
//- Construct from components //- Construct from components
surfaceZonesInfo surfaceZonesInfo
( (
const word& faceZoneNames, const wordList& faceZoneNames,
const word& cellZoneNames, const word& cellZoneNames,
const areaSelectionAlgo& zoneInside, const areaSelectionAlgo& zoneInside,
const point& zoneInsidePoints, const point& zoneInsidePoints,
@ -148,11 +160,11 @@ public:
// Access // Access
//- Per 'interface' surface : empty or name of faceZone to put //- Per 'interface' surface : empty or names of faceZones to put
// faces into // faces into (according to region)
const word& faceZoneName() const const wordList& faceZoneNames() const
{ {
return faceZoneName_; return faceZoneNames_;
} }
//- Per 'interface' surface : empty or name of cellZone to put //- Per 'interface' surface : empty or name of cellZone to put
@ -254,7 +266,7 @@ public:
polyMesh& mesh polyMesh& mesh
); );
static labelList addFaceZonesToMesh static labelListList addFaceZonesToMesh
( (
const PtrList<surfaceZonesInfo>& surfList, const PtrList<surfaceZonesInfo>& surfList,
const labelList& namedSurfaces, const labelList& namedSurfaces,

View File

@ -928,11 +928,13 @@ void Foam::snappySnapDriver::preSmoothPatch
// Get (pp-local) indices of points that are both on zone and on patched surface // Get (pp-local) indices of points that are both on zone and on patched surface
Foam::labelList Foam::snappySnapDriver::getZoneSurfacePoints void Foam::snappySnapDriver::getZoneSurfacePoints
( (
const fvMesh& mesh, const fvMesh& mesh,
const indirectPrimitivePatch& pp, const indirectPrimitivePatch& pp,
const word& zoneName const word& zoneName,
bitSet& pointOnZone
) )
{ {
label zonei = mesh.faceZones().findZoneID(zoneName); label zonei = mesh.faceZones().findZoneID(zoneName);
@ -950,8 +952,6 @@ Foam::labelList Foam::snappySnapDriver::getZoneSurfacePoints
// Could use PrimitivePatch & localFaces to extract points but might just // Could use PrimitivePatch & localFaces to extract points but might just
// as well do it ourselves. // as well do it ourselves.
boolList pointOnZone(pp.nPoints(), false);
forAll(fZone, i) forAll(fZone, i)
{ {
const face& f = mesh.faces()[fZone[i]]; const face& f = mesh.faces()[fZone[i]];
@ -969,8 +969,6 @@ Foam::labelList Foam::snappySnapDriver::getZoneSurfacePoints
} }
} }
} }
return findIndices(pointOnZone, true);
} }
@ -1544,124 +1542,128 @@ void Foam::snappySnapDriver::detectNearSurfaces
forAll(zonedSurfaces, i) forAll(zonedSurfaces, i)
{ {
label zoneSurfi = zonedSurfaces[i]; label zoneSurfi = zonedSurfaces[i];
const word& faceZoneName = surfZones[zoneSurfi].faceZoneName();
const labelList surfacesToTest(1, zoneSurfi); const labelList surfacesToTest(1, zoneSurfi);
// Get indices of points both on faceZone and on pp. const wordList& faceZoneNames =
labelList zonePointIndices surfZones[zoneSurfi].faceZoneNames();
( forAll(faceZoneNames, namei)
{
const word& faceZoneName = faceZoneNames[namei];
// Get indices of points both on faceZone and on pp.
bitSet pointOnZone(pp.nPoints());
getZoneSurfacePoints getZoneSurfacePoints
( (
mesh, mesh,
pp, pp,
faceZoneName faceZoneName,
) pointOnZone
); );
const labelList zonePointIndices(pointOnZone.toc());
// Do intersection test // Do intersection test
labelList surface1; labelList surface1;
List<pointIndexHit> hit1; List<pointIndexHit> hit1;
labelList region1; labelList region1;
vectorField normal1; vectorField normal1;
labelList surface2; labelList surface2;
List<pointIndexHit> hit2; List<pointIndexHit> hit2;
labelList region2; labelList region2;
vectorField normal2; vectorField normal2;
surfaces.findNearestIntersection surfaces.findNearestIntersection
( (
surfacesToTest, surfacesToTest,
pointField(start, zonePointIndices), pointField(start, zonePointIndices),
pointField(end, zonePointIndices), pointField(end, zonePointIndices),
surface1, surface1,
hit1, hit1,
region1, region1,
normal1, normal1,
surface2, surface2,
hit2, hit2,
region2, region2,
normal2 normal2
); );
forAll(hit1, i) forAll(hit1, i)
{
label pointi = zonePointIndices[i];
// Current location
const point& pt = localPoints[pointi];
bool override = false;
//if (hit1[i].hit())
//{
// if
// (
// meshRefiner_.isGap
// (
// planarCos,
// nearestPoint[pointi],
// nearestNormal[pointi],
// hit1[i].hitPoint(),
// normal1[i]
// )
// )
// {
// disp[pointi] = hit1[i].hitPoint()-pt;
// override = true;
// }
//}
//if (hit2[i].hit())
//{
// if
// (
// meshRefiner_.isGap
// (
// planarCos,
// nearestPoint[pointi],
// nearestNormal[pointi],
// hit2[i].hitPoint(),
// normal2[i]
// )
// )
// {
// disp[pointi] = hit2[i].hitPoint()-pt;
// override = true;
// }
//}
if (hit1[i].hit() && hit2[i].hit())
{ {
if label pointi = zonePointIndices[i];
(
meshRefiner_.isGap // Current location
( const point& pt = localPoints[pointi];
planarCos,
hit1[i].hitPoint(), bool override = false;
normal1[i],
hit2[i].hitPoint(), //if (hit1[i].hit())
normal2[i] //{
) // if
) // (
// meshRefiner_.isGap
// (
// planarCos,
// nearestPoint[pointi],
// nearestNormal[pointi],
// hit1[i].hitPoint(),
// normal1[i]
// )
// )
// {
// disp[pointi] = hit1[i].hitPoint()-pt;
// override = true;
// }
//}
//if (hit2[i].hit())
//{
// if
// (
// meshRefiner_.isGap
// (
// planarCos,
// nearestPoint[pointi],
// nearestNormal[pointi],
// hit2[i].hitPoint(),
// normal2[i]
// )
// )
// {
// disp[pointi] = hit2[i].hitPoint()-pt;
// override = true;
// }
//}
if (hit1[i].hit() && hit2[i].hit())
{ {
if (gapStr.valid()) if
(
meshRefiner_.isGap
(
planarCos,
hit1[i].hitPoint(),
normal1[i],
hit2[i].hitPoint(),
normal2[i]
)
)
{ {
const point& intPt = hit2[i].hitPoint(); if (gapStr.valid())
gapStr().write(linePointRef(pt, intPt)); {
const point& intPt = hit2[i].hitPoint();
gapStr().write(linePointRef(pt, intPt));
}
disp[pointi] = hit2[i].hitPoint()-pt;
override = true;
} }
disp[pointi] = hit2[i].hitPoint()-pt;
override = true;
} }
}
if (override && isPatchMasterPoint[pointi]) if (override && isPatchMasterPoint[pointi])
{ {
nOverride++; nOverride++;
}
} }
} }
} }
@ -1950,15 +1952,15 @@ Foam::vectorField Foam::snappySnapDriver::calcNearestSurface
} }
const labelList zonedSurfaces = const labelList zonedSurfaces = surfaceZonesInfo::getNamedSurfaces
surfaceZonesInfo::getNamedSurfaces (
( meshRefiner.surfaces().surfZones()
meshRefiner.surfaces().surfZones() );
);
// 2. All points on zones to their respective surface // 2. All points on zones to their respective surface
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// (ignoring faceZone subdivision)
// Surfaces with zone information // Surfaces with zone information
const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones(); const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones();
@ -1966,26 +1968,27 @@ Foam::vectorField Foam::snappySnapDriver::calcNearestSurface
forAll(zonedSurfaces, i) forAll(zonedSurfaces, i)
{ {
label surfi = zonedSurfaces[i]; label surfi = zonedSurfaces[i];
const word& faceZoneName = surfZones[surfi].faceZoneName();
const labelList surfacesToTest(1, surfi); const labelList surfacesToTest(1, surfi);
const label geomi = surfaces.surfaces()[surfi];
const label nRegions =
surfaces.geometry()[geomi].regions().size();
label geomi = surfaces.surfaces()[surfi]; const wordList& faceZoneNames =
label nRegions = surfaces.geometry()[geomi].regions().size(); surfZones[surfi].faceZoneNames();
// Get indices of points both on any faceZone and on pp.
// Get indices of points both on faceZone and on pp. bitSet pointOnZone(pp.nPoints());
labelList zonePointIndices forAll(faceZoneNames, locali)
( {
getZoneSurfacePoints getZoneSurfacePoints
( (
mesh, mesh,
pp, pp,
faceZoneName faceZoneNames[locali],
) pointOnZone
); );
}
const labelList zonePointIndices(pointOnZone.toc());
calcNearestSurface calcNearestSurface
( (
@ -2278,9 +2281,12 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::snappySnapDriver::repatchToSurface
forAll(zonedSurfaces, i) forAll(zonedSurfaces, i)
{ {
const label zoneSurfi = zonedSurfaces[i]; const label zoneSurfi = zonedSurfaces[i];
const faceZone& fZone = fZones[surfZones[zoneSurfi].faceZoneName()]; const wordList& fZoneNames = surfZones[zoneSurfi].faceZoneNames();
forAll(fZoneNames, i)
isZonedFace.set(fZone); {
const faceZone& fZone = fZones[fZoneNames[i]];
isZonedFace.set(fZone);
}
} }
} }

View File

@ -157,11 +157,13 @@ class snappySnapDriver
labelList getInternalOrBaffleDuplicateFace() const; labelList getInternalOrBaffleDuplicateFace() const;
//- Get points both on patch and facezone. //- Get points both on patch and facezone.
static labelList getZoneSurfacePoints static void getZoneSurfacePoints
( (
const fvMesh& mesh, const fvMesh& mesh,
const indirectPrimitivePatch&, const indirectPrimitivePatch&,
const word& zoneName const word& zoneName,
bitSet& pointOnZone
); );
//- Get points both on patch and facezone. //- Get points both on patch and facezone.

View File

@ -263,34 +263,41 @@ void Foam::snappySnapDriver::calcNearestFace
{ {
label zoneSurfi = zonedSurfaces[i]; label zoneSurfi = zonedSurfaces[i];
const word& faceZoneName = surfZones[zoneSurfi].faceZoneName(); const wordList& faceZoneNames = surfZones[zoneSurfi].faceZoneNames();
// Get indices of faces on pp that are also in zone // Get indices of faces on pp that are also in zone
label zonei = mesh.faceZones().findZoneID(faceZoneName); DynamicList<label> ppFaces;
if (zonei == -1) DynamicList<label> meshFaces;
forAll(faceZoneNames, fzi)
{ {
FatalErrorInFunction const word& faceZoneName = faceZoneNames[fzi];
<< "Problem. Cannot find zone " << faceZoneName label zonei = mesh.faceZones().findZoneID(faceZoneName);
<< exit(FatalError); if (zonei == -1)
}
const faceZone& fZone = mesh.faceZones()[zonei];
const bitSet isZonedFace(mesh.nFaces(), fZone);
DynamicList<label> ppFaces(fZone.size());
DynamicList<label> meshFaces(fZone.size());
forAll(pp.addressing(), i)
{
if (isZonedFace[pp.addressing()[i]])
{ {
snapSurf[i] = zoneSurfi; FatalErrorInFunction
ppFaces.append(i); << "Problem. Cannot find zone " << faceZoneName
meshFaces.append(pp.addressing()[i]); << exit(FatalError);
} }
} const faceZone& fZone = mesh.faceZones()[zonei];
const bitSet isZonedFace(mesh.nFaces(), fZone);
//Pout<< "For faceZone " << fZone.name() ppFaces.reserve(ppFaces.capacity()+fZone.size());
// << " found " << ppFaces.size() << " out of " << pp.size() meshFaces.reserve(meshFaces.capacity()+fZone.size());
// << endl;
forAll(pp.addressing(), i)
{
if (isZonedFace[pp.addressing()[i]])
{
snapSurf[i] = zoneSurfi;
ppFaces.append(i);
meshFaces.append(pp.addressing()[i]);
}
}
//Pout<< "For faceZone " << fZone.name()
// << " found " << ppFaces.size() << " out of " << pp.size()
// << endl;
}
pointField fc pointField fc
( (

View File

@ -0,0 +1,14 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase
# Remove surface and features
rm -rf constant/extendedFeatureEdgeMesh > /dev/null 2>&1
rm -f constant/triSurface/rotatingZone.eMesh > /dev/null 2>&1
rm -f constant/triSurface/fixed.eMesh > /dev/null 2>&1
rm -f 0/pointLevel > /dev/null 2>&1
rm -f 0/cellLevel > /dev/null 2>&1
#------------------------------------------------------------------------------

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
# Meshing
runApplication blockMesh
runApplication surfaceFeatureExtract
runApplication snappyHexMesh
#------------------------------------------------------------------------------

View File

@ -0,0 +1,2 @@
Block (as cellZone) inside cylinder. Demonstrates naming faceZones
on outside of the cellZone according to surface name, surface region.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
backgroundMesh
{
xMin -1.26;
xMax 1.26;
yMin -2.01;
yMax 2.01;
zMin -1.26;
zMax 1.26;
xCells 12;
yCells 22;
zCells 12;
}
scale 1;
vertices
(
($:backgroundMesh.xMin $:backgroundMesh.yMin $:backgroundMesh.zMin)
($:backgroundMesh.xMax $:backgroundMesh.yMin $:backgroundMesh.zMin)
($:backgroundMesh.xMax $:backgroundMesh.yMax $:backgroundMesh.zMin)
($:backgroundMesh.xMin $:backgroundMesh.yMax $:backgroundMesh.zMin)
($:backgroundMesh.xMin $:backgroundMesh.yMin $:backgroundMesh.zMax)
($:backgroundMesh.xMax $:backgroundMesh.yMin $:backgroundMesh.zMax)
($:backgroundMesh.xMax $:backgroundMesh.yMax $:backgroundMesh.zMax)
($:backgroundMesh.xMin $:backgroundMesh.yMax $:backgroundMesh.zMax)
);
blocks
(
hex (0 1 2 3 4 5 6 7)
(
$:backgroundMesh.xCells
$:backgroundMesh.yCells
$:backgroundMesh.zCells
)
simpleGrading (1 1 1)
);
edges
(
);
boundary
(
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application simpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 1000;
deltaT 1;
writeControl timeStep;
writeInterval 50;
purgeWrite 0;
writeFormat ascii;
writePrecision 8;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

View File

@ -0,0 +1,102 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
disk
{
type rotorDisk;
selectionMode cellZone;
cellZone rotatingZone;
fields (U); // Names of fields on which to apply source
nBlades 3; // Number of blades
tipEffect 0.96; // Normalised radius above which lift = 0
inletFlowType local; // Inlet flow type specification
inletVelocity (0 1 0);
geometryMode specified;
origin (0 0 0);
axis (0 1 0);
refDirection (0 0 1); // Reference direction
// - used as reference for psi angle
rpm 1000;
//pointAbove (0 0 0.25);
trimModel fixedTrim; // fixed || targetForce
rhoRef 1000;
rhoInf 1;
fixedTrimCoeffs
{
theta0 0;
theta1c 0;
theta1s 0;
}
flapCoeffs
{
beta0 0; // Coning angle [deg]
beta1c 0; // Lateral flapping coeff (cos coeff)
beta2s 0; // Longitudinal flapping coeff (sin coeff)
}
blade
{
data
(
(profile1 (0.1 -6 0.02))
(profile1 (0.25 -6 0.02))
);
}
profiles
{
profile1
{
type lookup;
data
(
(-90 0.21 1.45)
(-18 0.21 1.45)
(-16 0.165 1.3)
(-14 0.125 1.1)
(-12 0.092 0.95)
(-10 0.07 0.8)
(-8 0.05 0.64)
(-6 0.04 0.5)
(-4 0.028 0.32)
(-2 0.022 0.18)
(0 0.02 0)
(2 0.022 0.18)
(4 0.028 0.32)
(6 0.04 0.5)
(8 0.05 0.64)
(10 0.07 0.8)
(12 0.092 0.95)
(14 0.125 1.1)
(16 0.165 1.3)
(18 0.21 1.45)
(90 0.21 1.45)
);
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
limited cellLimited Gauss linear 1;
grad(U) $limited;
grad(k) $limited;
grad(omega) $limited;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss linearUpwind unlimited;
turbulence bounded Gauss linearUpwind limited;
div(phi,k) $turbulence;
div(phi,omega) $turbulence;
div(phi,epsilon) $turbulence;
div((nuEff*dev(T(grad(U))))) Gauss linear;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
wallDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
smoother GaussSeidel;
tolerance 1e-6;
relTol 0.1;
}
"(U|k|omega|epsilon)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-6;
relTol 0.1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
consistent yes;
residualControl
{
U 1e-4;
p 1e-3;
"(k|epsilon|omega)" 1e-3;
}
}
relaxationFactors
{
equations
{
U 0.95;
"(k|omega|epsilon)" 0.95;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object meshQualityDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#includeEtc "caseDicts/mesh/generation/meshQualityDict.cfg"
//- minFaceWeight (0 -> 0.5)
//minFaceWeight 0.02;
// ************************************************************************* //

View File

@ -0,0 +1,166 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#includeEtc "caseDicts/mesh/generation/snappyHexMeshDict.cfg"
castellatedMesh on;
snap on;
addLayers off;
geometry
{
dummy
{
type box;
min (0 0 0);
max (1 1 1);
}
fixed.obj
{
// Rename some of the regions inside the obj file
type triSurfaceMesh;
name fixed;
regions
{
patch0 { name slipWall; }
patch1 { name outlet; }
patch2 { name inlet; }
}
}
box-randomAligned.stl
{
// Rename some of the regions inside the obj file
type triSurfaceMesh;
name rotatingZone;
regions
{
front { name myFront; }
}
}
}
castellatedMeshControls
{
features
(
{ file "fixed.eMesh"; level 2; }
{ file "rotatingZone.eMesh"; level 4; }
);
refinementSurfaces
{
fixed
{
level (2 2);
patchInfo { type wall; }
inGroups (fixed);
// Override per-patch information
regions
{
patch0
{
level (3 3);
patchInfo { type patch; }
}
patch1
{
level (2 2);
patchInfo { type patch; }
}
patch2
{
level (2 2);
patchInfo { type patch; }
}
}
}
rotatingZone
{
level (4 4);
// How to handle faceZones
// a. no faceZone. No keyword 'faceZone' or 'faceZoneNaming'
// b. single user-specified faceZone:
// faceZone myZone;
// c. faceZones according to the surface/region:
// faceZoneNaming region;
// c. faceZones according to the surface/region
faceZoneNaming region;
cellZone rotatingZone;
cellZoneInside inside;
}
}
refinementRegions
{
fixed
{
mode inside;
levels ((1e-5 1));
}
rotatingZone
{
mode inside;
levels ((1e-5 4));
}
}
locationInMesh (1e-5 -1e-2 1e-5);// Offset from (0 0 0) to avoid
// coinciding with face or edge and keep
// away from disk itself
allowFreeStandingZoneFaces false;
// Optional: switch off topological test for cells to-be-squashed
// and use geometric test instead
useTopologicalSnapDetection false;
}
snapControls
{
tolerance 1.0;
implicitFeatureSnap true;
strictRegionSnap true;
}
addLayersControls
{
layers
{
}
relativeSizes true; // false, usually with firstLayerThickness
expansionRatio 1.2;
finalLayerThickness 0.5;
minThickness 1e-3;
}
meshQualityControls
{
// minTetQuality -1e+30;
}
mergeTolerance 1e-6;
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object surfaceFeatureExtractDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
fixed.obj
{
#includeEtc "caseDicts/surface/surfaceFeatureExtractDict.cfg"
}
rotatingZone.obj
{
#includeEtc "caseDicts/surface/surfaceFeatureExtractDict.cfg"
}
// ************************************************************************* //