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();
|
const pointField& cellCentres = mesh_.cellCentres();
|
||||||
|
|
||||||
// Build list of surfaces that are not to be baffled.
|
// Surfaces that need to be baffled
|
||||||
const wordList& cellZoneNames = surfaces_.cellZoneNames();
|
const labelList surfacesToBaffle(surfaces_.getUnnamedSurfaces());
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
ownPatch.setSize(mesh_.nFaces());
|
ownPatch.setSize(mesh_.nFaces());
|
||||||
ownPatch = -1;
|
ownPatch = -1;
|
||||||
@ -1254,7 +1235,7 @@ void Foam::meshRefinement::findCellZoneTopo
|
|||||||
{
|
{
|
||||||
label surfI = namedSurfaceIndex[faceI];
|
label surfI = namedSurfaceIndex[faceI];
|
||||||
|
|
||||||
if (surfI != -1)
|
if (surfI != -1 && surfaceToCellZone[surfI] != -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.
|
||||||
@ -1306,7 +1287,7 @@ void Foam::meshRefinement::findCellZoneTopo
|
|||||||
|
|
||||||
label surfI = namedSurfaceIndex[faceI];
|
label surfI = namedSurfaceIndex[faceI];
|
||||||
|
|
||||||
if (surfI != -1)
|
if (surfI != -1 && surfaceToCellZone[surfI] != -1)
|
||||||
{
|
{
|
||||||
bool changedCell = calcRegionToZone
|
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());
|
labelList namedSurfaces(surfaces_.getNamedSurfaces());
|
||||||
|
|
||||||
boolList isNamedSurface(cellZoneNames.size(), false);
|
|
||||||
|
|
||||||
forAll(namedSurfaces, i)
|
forAll(namedSurfaces, i)
|
||||||
{
|
{
|
||||||
label surfI = namedSurfaces[i];
|
label surfI = namedSurfaces[i];
|
||||||
|
|
||||||
isNamedSurface[surfI] = true;
|
|
||||||
|
|
||||||
Info<< "Surface : " << surfaces_.names()[surfI] << nl
|
Info<< "Surface : " << surfaces_.names()[surfI] << nl
|
||||||
<< " faceZone : " << faceZoneNames[surfI] << nl
|
<< " faceZone : " << faceZoneNames[surfI] << nl
|
||||||
<< " cellZone : " << cellZoneNames[surfI] << endl;
|
<< " cellZone : " << cellZoneNames[surfI] << endl;
|
||||||
@ -2126,6 +2112,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
{
|
{
|
||||||
label surfI = namedSurfaces[i];
|
label surfI = namedSurfaces[i];
|
||||||
|
|
||||||
|
if (cellZoneNames[surfI] != word::null)
|
||||||
|
{
|
||||||
label zoneI = cellZones.findZoneID(cellZoneNames[surfI]);
|
label zoneI = cellZones.findZoneID(cellZoneNames[surfI]);
|
||||||
|
|
||||||
if (zoneI == -1)
|
if (zoneI == -1)
|
||||||
@ -2152,6 +2140,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
}
|
}
|
||||||
surfaceToCellZone[surfI] = zoneI;
|
surfaceToCellZone[surfI] = zoneI;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check they are synced
|
// Check they are synced
|
||||||
List<wordList> allCellZones(Pstream::nProcs());
|
List<wordList> allCellZones(Pstream::nProcs());
|
||||||
@ -2322,6 +2311,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
|
|
||||||
if (closedNamedSurfaces.size())
|
if (closedNamedSurfaces.size())
|
||||||
{
|
{
|
||||||
|
Info<< "Found " << closedNamedSurfaces.size()
|
||||||
|
<< " closed, named surfaces. Assigning cells in/outside"
|
||||||
|
<< " these surfaces to the corresponding cellZone."
|
||||||
|
<< nl << endl;
|
||||||
|
|
||||||
findCellZoneGeometric
|
findCellZoneGeometric
|
||||||
(
|
(
|
||||||
closedNamedSurfaces, // indices of closed surfaces
|
closedNamedSurfaces, // indices of closed surfaces
|
||||||
@ -2334,8 +2328,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
// Set using walking
|
// Set using walking
|
||||||
// ~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
//if (returnReduce(nSet, sumOp<label>()) < mesh_.globalData().nTotalCells())
|
if (!allowFreeStandingZoneFaces)
|
||||||
{
|
{
|
||||||
|
Info<< "Walking to assign cellZones." << nl << endl;
|
||||||
|
|
||||||
// Topological walk
|
// Topological walk
|
||||||
findCellZoneTopo
|
findCellZoneTopo
|
||||||
(
|
(
|
||||||
@ -2350,6 +2346,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
// Make sure namedSurfaceIndex is unset inbetween same cell cell zones.
|
// Make sure namedSurfaceIndex is unset inbetween same cell cell zones.
|
||||||
if (!allowFreeStandingZoneFaces)
|
if (!allowFreeStandingZoneFaces)
|
||||||
{
|
{
|
||||||
|
Info<< "Only keeping zone faces inbetween different cellZones."
|
||||||
|
<< nl << endl;
|
||||||
|
|
||||||
makeConsistentFaceIndex(cellToZone, namedSurfaceIndex);
|
makeConsistentFaceIndex(cellToZone, namedSurfaceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -78,9 +78,19 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
if (dict.found("faceZone"))
|
if (dict.found("faceZone"))
|
||||||
{
|
{
|
||||||
dict.lookup("faceZone") >> faceZoneNames_[surfI];
|
dict.lookup("faceZone") >> faceZoneNames_[surfI];
|
||||||
dict.lookup("cellZone") >> cellZoneNames_[surfI];
|
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
|
||||||
|
{
|
||||||
dict.lookup("zoneInside") >> zoneInside_[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
|
// Global perpendicular angle
|
||||||
if (dict.found("perpendicularAngle"))
|
if (dict.found("perpendicularAngle"))
|
||||||
@ -315,9 +325,22 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
if (dict.found("faceZone"))
|
if (dict.found("faceZone"))
|
||||||
{
|
{
|
||||||
dict.lookup("faceZone") >> faceZoneNames_[surfI];
|
dict.lookup("faceZone") >> faceZoneNames_[surfI];
|
||||||
dict.lookup("cellZone") >> cellZoneNames_[surfI];
|
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
|
||||||
|
{
|
||||||
dict.lookup("zoneInside") >> zoneInside_[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
|
// Global perpendicular angle
|
||||||
if (dict.found("perpendicularAngle"))
|
if (dict.found("perpendicularAngle"))
|
||||||
@ -476,20 +499,19 @@ Foam::labelList Foam::refinementSurfaces::getNamedSurfaces() const
|
|||||||
// Get indices of closed named surfaces
|
// Get indices of closed named surfaces
|
||||||
Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const
|
Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const
|
||||||
{
|
{
|
||||||
labelList named(getNamedSurfaces());
|
labelList closed(cellZoneNames_.size());
|
||||||
|
|
||||||
labelList closed(named.size());
|
|
||||||
label closedI = 0;
|
label closedI = 0;
|
||||||
|
forAll(cellZoneNames_, surfI)
|
||||||
forAll(named, i)
|
{
|
||||||
|
if (cellZoneNames_[surfI].size())
|
||||||
{
|
{
|
||||||
label surfI = named[i];
|
|
||||||
|
|
||||||
if (allGeometry_[surfaces_[surfI]].hasVolumeType())
|
if (allGeometry_[surfaces_[surfI]].hasVolumeType())
|
||||||
{
|
{
|
||||||
closed[closedI++] = surfI;
|
closed[closedI++] = surfI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
closed.setSize(closedI);
|
closed.setSize(closedI);
|
||||||
|
|
||||||
return closed;
|
return closed;
|
||||||
|
|||||||
@ -147,7 +147,8 @@ public:
|
|||||||
return faceZoneNames_;
|
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
|
const wordList& cellZoneNames() const
|
||||||
{
|
{
|
||||||
return cellZoneNames_;
|
return cellZoneNames_;
|
||||||
@ -159,7 +160,7 @@ public:
|
|||||||
//- Get indices of named surfaces (surfaces with faceZoneName)
|
//- Get indices of named surfaces (surfaces with faceZoneName)
|
||||||
labelList getNamedSurfaces() const;
|
labelList getNamedSurfaces() const;
|
||||||
|
|
||||||
//- Get indices of closed named surfaces
|
//- Get indices of closed surfaces with a cellZone
|
||||||
labelList getClosedNamedSurfaces() const;
|
labelList getClosedNamedSurfaces() const;
|
||||||
|
|
||||||
//- From local region number to global region number
|
//- From local region number to global region number
|
||||||
|
|||||||
Reference in New Issue
Block a user