mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Changed behaviour of surfaces with zones.
- if allowFreeStanding = false it also disables faceZones on boundaries. - can have surfaces with faceZone but no cellZone.
This commit is contained in:
@ -246,27 +246,8 @@ void Foam::meshRefinement::getBafflePatches
|
||||
|
||||
const pointField& cellCentres = mesh_.cellCentres();
|
||||
|
||||
// Build list of surfaces that are not to be baffled.
|
||||
const wordList& cellZoneNames = surfaces_.cellZoneNames();
|
||||
|
||||
labelList surfacesToBaffle(cellZoneNames.size());
|
||||
label baffleI = 0;
|
||||
forAll(cellZoneNames, surfI)
|
||||
{
|
||||
if (cellZoneNames[surfI].size())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "getBafflePatches : Not baffling surface "
|
||||
<< surfaces_.names()[surfI] << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
surfacesToBaffle[baffleI++] = surfI;
|
||||
}
|
||||
}
|
||||
surfacesToBaffle.setSize(baffleI);
|
||||
// Surfaces that need to be baffled
|
||||
const labelList surfacesToBaffle(surfaces_.getUnnamedSurfaces());
|
||||
|
||||
ownPatch.setSize(mesh_.nFaces());
|
||||
ownPatch = -1;
|
||||
@ -1254,7 +1235,7 @@ void Foam::meshRefinement::findCellZoneTopo
|
||||
{
|
||||
label surfI = namedSurfaceIndex[faceI];
|
||||
|
||||
if (surfI != -1)
|
||||
if (surfI != -1 && surfaceToCellZone[surfI] != -1)
|
||||
{
|
||||
// Calculate region to zone from cellRegions on either side
|
||||
// of internal face.
|
||||
@ -1306,7 +1287,7 @@ void Foam::meshRefinement::findCellZoneTopo
|
||||
|
||||
label surfI = namedSurfaceIndex[faceI];
|
||||
|
||||
if (surfI != -1)
|
||||
if (surfI != -1 && surfaceToCellZone[surfI] != -1)
|
||||
{
|
||||
bool changedCell = calcRegionToZone
|
||||
(
|
||||
@ -1440,6 +1421,15 @@ void Foam::meshRefinement::makeConsistentFaceIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unzonify boundary faces
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
namedSurfaceIndex[faceI] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2043,14 +2033,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
||||
|
||||
labelList namedSurfaces(surfaces_.getNamedSurfaces());
|
||||
|
||||
boolList isNamedSurface(cellZoneNames.size(), false);
|
||||
|
||||
forAll(namedSurfaces, i)
|
||||
{
|
||||
label surfI = namedSurfaces[i];
|
||||
|
||||
isNamedSurface[surfI] = true;
|
||||
|
||||
Info<< "Surface : " << surfaces_.names()[surfI] << nl
|
||||
<< " faceZone : " << faceZoneNames[surfI] << nl
|
||||
<< " cellZone : " << cellZoneNames[surfI] << endl;
|
||||
@ -2126,31 +2112,34 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
||||
{
|
||||
label surfI = namedSurfaces[i];
|
||||
|
||||
label zoneI = cellZones.findZoneID(cellZoneNames[surfI]);
|
||||
|
||||
if (zoneI == -1)
|
||||
if (cellZoneNames[surfI] != word::null)
|
||||
{
|
||||
zoneI = cellZones.size();
|
||||
cellZones.setSize(zoneI+1);
|
||||
cellZones.set
|
||||
(
|
||||
zoneI,
|
||||
new cellZone
|
||||
label zoneI = cellZones.findZoneID(cellZoneNames[surfI]);
|
||||
|
||||
if (zoneI == -1)
|
||||
{
|
||||
zoneI = cellZones.size();
|
||||
cellZones.setSize(zoneI+1);
|
||||
cellZones.set
|
||||
(
|
||||
cellZoneNames[surfI], //name
|
||||
labelList(0), //addressing
|
||||
zoneI, //index
|
||||
cellZones //cellZoneMesh
|
||||
)
|
||||
);
|
||||
}
|
||||
zoneI,
|
||||
new cellZone
|
||||
(
|
||||
cellZoneNames[surfI], //name
|
||||
labelList(0), //addressing
|
||||
zoneI, //index
|
||||
cellZones //cellZoneMesh
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Cells inside " << surfaces_.names()[surfI]
|
||||
<< " will go into cellZone " << zoneI << endl;
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Cells inside " << surfaces_.names()[surfI]
|
||||
<< " will go into cellZone " << zoneI << endl;
|
||||
}
|
||||
surfaceToCellZone[surfI] = zoneI;
|
||||
}
|
||||
surfaceToCellZone[surfI] = zoneI;
|
||||
}
|
||||
|
||||
// Check they are synced
|
||||
@ -2322,6 +2311,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
||||
|
||||
if (closedNamedSurfaces.size())
|
||||
{
|
||||
Info<< "Found " << closedNamedSurfaces.size()
|
||||
<< " closed, named surfaces. Assigning cells in/outside"
|
||||
<< " these surfaces to the corresponding cellZone."
|
||||
<< nl << endl;
|
||||
|
||||
findCellZoneGeometric
|
||||
(
|
||||
closedNamedSurfaces, // indices of closed surfaces
|
||||
@ -2334,8 +2328,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
||||
// Set using walking
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
//if (returnReduce(nSet, sumOp<label>()) < mesh_.globalData().nTotalCells())
|
||||
if (!allowFreeStandingZoneFaces)
|
||||
{
|
||||
Info<< "Walking to assign cellZones." << nl << endl;
|
||||
|
||||
// Topological walk
|
||||
findCellZoneTopo
|
||||
(
|
||||
@ -2350,6 +2346,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
||||
// Make sure namedSurfaceIndex is unset inbetween same cell cell zones.
|
||||
if (!allowFreeStandingZoneFaces)
|
||||
{
|
||||
Info<< "Only keeping zone faces inbetween different cellZones."
|
||||
<< nl << endl;
|
||||
|
||||
makeConsistentFaceIndex(cellToZone, namedSurfaceIndex);
|
||||
}
|
||||
|
||||
|
||||
@ -78,8 +78,18 @@ Foam::refinementSurfaces::refinementSurfaces
|
||||
if (dict.found("faceZone"))
|
||||
{
|
||||
dict.lookup("faceZone") >> faceZoneNames_[surfI];
|
||||
dict.lookup("cellZone") >> cellZoneNames_[surfI];
|
||||
dict.lookup("zoneInside") >> zoneInside_[surfI];
|
||||
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
|
||||
{
|
||||
dict.lookup("zoneInside") >> zoneInside_[surfI];
|
||||
}
|
||||
else if (dict.found("zoneInside"))
|
||||
{
|
||||
IOWarningIn("refinementSurfaces::refinementSurfaces(..)", dict)
|
||||
<< "Unused entry zoneInside for faceZone "
|
||||
<< faceZoneNames_[surfI]
|
||||
<< " since no cellZone specified."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Global perpendicular angle
|
||||
@ -315,8 +325,21 @@ Foam::refinementSurfaces::refinementSurfaces
|
||||
if (dict.found("faceZone"))
|
||||
{
|
||||
dict.lookup("faceZone") >> faceZoneNames_[surfI];
|
||||
dict.lookup("cellZone") >> cellZoneNames_[surfI];
|
||||
dict.lookup("zoneInside") >> zoneInside_[surfI];
|
||||
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
|
||||
{
|
||||
dict.lookup("zoneInside") >> zoneInside_[surfI];
|
||||
}
|
||||
else if (dict.found("zoneInside"))
|
||||
{
|
||||
IOWarningIn
|
||||
(
|
||||
"refinementSurfaces::refinementSurfaces(..)",
|
||||
dict
|
||||
) << "Unused entry zoneInside for faceZone "
|
||||
<< faceZoneNames_[surfI]
|
||||
<< " since no cellZone specified."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Global perpendicular angle
|
||||
@ -476,18 +499,17 @@ Foam::labelList Foam::refinementSurfaces::getNamedSurfaces() const
|
||||
// Get indices of closed named surfaces
|
||||
Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const
|
||||
{
|
||||
labelList named(getNamedSurfaces());
|
||||
labelList closed(cellZoneNames_.size());
|
||||
|
||||
labelList closed(named.size());
|
||||
label closedI = 0;
|
||||
|
||||
forAll(named, i)
|
||||
forAll(cellZoneNames_, surfI)
|
||||
{
|
||||
label surfI = named[i];
|
||||
|
||||
if (allGeometry_[surfaces_[surfI]].hasVolumeType())
|
||||
if (cellZoneNames_[surfI].size())
|
||||
{
|
||||
closed[closedI++] = surfI;
|
||||
if (allGeometry_[surfaces_[surfI]].hasVolumeType())
|
||||
{
|
||||
closed[closedI++] = surfI;
|
||||
}
|
||||
}
|
||||
}
|
||||
closed.setSize(closedI);
|
||||
|
||||
@ -147,7 +147,8 @@ public:
|
||||
return faceZoneNames_;
|
||||
}
|
||||
|
||||
//- Per 'interface' surface : name of cellZone to put cells into
|
||||
//- Per 'interface' surface : empty or name of cellZone to put
|
||||
// cells into
|
||||
const wordList& cellZoneNames() const
|
||||
{
|
||||
return cellZoneNames_;
|
||||
@ -159,7 +160,7 @@ public:
|
||||
//- Get indices of named surfaces (surfaces with faceZoneName)
|
||||
labelList getNamedSurfaces() const;
|
||||
|
||||
//- Get indices of closed named surfaces
|
||||
//- Get indices of closed surfaces with a cellZone
|
||||
labelList getClosedNamedSurfaces() const;
|
||||
|
||||
//- From local region number to global region number
|
||||
|
||||
Reference in New Issue
Block a user