BUG: wrong numbering when determining the zoneIDs

of the STL written by topology optimisation.

BUG: when determining which mesh faces are cut by iso-surface faces,
only append the latter if it contains more than two points
This commit is contained in:
Vaggelis Papoutsis
2023-11-23 14:55:58 +02:00
committed by Andrew Heather
parent e5d5e7b0be
commit 1f7fb08060
2 changed files with 30 additions and 29 deletions

View File

@ -141,8 +141,7 @@ bool Foam::topOVariablesBase::addCuttingFaceToIsoline
{ {
// Check whether any of points of the new iso-surface face are already // Check whether any of points of the new iso-surface face are already
// present in the surface. To reduce the number of comparisons, only // present in the surface. To reduce the number of comparisons, only
// points on iso-surface faces belonging to neighbouring cells are // points on iso-surface faces cutting the current cell are checked
// checked
labelList uniquePointIDs(facePoints.size(), -1); labelList uniquePointIDs(facePoints.size(), -1);
DynamicList<point> uniqueFacePoints(facePoints.size()); DynamicList<point> uniqueFacePoints(facePoints.size());
DynamicList<label> uniqueFacePointEdges(facePoints.size()); DynamicList<label> uniqueFacePointEdges(facePoints.size());
@ -362,8 +361,8 @@ void Foam::topOVariablesBase::writeSurfaceFiles
} }
// Faces passed in previous zones // Faces passed in previous zones
labelList cumulZoneSizes(surfZoneIds.size(), 0); labelList cumulZoneSizes(nSerialPatches + 1, 0);
for (label zi = 1; zi < surfZoneIds.size() - 1; ++zi) for (label zi = 1; zi < cumulZoneSizes.size(); ++zi)
{ {
cumulZoneSizes[zi] = cumulZoneSizes[zi - 1] + zoneSizes[zi - 1]; cumulZoneSizes[zi] = cumulZoneSizes[zi - 1] + zoneSizes[zi - 1];
} }
@ -426,8 +425,6 @@ void Foam::topOVariablesBase::writeSurfaceFiles
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::topOVariablesBase::topOVariablesBase Foam::topOVariablesBase::topOVariablesBase
@ -453,7 +450,7 @@ Foam::topOVariablesBase::topOVariablesBase
isoSurfFolder_ isoSurfFolder_
(mesh.time().globalPath()/"optimisation"/"topOIsoSurfaces"), (mesh.time().globalPath()/"optimisation"/"topOIsoSurfaces"),
meshFaceToChangedFace_(), meshFaceToChangedFace_(),
changedFacesPerCuttingFace_(), //changedFacesPerCuttingFace_(),
surfPoints_(), surfPoints_(),
surfFaces_() surfFaces_()
{ {
@ -615,23 +612,27 @@ void Foam::topOVariablesBase::writeFluidSolidInterface
} }
} }
addCuttingFaceToIsoline if
( (
cutCell.facePoints(), addCuttingFaceToIsoline
nSerialPatches,
cellCutFaces,
cuttingFacesPerMeshFace,
isoSurfPts,
isoSurfFaces,
zoneIDs
);
for (const label facei : cellCutFaces)
{
cuttingFacesPerMeshFace[facei].push_back
( (
isoSurfFaces.size() - 1 cutCell.facePoints(),
); nSerialPatches,
cellCutFaces,
cuttingFacesPerMeshFace,
isoSurfPts,
isoSurfFaces,
zoneIDs
)
)
{
for (const label facei : cellCutFaces)
{
cuttingFacesPerMeshFace[facei].push_back
(
isoSurfFaces.size() - 1
);
}
} }
} }
} }
@ -664,8 +665,8 @@ void Foam::topOVariablesBase::writeFluidSolidInterface
writeSurfaceFiles(surfPoints_, surfFaces_, zoneIds, nSerialPatches); writeSurfaceFiles(surfPoints_, surfFaces_, zoneIds, nSerialPatches);
// Invert changedFace-to-cuttingFace map for the sensitivity computations // Invert changedFace-to-cuttingFace map for the sensitivity computations
changedFacesPerCuttingFace_ = //changedFacesPerCuttingFace_ =
invertOneToMany(surfFaces_.size(), changedFaceToCutFace); // invertOneToMany(surfFaces_.size(), changedFaceToCutFace);
// Transform origin cut faces to a global numbering // Transform origin cut faces to a global numbering
labelList cuttingFacesPerProc(Pstream::nProcs(), Zero); labelList cuttingFacesPerProc(Pstream::nProcs(), Zero);

View File

@ -77,7 +77,7 @@ protected:
Map<label> meshFaceToChangedFace_; Map<label> meshFaceToChangedFace_;
//- Per cutting face, the changed faces owned by it //- Per cutting face, the changed faces owned by it
labelListList changedFacesPerCuttingFace_; //labelListList changedFacesPerCuttingFace_;
//- Iso-surface points //- Iso-surface points
pointField surfPoints_; pointField surfPoints_;
@ -208,10 +208,10 @@ public:
return zones_.getBetaMax(); return zones_.getBetaMax();
} }
inline const labelListList& changedFacesPerCuttingFace() const //inline const labelListList& changedFacesPerCuttingFace() const
{ //{
return changedFacesPerCuttingFace_; // return changedFacesPerCuttingFace_;
} //}
inline const pointField& surfacePoints() const inline const pointField& surfacePoints() const
{ {