mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature_shm_zoning' into develop
Conflicts: src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
This commit is contained in:
@ -58,6 +58,7 @@ Description
|
|||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "decompositionModel.H"
|
#include "decompositionModel.H"
|
||||||
|
#include "fvMeshTools.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -813,6 +814,7 @@ int main(int argc, char *argv[])
|
|||||||
readScalar(meshDict.lookup("mergeTolerance"))
|
readScalar(meshDict.lookup("mergeTolerance"))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const Switch keepPatches(meshDict.lookupOrDefault("keepPatches", false));
|
||||||
|
|
||||||
|
|
||||||
// Read decomposePar dictionary
|
// Read decomposePar dictionary
|
||||||
@ -1517,6 +1519,12 @@ int main(int argc, char *argv[])
|
|||||||
motionDict
|
motionDict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Remove zero sized patches originating from faceZones
|
||||||
|
if (!keepPatches && !wantSnap && !wantLayers)
|
||||||
|
{
|
||||||
|
fvMeshTools::removeEmptyPatches(mesh, true);
|
||||||
|
}
|
||||||
|
|
||||||
writeMesh
|
writeMesh
|
||||||
(
|
(
|
||||||
"Refined mesh",
|
"Refined mesh",
|
||||||
@ -1559,6 +1567,12 @@ int main(int argc, char *argv[])
|
|||||||
snapParams
|
snapParams
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Remove zero sized patches originating from faceZones
|
||||||
|
if (!keepPatches && !wantLayers)
|
||||||
|
{
|
||||||
|
fvMeshTools::removeEmptyPatches(mesh, true);
|
||||||
|
}
|
||||||
|
|
||||||
writeMesh
|
writeMesh
|
||||||
(
|
(
|
||||||
"Snapped mesh",
|
"Snapped mesh",
|
||||||
@ -1609,6 +1623,12 @@ int main(int argc, char *argv[])
|
|||||||
distributor
|
distributor
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Remove zero sized patches originating from faceZones
|
||||||
|
if (!keepPatches)
|
||||||
|
{
|
||||||
|
fvMeshTools::removeEmptyPatches(mesh, true);
|
||||||
|
}
|
||||||
|
|
||||||
writeMesh
|
writeMesh
|
||||||
(
|
(
|
||||||
"Layer mesh",
|
"Layer mesh",
|
||||||
@ -1622,6 +1642,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// Check final mesh
|
// Check final mesh
|
||||||
Info<< "Checking final mesh ..." << endl;
|
Info<< "Checking final mesh ..." << endl;
|
||||||
|
|||||||
@ -296,8 +296,18 @@ castellatedMeshControls
|
|||||||
locationInMesh (5 0.28 0.43);
|
locationInMesh (5 0.28 0.43);
|
||||||
|
|
||||||
// Whether any faceZones (as specified in the refinementSurfaces)
|
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||||
// are only on the boundary of corresponding cellZones or also allow
|
// are only on the boundary of corresponding cellZones.
|
||||||
// free-standing zone faces. Not used if there are no faceZones.
|
// Not used if there are no faceZones. The behaviour has changed
|
||||||
|
// with respect to previous versions:
|
||||||
|
// true : all intersections with surface are put in faceZone
|
||||||
|
// (same behaviour as before)
|
||||||
|
// false : depending on the type of surface intersected:
|
||||||
|
// - if intersecting surface has faceZone only (so no cellZone)
|
||||||
|
// leave in faceZone (so behave as if set to true) (= changed
|
||||||
|
// behaviour)
|
||||||
|
// - if intersecting surface has faceZone and cellZone
|
||||||
|
// remove if inbetween same cellZone or if on boundary
|
||||||
|
// (same behaviour as before)
|
||||||
allowFreeStandingZoneFaces true;
|
allowFreeStandingZoneFaces true;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -355,6 +355,69 @@ void Foam::fvMeshTools::reorderPatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::fvMeshTools::removeEmptyPatches
|
||||||
|
(
|
||||||
|
fvMesh& mesh,
|
||||||
|
const bool validBoundary
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
labelList newToOld(pbm.size());
|
||||||
|
labelList oldToNew(pbm.size(), -1);
|
||||||
|
label newI = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Assumes all non-coupled boundaries are on all processors!
|
||||||
|
forAll(pbm, patchI)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = pbm[patchI];
|
||||||
|
|
||||||
|
if (!isA<processorPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
label nFaces = pp.size();
|
||||||
|
if (validBoundary)
|
||||||
|
{
|
||||||
|
reduce(nFaces, sumOp<label>());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nFaces > 0)
|
||||||
|
{
|
||||||
|
newToOld[newI] = patchI;
|
||||||
|
oldToNew[patchI] = newI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Same for processor patches (but need no reduction)
|
||||||
|
forAll(pbm, patchI)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = pbm[patchI];
|
||||||
|
|
||||||
|
if (isA<processorPolyPatch>(pp) && pp.size())
|
||||||
|
{
|
||||||
|
newToOld[newI] = patchI;
|
||||||
|
oldToNew[patchI] = newI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newToOld.setSize(newI);
|
||||||
|
|
||||||
|
// Move all deleteable patches to the end
|
||||||
|
forAll(oldToNew, patchI)
|
||||||
|
{
|
||||||
|
if (oldToNew[patchI] == -1)
|
||||||
|
{
|
||||||
|
oldToNew[patchI] = newI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reorderPatches(mesh, oldToNew, newToOld.size(), validBoundary);
|
||||||
|
|
||||||
|
return newToOld;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
|
Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
|
|||||||
@ -113,7 +113,7 @@ public:
|
|||||||
static void zeroPatchFields(fvMesh& mesh, const label patchI);
|
static void zeroPatchFields(fvMesh& mesh, const label patchI);
|
||||||
|
|
||||||
//- Reorder and remove trailing patches. If validBoundary call is parallel
|
//- Reorder and remove trailing patches. If validBoundary call is parallel
|
||||||
// synced and all add the same patch with same settings
|
// synced
|
||||||
static void reorderPatches
|
static void reorderPatches
|
||||||
(
|
(
|
||||||
fvMesh&,
|
fvMesh&,
|
||||||
@ -122,6 +122,11 @@ public:
|
|||||||
const bool validBoundary
|
const bool validBoundary
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Remove zero sized patches. All but processor patches are
|
||||||
|
// assumed to be present on all processors (so size will be reduced
|
||||||
|
// if validBoundary). Return map from new
|
||||||
|
// to old patches
|
||||||
|
static labelList removeEmptyPatches(fvMesh&, const bool validBoundary);
|
||||||
|
|
||||||
//- Read mesh or create dummy mesh (0 cells, >0 patches). Works in two
|
//- Read mesh or create dummy mesh (0 cells, >0 patches). Works in two
|
||||||
// modes according to masterOnlyReading:
|
// modes according to masterOnlyReading:
|
||||||
@ -133,7 +138,6 @@ public:
|
|||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const bool masterOnlyReading
|
const bool masterOnlyReading
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -74,14 +74,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
|
|||||||
if (dict.readIfPresent("locationInMesh", locationInMesh))
|
if (dict.readIfPresent("locationInMesh", locationInMesh))
|
||||||
{
|
{
|
||||||
locationsInMesh_.append(locationInMesh);
|
locationsInMesh_.append(locationInMesh);
|
||||||
zonesInMesh_.append("noneIfNotSet");// special name for no cellZone
|
zonesInMesh_.append("none"); // special name for no cellZone
|
||||||
|
|
||||||
if (dict.found("locationsInMesh"))
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction(dict)
|
|
||||||
<< "Cannot both specify 'locationInMesh' and 'locationsInMesh'"
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Tuple2<point, word> > pointsToZone;
|
List<Tuple2<point, word> > pointsToZone;
|
||||||
@ -95,6 +88,10 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
locationsInMesh_[nZones] = pointsToZone[i].first();
|
locationsInMesh_[nZones] = pointsToZone[i].first();
|
||||||
zonesInMesh_[nZones] = pointsToZone[i].second();
|
zonesInMesh_[nZones] = pointsToZone[i].second();
|
||||||
|
if (zonesInMesh_[nZones] == word::null)
|
||||||
|
{
|
||||||
|
zonesInMesh_[nZones] = "none";
|
||||||
|
}
|
||||||
nZones++;
|
nZones++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,12 +149,7 @@ Foam::labelList Foam::refinementParameters::addCellZonesToMesh
|
|||||||
labelList zoneIDs(zonesInMesh_.size(), -1);
|
labelList zoneIDs(zonesInMesh_.size(), -1);
|
||||||
forAll(zonesInMesh_, i)
|
forAll(zonesInMesh_, i)
|
||||||
{
|
{
|
||||||
if
|
if (zonesInMesh_[i] != word::null && zonesInMesh_[i] != "none")
|
||||||
(
|
|
||||||
zonesInMesh_[i] != word::null
|
|
||||||
&& zonesInMesh_[i] != "none"
|
|
||||||
&& zonesInMesh_[i] != "noneIfNotSet"
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
zoneIDs[i] = surfaceZonesInfo::addCellZone
|
zoneIDs[i] = surfaceZonesInfo::addCellZone
|
||||||
(
|
(
|
||||||
@ -242,8 +234,8 @@ Foam::labelList Foam::refinementParameters::zonedLocations
|
|||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
zonesInMesh[i] == word::null
|
zonesInMesh[i] != word::null
|
||||||
|| zonesInMesh[i] != "noneIfNotSet"
|
&& zonesInMesh[i] != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
indices.append(i);
|
indices.append(i);
|
||||||
@ -264,8 +256,8 @@ Foam::labelList Foam::refinementParameters::unzonedLocations
|
|||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
zonesInMesh[i] != word::null
|
zonesInMesh[i] == word::null
|
||||||
&& zonesInMesh[i] == "noneIfNotSet"
|
|| zonesInMesh[i] == "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
indices.append(i);
|
indices.append(i);
|
||||||
|
|||||||
@ -507,7 +507,6 @@ private:
|
|||||||
void getIntersections
|
void getIntersections
|
||||||
(
|
(
|
||||||
const labelList& surfacesToTest,
|
const labelList& surfacesToTest,
|
||||||
const labelList& neiLevel,
|
|
||||||
const pointField& neiCc,
|
const pointField& neiCc,
|
||||||
const labelList& testFaces,
|
const labelList& testFaces,
|
||||||
|
|
||||||
@ -515,7 +514,19 @@ private:
|
|||||||
labelList& globalRegion2
|
labelList& globalRegion2
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Determine patches for baffles on all intersected unnamed faces
|
//- Calculate intersections on zoned faces. Return per face -1
|
||||||
|
// or the index of the surface and the orientation w.r.t. surface
|
||||||
|
void getIntersections
|
||||||
|
(
|
||||||
|
const labelList& surfacesToTest,
|
||||||
|
const pointField& neiCc,
|
||||||
|
const labelList& testFaces,
|
||||||
|
|
||||||
|
labelList& namedSurfaceIndex,
|
||||||
|
PackedBoolList& posOrientation
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Determine patches for baffles
|
||||||
void getBafflePatches
|
void getBafflePatches
|
||||||
(
|
(
|
||||||
const labelList& globalToMasterPatch,
|
const labelList& globalToMasterPatch,
|
||||||
@ -635,13 +646,13 @@ private:
|
|||||||
labelList& cellToZone
|
labelList& cellToZone
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Finds zone per cell for cells inside named surfaces that have
|
//- Finds zone per cell for cells inside region for which name
|
||||||
// an inside point specified.
|
// is specified.
|
||||||
void findCellZoneInsideWalk
|
void findCellZoneInsideWalk
|
||||||
(
|
(
|
||||||
const labelList& locationSurfaces,
|
const pointField& locationsInMesh,
|
||||||
const labelList& namedSurfaceIndex,
|
const labelList& zonesInMesh,
|
||||||
const labelList& surfaceToCellZone,
|
const labelList& blockedFace, // per face -1 or some index >= 0
|
||||||
labelList& cellToZone
|
labelList& cellToZone
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -650,8 +661,8 @@ private:
|
|||||||
void findCellZoneInsideWalk
|
void findCellZoneInsideWalk
|
||||||
(
|
(
|
||||||
const pointField& locationsInMesh,
|
const pointField& locationsInMesh,
|
||||||
const wordList& regionsInMesh,
|
const wordList& zoneNamesInMesh,
|
||||||
const labelList& blockedFace, // per face -1 or some index >= 0
|
const labelList& faceToZone, // per face -1 or some index >= 0
|
||||||
labelList& cellToZone
|
labelList& cellToZone
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -670,6 +681,7 @@ private:
|
|||||||
void findCellZoneTopo
|
void findCellZoneTopo
|
||||||
(
|
(
|
||||||
const pointField& locationsInMesh,
|
const pointField& locationsInMesh,
|
||||||
|
const labelList& allSurfaceIndex,
|
||||||
const labelList& namedSurfaceIndex,
|
const labelList& namedSurfaceIndex,
|
||||||
const labelList& surfaceToCellZone,
|
const labelList& surfaceToCellZone,
|
||||||
labelList& cellToZone
|
labelList& cellToZone
|
||||||
@ -679,10 +691,23 @@ private:
|
|||||||
// - 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& cellToZone,
|
const labelList& cellToZone,
|
||||||
labelList& namedSurfaceIndex
|
labelList& namedSurfaceIndex
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Calculate cellZone allocation
|
||||||
|
void zonify
|
||||||
|
(
|
||||||
|
const bool allowFreeStandingZoneFaces,
|
||||||
|
const pointField& locationsInMesh,
|
||||||
|
const wordList& zonesInMesh,
|
||||||
|
|
||||||
|
labelList& cellToZone,
|
||||||
|
labelList& namedSurfaceIndex,
|
||||||
|
PackedBoolList& posOrientation
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Put cells into cellZone, faces into faceZone
|
//- Put cells into cellZone, faces into faceZone
|
||||||
void zonify
|
void zonify
|
||||||
(
|
(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -226,6 +226,32 @@ Foam::labelList Foam::surfaceZonesInfo::getNamedSurfaces
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::surfaceZonesInfo::getStandaloneNamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
|
)
|
||||||
|
{
|
||||||
|
labelList namedSurfaces(surfList.size());
|
||||||
|
|
||||||
|
label namedI = 0;
|
||||||
|
forAll(surfList, surfI)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
surfList.set(surfI)
|
||||||
|
&& surfList[surfI].faceZoneName().size()
|
||||||
|
&& !surfList[surfI].cellZoneName().size()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
namedSurfaces[namedI++] = surfI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
namedSurfaces.setSize(namedI);
|
||||||
|
|
||||||
|
return namedSurfaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::surfaceZonesInfo::getClosedNamedSurfaces
|
Foam::labelList Foam::surfaceZonesInfo::getClosedNamedSurfaces
|
||||||
(
|
(
|
||||||
const PtrList<surfaceZonesInfo>& surfList,
|
const PtrList<surfaceZonesInfo>& surfList,
|
||||||
|
|||||||
@ -191,6 +191,12 @@ public:
|
|||||||
const PtrList<surfaceZonesInfo>& surfList
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Get indices of named surfaces without a cellZone
|
||||||
|
static labelList getStandaloneNamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
|
);
|
||||||
|
|
||||||
//- Get indices of surfaces with a cellZone that are closed and
|
//- Get indices of surfaces with a cellZone that are closed and
|
||||||
// have 'inside' or 'outside' selection.
|
// have 'inside' or 'outside' selection.
|
||||||
static labelList getClosedNamedSurfaces
|
static labelList getClosedNamedSurfaces
|
||||||
|
|||||||
Reference in New Issue
Block a user