mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature/foamyHexMesh-baffles'
This commit is contained in:
@ -265,6 +265,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
|||||||
allGeometryToSurfaces_(),
|
allGeometryToSurfaces_(),
|
||||||
normalVolumeTypes_(),
|
normalVolumeTypes_(),
|
||||||
patchNames_(),
|
patchNames_(),
|
||||||
|
surfZones_(),
|
||||||
regionOffset_(),
|
regionOffset_(),
|
||||||
patchInfo_(),
|
patchInfo_(),
|
||||||
globalBounds_(),
|
globalBounds_(),
|
||||||
@ -275,157 +276,198 @@ Foam::conformationSurfaces::conformationSurfaces
|
|||||||
surfaceConformationDict.subDict("geometryToConformTo")
|
surfaceConformationDict.subDict("geometryToConformTo")
|
||||||
);
|
);
|
||||||
|
|
||||||
const label nSurf = surfacesDict.size();
|
|
||||||
|
|
||||||
const dictionary& additionalFeaturesDict
|
const dictionary& additionalFeaturesDict
|
||||||
(
|
(
|
||||||
surfaceConformationDict.subDict("additionalFeatures")
|
surfaceConformationDict.subDict("additionalFeatures")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Wildcard specification : loop over all surface, all regions
|
||||||
|
// and try to find a match.
|
||||||
|
|
||||||
|
// Count number of surfaces.
|
||||||
|
label surfI = 0;
|
||||||
|
forAll(allGeometry.names(), geomI)
|
||||||
|
{
|
||||||
|
const word& geomName = allGeometry_.names()[geomI];
|
||||||
|
|
||||||
|
if (surfacesDict.found(geomName))
|
||||||
|
{
|
||||||
|
surfI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const label nAddFeat = additionalFeaturesDict.size();
|
const label nAddFeat = additionalFeaturesDict.size();
|
||||||
|
|
||||||
Info<< nl << "Reading geometryToConformTo" << endl;
|
Info<< nl << "Reading geometryToConformTo" << endl;
|
||||||
|
|
||||||
surfaces_.setSize(nSurf, -1);
|
|
||||||
|
|
||||||
allGeometryToSurfaces_.setSize(allGeometry_.size(), -1);
|
allGeometryToSurfaces_.setSize(allGeometry_.size(), -1);
|
||||||
|
|
||||||
normalVolumeTypes_.setSize(nSurf);
|
normalVolumeTypes_.setSize(surfI);
|
||||||
|
surfaces_.setSize(surfI);
|
||||||
|
surfZones_.setSize(surfI);
|
||||||
|
|
||||||
// Features may be attached to host surfaces or independent
|
// Features may be attached to host surfaces or independent
|
||||||
features_.setSize(nSurf + nAddFeat);
|
features_.setSize(surfI + nAddFeat);
|
||||||
|
|
||||||
label featureI = 0;
|
label featureI = 0;
|
||||||
|
|
||||||
regionOffset_.setSize(nSurf, 0);
|
regionOffset_.setSize(surfI, 0);
|
||||||
|
|
||||||
PtrList<dictionary> globalPatchInfo(nSurf);
|
PtrList<dictionary> globalPatchInfo(surfI);
|
||||||
List<Map<autoPtr<dictionary> > > regionPatchInfo(nSurf);
|
List<Map<autoPtr<dictionary> > > regionPatchInfo(surfI);
|
||||||
List<sideVolumeType> globalVolumeTypes(nSurf);
|
List<sideVolumeType> globalVolumeTypes(surfI);
|
||||||
List<Map<sideVolumeType> > regionVolumeTypes(nSurf);
|
List<Map<sideVolumeType> > regionVolumeTypes(surfI);
|
||||||
|
|
||||||
label surfI = 0;
|
HashSet<word> unmatchedKeys(surfacesDict.toc());
|
||||||
|
|
||||||
forAllConstIter(dictionary, surfacesDict, iter)
|
surfI = 0;
|
||||||
|
forAll(allGeometry_.names(), geomI)
|
||||||
{
|
{
|
||||||
word surfaceName = iter().keyword();
|
const word& geomName = allGeometry_.names()[geomI];
|
||||||
|
|
||||||
surfaces_[surfI] = allGeometry_.findSurfaceID(surfaceName);
|
const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
|
||||||
|
|
||||||
if (surfaces_[surfI] < 0)
|
if (ePtr)
|
||||||
{
|
{
|
||||||
FatalErrorIn("Foam::conformationSurfaces::conformationSurfaces")
|
const dictionary& dict = ePtr->dict();
|
||||||
<< "No surface " << surfaceName << " found. "
|
unmatchedKeys.erase(ePtr->keyword());
|
||||||
<< "Valid geometry is " << nl << allGeometry_.names()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
allGeometryToSurfaces_[surfaces_[surfI]] = surfI;
|
surfaces_[surfI] = geomI;
|
||||||
|
|
||||||
Info<< nl << " " << surfaceName << endl;
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
|
||||||
const wordList& regionNames =
|
// Surface zones
|
||||||
allGeometry_.regionNames()[surfaces_[surfI]];
|
if (dict.found("faceZone"))
|
||||||
|
|
||||||
patchNames_.append(regionNames);
|
|
||||||
|
|
||||||
const dictionary& surfaceSubDict(surfacesDict.subDict(surfaceName));
|
|
||||||
|
|
||||||
globalVolumeTypes[surfI] =
|
|
||||||
(
|
|
||||||
extendedFeatureEdgeMesh::sideVolumeTypeNames_
|
|
||||||
[
|
|
||||||
surfaceSubDict.lookupOrDefault<word>("meshableSide", "inside")
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!globalVolumeTypes[surfI])
|
|
||||||
{
|
|
||||||
if (!allGeometry_[surfaces_[surfI]].hasVolumeType())
|
|
||||||
{
|
{
|
||||||
WarningIn("conformationSurfaces::conformationSurfaces(..)")
|
surfZones_.set(surfI, new surfaceZonesInfo(surface, dict));
|
||||||
<< "Non-baffle surface "
|
|
||||||
<< allGeometry_[surfaces_[surfI]].name()
|
|
||||||
<< " does not allow inside/outside queries."
|
|
||||||
<< " This usually is an error." << endl;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Load patch info
|
allGeometryToSurfaces_[surfaces_[surfI]] = surfI;
|
||||||
if (surfaceSubDict.found("patchInfo"))
|
|
||||||
{
|
Info<< nl << " " << geomName << endl;
|
||||||
globalPatchInfo.set
|
|
||||||
|
const wordList& regionNames =
|
||||||
|
allGeometry_.regionNames()[surfaces_[surfI]];
|
||||||
|
|
||||||
|
patchNames_.append(regionNames);
|
||||||
|
|
||||||
|
globalVolumeTypes[surfI] =
|
||||||
(
|
(
|
||||||
surfI,
|
extendedFeatureEdgeMesh::sideVolumeTypeNames_
|
||||||
surfaceSubDict.subDict("patchInfo").clone()
|
[
|
||||||
|
dict.lookupOrDefault<word>
|
||||||
|
(
|
||||||
|
"meshableSide",
|
||||||
|
"inside"
|
||||||
|
)
|
||||||
|
]
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
readFeatures
|
if (!globalVolumeTypes[surfI])
|
||||||
(
|
|
||||||
surfI,
|
|
||||||
surfaceSubDict,
|
|
||||||
surfaceName,
|
|
||||||
featureI
|
|
||||||
);
|
|
||||||
|
|
||||||
const wordList& rNames = allGeometry_[surfaces_[surfI]].regions();
|
|
||||||
|
|
||||||
if (surfaceSubDict.found("regions"))
|
|
||||||
{
|
|
||||||
const dictionary& regionsDict = surfaceSubDict.subDict("regions");
|
|
||||||
|
|
||||||
forAll(rNames, regionI)
|
|
||||||
{
|
{
|
||||||
const word& regionName = rNames[regionI];
|
if (!surface.hasVolumeType())
|
||||||
|
|
||||||
if (regionsDict.found(regionName))
|
|
||||||
{
|
{
|
||||||
Info<< " region " << regionName << endl;
|
WarningIn("conformationSurfaces::conformationSurfaces(..)")
|
||||||
|
<< "Non-baffle surface "
|
||||||
// Get the dictionary for region
|
<< surface.name()
|
||||||
const dictionary& regionDict = regionsDict.subDict
|
<< " does not allow inside/outside queries."
|
||||||
(
|
<< " This usually is an error." << endl;
|
||||||
regionName
|
|
||||||
);
|
|
||||||
|
|
||||||
if (regionDict.found("patchInfo"))
|
|
||||||
{
|
|
||||||
regionPatchInfo[surfI].insert
|
|
||||||
(
|
|
||||||
regionI,
|
|
||||||
regionDict.subDict("patchInfo").clone()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
regionVolumeTypes[surfI].insert
|
|
||||||
(
|
|
||||||
regionI,
|
|
||||||
extendedFeatureEdgeMesh::sideVolumeTypeNames_
|
|
||||||
[
|
|
||||||
regionDict.lookupOrDefault<word>
|
|
||||||
(
|
|
||||||
"meshableSide",
|
|
||||||
"inside"
|
|
||||||
)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
readFeatures(regionDict, regionName, featureI);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
surfI++;
|
// Load patch info
|
||||||
|
if (dict.found("patchInfo"))
|
||||||
|
{
|
||||||
|
globalPatchInfo.set
|
||||||
|
(
|
||||||
|
surfI,
|
||||||
|
dict.subDict("patchInfo").clone()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
readFeatures
|
||||||
|
(
|
||||||
|
surfI,
|
||||||
|
dict,
|
||||||
|
geomName,
|
||||||
|
featureI
|
||||||
|
);
|
||||||
|
|
||||||
|
const wordList& rNames = surface.regions();
|
||||||
|
|
||||||
|
if (dict.found("regions"))
|
||||||
|
{
|
||||||
|
const dictionary& regionsDict = dict.subDict("regions");
|
||||||
|
|
||||||
|
forAll(rNames, regionI)
|
||||||
|
{
|
||||||
|
const word& regionName = rNames[regionI];
|
||||||
|
|
||||||
|
if (regionsDict.found(regionName))
|
||||||
|
{
|
||||||
|
Info<< " region " << regionName << endl;
|
||||||
|
|
||||||
|
// Get the dictionary for region
|
||||||
|
const dictionary& regionDict = regionsDict.subDict
|
||||||
|
(
|
||||||
|
regionName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (regionDict.found("patchInfo"))
|
||||||
|
{
|
||||||
|
regionPatchInfo[surfI].insert
|
||||||
|
(
|
||||||
|
regionI,
|
||||||
|
regionDict.subDict("patchInfo").clone()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
regionVolumeTypes[surfI].insert
|
||||||
|
(
|
||||||
|
regionI,
|
||||||
|
extendedFeatureEdgeMesh::sideVolumeTypeNames_
|
||||||
|
[
|
||||||
|
regionDict.lookupOrDefault<word>
|
||||||
|
(
|
||||||
|
"meshableSide",
|
||||||
|
"inside"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
readFeatures(regionDict, regionName, featureI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
surfI++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (unmatchedKeys.size() > 0)
|
||||||
|
{
|
||||||
|
IOWarningIn
|
||||||
|
(
|
||||||
|
"conformationSurfaces::conformationSurfaces(..)",
|
||||||
|
surfacesDict
|
||||||
|
) << "Not all entries in conformationSurfaces dictionary were used."
|
||||||
|
<< " The following entries were not used : "
|
||||||
|
<< unmatchedKeys.sortedToc()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Calculate local to global region offset
|
// Calculate local to global region offset
|
||||||
label nRegions = 0;
|
label nRegions = 0;
|
||||||
|
|
||||||
forAll(surfaces_, surfI)
|
forAll(surfaces_, surfI)
|
||||||
{
|
{
|
||||||
regionOffset_[surfI] = nRegions;
|
regionOffset_[surfI] = nRegions;
|
||||||
nRegions += allGeometry_[surfaces_[surfI]].regions().size();
|
|
||||||
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
nRegions += surface.regions().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rework surface specific information into information per global region
|
// Rework surface specific information into information per global region
|
||||||
@ -434,7 +476,9 @@ Foam::conformationSurfaces::conformationSurfaces
|
|||||||
|
|
||||||
forAll(surfaces_, surfI)
|
forAll(surfaces_, surfI)
|
||||||
{
|
{
|
||||||
label nRegions = allGeometry_[surfaces_[surfI]].regions().size();
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
|
||||||
|
label nRegions = surface.regions().size();
|
||||||
|
|
||||||
// Initialise to global (i.e. per surface)
|
// Initialise to global (i.e. per surface)
|
||||||
for (label i = 0; i < nRegions; i++)
|
for (label i = 0; i < nRegions; i++)
|
||||||
@ -535,6 +579,30 @@ Foam::conformationSurfaces::conformationSurfaces
|
|||||||
Info<< features_[fI].name() << endl;
|
Info<< features_[fI].name() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<< "ZONES" << endl;
|
||||||
|
forAll(surfZones_, surfI)
|
||||||
|
{
|
||||||
|
if (surfZones_.set(surfI))
|
||||||
|
{
|
||||||
|
const surfaceZonesInfo& sInfo = surfZones_[surfI];
|
||||||
|
|
||||||
|
Info<< " " << surfI << nl
|
||||||
|
<< " faceZoneName = " << sInfo.faceZoneName() << nl
|
||||||
|
<< " cellZoneName = " << sInfo.cellZoneName() << nl
|
||||||
|
<< " zoneInside = "
|
||||||
|
<< surfaceZonesInfo::areaSelectionAlgoNames[sInfo.zoneInside()]
|
||||||
|
<< nl
|
||||||
|
<< " zoneInsidePoint = " << sInfo.zoneInsidePoint() << nl
|
||||||
|
<< " faceType = "
|
||||||
|
<< surfaceZonesInfo::faceZoneTypeNames[sInfo.faceType()]
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< " " << surfI << " EMPTY" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1165,13 +1233,7 @@ Foam::label Foam::conformationSurfaces::findPatch(const point& pt) const
|
|||||||
pointIndexHit surfHit;
|
pointIndexHit surfHit;
|
||||||
label hitSurface;
|
label hitSurface;
|
||||||
|
|
||||||
findSurfaceNearest
|
findSurfaceNearest(pt, sqr(GREAT), surfHit, hitSurface);
|
||||||
(
|
|
||||||
pt,
|
|
||||||
sqr(GREAT),
|
|
||||||
surfHit,
|
|
||||||
hitSurface
|
|
||||||
);
|
|
||||||
|
|
||||||
return getPatchID(hitSurface, surfHit);
|
return getPatchID(hitSurface, surfHit);
|
||||||
}
|
}
|
||||||
@ -1229,11 +1291,7 @@ void Foam::conformationSurfaces::getNormal
|
|||||||
vectorField& normal
|
vectorField& normal
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
allGeometry_[hitSurface].getNormal
|
allGeometry_[hitSurface].getNormal(surfHit, normal);
|
||||||
(
|
|
||||||
surfHit,
|
|
||||||
normal
|
|
||||||
);
|
|
||||||
|
|
||||||
const label patchID = regionOffset_[allGeometryToSurfaces_[hitSurface]];
|
const label patchID = regionOffset_[allGeometryToSurfaces_[hitSurface]];
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,7 @@ SourceFiles
|
|||||||
#include "extendedFeatureEdgeMesh.H"
|
#include "extendedFeatureEdgeMesh.H"
|
||||||
#include "boolList.H"
|
#include "boolList.H"
|
||||||
#include "volumeType.H"
|
#include "volumeType.H"
|
||||||
|
#include "surfaceZonesInfo.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class conformationSurfaces Declaration
|
Class conformationSurfaces Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class conformationSurfaces
|
class conformationSurfaces
|
||||||
@ -86,6 +87,9 @@ class conformationSurfaces
|
|||||||
// surfaces to be reproduced in the meshed geometry
|
// surfaces to be reproduced in the meshed geometry
|
||||||
List<word> patchNames_;
|
List<word> patchNames_;
|
||||||
|
|
||||||
|
//- List of surface zone (face and cell zone) information
|
||||||
|
PtrList<surfaceZonesInfo> surfZones_;
|
||||||
|
|
||||||
//- The offset between the patch indices of the individual surface and
|
//- The offset between the patch indices of the individual surface and
|
||||||
// the entry in the overall patch list
|
// the entry in the overall patch list
|
||||||
labelList regionOffset_;
|
labelList regionOffset_;
|
||||||
@ -170,6 +174,9 @@ public:
|
|||||||
//- Return the patch names
|
//- Return the patch names
|
||||||
inline const List<word>& patchNames() const;
|
inline const List<word>& patchNames() const;
|
||||||
|
|
||||||
|
//- Return the surfaceZonesInfo
|
||||||
|
inline const PtrList<surfaceZonesInfo>& surfZones() const;
|
||||||
|
|
||||||
//- Return the patch info
|
//- Return the patch info
|
||||||
inline const PtrList<dictionary>& patchInfo() const;
|
inline const PtrList<dictionary>& patchInfo() const;
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,13 @@ const Foam::List<Foam::word>& Foam::conformationSurfaces::patchNames() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::PtrList<Foam::surfaceZonesInfo>&
|
||||||
|
Foam::conformationSurfaces::surfZones() const
|
||||||
|
{
|
||||||
|
return surfZones_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::PtrList<Foam::dictionary>&
|
const Foam::PtrList<Foam::dictionary>&
|
||||||
Foam::conformationSurfaces::patchInfo() const
|
Foam::conformationSurfaces::patchInfo() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -98,19 +98,8 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
|||||||
|
|
||||||
labelList surfaces(surfI);
|
labelList surfaces(surfI);
|
||||||
wordList names(surfI);
|
wordList names(surfI);
|
||||||
wordList faceZoneNames(surfI);
|
PtrList<surfaceZonesInfo> surfZones(surfI);
|
||||||
wordList cellZoneNames(surfI);
|
|
||||||
List<refinementSurfaces::areaSelectionAlgo> zoneInside
|
|
||||||
(
|
|
||||||
surfI,
|
|
||||||
refinementSurfaces::NONE
|
|
||||||
);
|
|
||||||
pointField zoneInsidePoints(surfI);
|
|
||||||
List<refinementSurfaces::faceZoneType> faceType
|
|
||||||
(
|
|
||||||
surfI,
|
|
||||||
refinementSurfaces::INTERNAL
|
|
||||||
);
|
|
||||||
labelList regionOffset(surfI);
|
labelList regionOffset(surfI);
|
||||||
|
|
||||||
labelList globalMinLevel(surfI, 0);
|
labelList globalMinLevel(surfI, 0);
|
||||||
@ -123,21 +112,24 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
|||||||
List<Map<scalar> > regionAngle(surfI);
|
List<Map<scalar> > regionAngle(surfI);
|
||||||
List<Map<autoPtr<dictionary> > > regionPatchInfo(surfI);
|
List<Map<autoPtr<dictionary> > > regionPatchInfo(surfI);
|
||||||
|
|
||||||
|
HashSet<word> unmatchedKeys(surfacesDict.toc());
|
||||||
|
|
||||||
surfI = 0;
|
surfI = 0;
|
||||||
forAll(allGeometry.names(), geomI)
|
forAll(allGeometry.names(), geomI)
|
||||||
{
|
{
|
||||||
const word& geomName = allGeometry.names()[geomI];
|
const word& geomName = allGeometry.names()[geomI];
|
||||||
|
|
||||||
|
const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
|
||||||
|
|
||||||
// Definition of surfaces to conform to
|
if (ePtr)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
if (surfacesDict.found(geomName))
|
|
||||||
{
|
{
|
||||||
|
const dictionary& shapeDict = ePtr->dict();
|
||||||
|
unmatchedKeys.erase(ePtr->keyword());
|
||||||
|
|
||||||
names[surfI] = geomName;
|
names[surfI] = geomName;
|
||||||
surfaces[surfI] = geomI;
|
surfaces[surfI] = geomI;
|
||||||
|
|
||||||
const dictionary& shapeDict = shapeControlDict.subDict(geomName);
|
const searchableSurface& surface = allGeometry[geomI];
|
||||||
|
|
||||||
// Find the index in shapeControlDict
|
// Find the index in shapeControlDict
|
||||||
// Invert surfaceCellSize to get the refinementLevel
|
// Invert surfaceCellSize to get the refinementLevel
|
||||||
@ -160,107 +152,26 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
|||||||
globalMaxLevel[surfI] = refLevel;
|
globalMaxLevel[surfI] = refLevel;
|
||||||
globalLevelIncr[surfI] = gapLevelIncrement;
|
globalLevelIncr[surfI] = gapLevelIncrement;
|
||||||
|
|
||||||
const dictionary& dict = surfacesDict.subDict(geomName);
|
// Surface zones
|
||||||
|
surfZones.set(surfI, new surfaceZonesInfo(surface, shapeDict));
|
||||||
// Global zone names per surface
|
|
||||||
if (dict.readIfPresent("faceZone", faceZoneNames[surfI]))
|
|
||||||
{
|
|
||||||
// Read optional entry to determine inside of faceZone
|
|
||||||
|
|
||||||
word method;
|
|
||||||
bool hasSide = dict.readIfPresent("cellZoneInside", method);
|
|
||||||
if (hasSide)
|
|
||||||
{
|
|
||||||
zoneInside[surfI] =
|
|
||||||
refinementSurfaces::areaSelectionAlgoNames[method];
|
|
||||||
if (zoneInside[surfI] == refinementSurfaces::INSIDEPOINT)
|
|
||||||
{
|
|
||||||
dict.lookup("insidePoint") >> zoneInsidePoints[surfI];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Check old syntax
|
|
||||||
bool inside;
|
|
||||||
if (dict.readIfPresent("zoneInside", inside))
|
|
||||||
{
|
|
||||||
hasSide = true;
|
|
||||||
zoneInside[surfI] =
|
|
||||||
(
|
|
||||||
inside
|
|
||||||
? refinementSurfaces::INSIDE
|
|
||||||
: refinementSurfaces::OUTSIDE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read optional cellZone name
|
|
||||||
|
|
||||||
if (dict.readIfPresent("cellZone", cellZoneNames[surfI]))
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(
|
|
||||||
zoneInside[surfI] == refinementSurfaces::INSIDE
|
|
||||||
|| zoneInside[surfI] == refinementSurfaces::OUTSIDE
|
|
||||||
)
|
|
||||||
&& !allGeometry[surfaces[surfI]].hasVolumeType()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IOWarningIn
|
|
||||||
(
|
|
||||||
"createRefinementSurfaces(..)",
|
|
||||||
dict
|
|
||||||
) << "Illegal entry zoneInside "
|
|
||||||
<< refinementSurfaces::areaSelectionAlgoNames
|
|
||||||
[
|
|
||||||
zoneInside[surfI]
|
|
||||||
]
|
|
||||||
<< " for faceZone "
|
|
||||||
<< faceZoneNames[surfI]
|
|
||||||
<< " since surface " << names[surfI]
|
|
||||||
<< " is not closed." << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (hasSide)
|
|
||||||
{
|
|
||||||
IOWarningIn
|
|
||||||
(
|
|
||||||
"createRefinementSurfaces(..)",
|
|
||||||
dict
|
|
||||||
) << "Unused entry zoneInside for faceZone "
|
|
||||||
<< faceZoneNames[surfI]
|
|
||||||
<< " since no cellZone specified."
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// How to handle faces on faceZone
|
|
||||||
word faceTypeMethod;
|
|
||||||
if (dict.readIfPresent("faceType", faceTypeMethod))
|
|
||||||
{
|
|
||||||
faceType[surfI] =
|
|
||||||
refinementSurfaces::faceZoneTypeNames[faceTypeMethod];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Global perpendicular angle
|
// Global perpendicular angle
|
||||||
if (dict.found("patchInfo"))
|
if (shapeDict.found("patchInfo"))
|
||||||
{
|
{
|
||||||
globalPatchInfo.set
|
globalPatchInfo.set
|
||||||
(
|
(
|
||||||
surfI,
|
surfI,
|
||||||
dict.subDict("patchInfo").clone()
|
shapeDict.subDict("patchInfo").clone()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Per region override of patchInfo
|
// Per region override of patchInfo
|
||||||
|
|
||||||
if (dict.found("regions"))
|
if (shapeDict.found("regions"))
|
||||||
{
|
{
|
||||||
const dictionary& regionsDict = dict.subDict("regions");
|
const dictionary& regionsDict = shapeDict.subDict("regions");
|
||||||
const wordList& regionNames =
|
const wordList& regionNames =
|
||||||
allGeometry[surfaces[surfI]].regions();
|
allGeometry[surfaces[surfI]].regions();
|
||||||
|
|
||||||
@ -333,6 +244,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surfI++;
|
surfI++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,11 +315,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
|||||||
allGeometry,
|
allGeometry,
|
||||||
surfaces,
|
surfaces,
|
||||||
names,
|
names,
|
||||||
faceZoneNames,
|
surfZones,
|
||||||
cellZoneNames,
|
|
||||||
zoneInside,
|
|
||||||
zoneInsidePoints,
|
|
||||||
faceType,
|
|
||||||
regionOffset,
|
regionOffset,
|
||||||
minLevel,
|
minLevel,
|
||||||
maxLevel,
|
maxLevel,
|
||||||
@ -1188,7 +1096,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< surfaces.names()[surfI] << ':' << nl << nl;
|
Info<< surfaces.names()[surfI] << ':' << nl << nl;
|
||||||
|
|
||||||
if (surfaces.faceZoneNames()[surfI].empty())
|
if (surfaces.surfZones()[surfI].faceZoneName().empty())
|
||||||
{
|
{
|
||||||
// 'Normal' surface
|
// 'Normal' surface
|
||||||
forAll(regNames, i)
|
forAll(regNames, i)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ $(autoHexMesh)/meshRefinement/meshRefinementMerge.C
|
|||||||
$(autoHexMesh)/meshRefinement/meshRefinementProblemCells.C
|
$(autoHexMesh)/meshRefinement/meshRefinementProblemCells.C
|
||||||
$(autoHexMesh)/meshRefinement/meshRefinementRefine.C
|
$(autoHexMesh)/meshRefinement/meshRefinementRefine.C
|
||||||
$(autoHexMesh)/refinementFeatures/refinementFeatures.C
|
$(autoHexMesh)/refinementFeatures/refinementFeatures.C
|
||||||
|
$(autoHexMesh)/refinementSurfaces/surfaceZonesInfo.C
|
||||||
$(autoHexMesh)/refinementSurfaces/refinementSurfaces.C
|
$(autoHexMesh)/refinementSurfaces/refinementSurfaces.C
|
||||||
$(autoHexMesh)/shellSurfaces/shellSurfaces.C
|
$(autoHexMesh)/shellSurfaces/shellSurfaces.C
|
||||||
$(autoHexMesh)/trackedParticle/trackedParticle.C
|
$(autoHexMesh)/trackedParticle/trackedParticle.C
|
||||||
|
|||||||
@ -927,7 +927,10 @@ void Foam::autoRefineDriver::zonify
|
|||||||
// into that surface's faceZone. All cells inside faceZone get given the
|
// into that surface's faceZone. All cells inside faceZone get given the
|
||||||
// same cellZone.
|
// same cellZone.
|
||||||
|
|
||||||
if (meshRefiner_.surfaces().getNamedSurfaces().size())
|
const labelList namedSurfaces =
|
||||||
|
surfaceZonesInfo::getNamedSurfaces(meshRefiner_.surfaces().surfZones());
|
||||||
|
|
||||||
|
if (namedSurfaces.size())
|
||||||
{
|
{
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "Introducing zones for interfaces" << nl
|
<< "Introducing zones for interfaces" << nl
|
||||||
|
|||||||
@ -590,7 +590,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::mergeZoneBaffles
|
|||||||
const List<labelPair>& baffles
|
const List<labelPair>& baffles
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
labelList zonedSurfaces = meshRefiner_.surfaces().getNamedSurfaces();
|
labelList zonedSurfaces =
|
||||||
|
surfaceZonesInfo::getNamedSurfaces(meshRefiner_.surfaces().surfZones());
|
||||||
|
|
||||||
autoPtr<mapPolyMesh> map;
|
autoPtr<mapPolyMesh> map;
|
||||||
|
|
||||||
@ -815,9 +816,15 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
|
|||||||
|
|
||||||
// Divide surfaces into zoned and unzoned
|
// Divide surfaces into zoned and unzoned
|
||||||
labelList zonedSurfaces =
|
labelList zonedSurfaces =
|
||||||
meshRefiner.surfaces().getNamedSurfaces();
|
surfaceZonesInfo::getNamedSurfaces
|
||||||
|
(
|
||||||
|
meshRefiner.surfaces().surfZones()
|
||||||
|
);
|
||||||
labelList unzonedSurfaces =
|
labelList unzonedSurfaces =
|
||||||
meshRefiner.surfaces().getUnnamedSurfaces();
|
surfaceZonesInfo::getUnnamedSurfaces
|
||||||
|
(
|
||||||
|
meshRefiner.surfaces().surfZones()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// 1. All points to non-interface surfaces
|
// 1. All points to non-interface surfaces
|
||||||
@ -854,7 +861,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
// Surfaces with zone information
|
// Surfaces with zone information
|
||||||
const wordList& faceZoneNames = surfaces.faceZoneNames();
|
const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones();
|
||||||
|
|
||||||
// Current best snap distance
|
// Current best snap distance
|
||||||
scalarField minSnapDist(snapDist);
|
scalarField minSnapDist(snapDist);
|
||||||
@ -863,6 +870,8 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
|
|||||||
{
|
{
|
||||||
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.
|
// Get indices of points both on faceZone and on pp.
|
||||||
@ -872,7 +881,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
pp,
|
pp,
|
||||||
faceZoneNames[zoneSurfI]
|
faceZoneName
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1369,8 +1378,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
|
|||||||
indirectPrimitivePatch& pp = ppPtr();
|
indirectPrimitivePatch& pp = ppPtr();
|
||||||
|
|
||||||
// Divide surfaces into zoned and unzoned
|
// Divide surfaces into zoned and unzoned
|
||||||
labelList zonedSurfaces = surfaces.getNamedSurfaces();
|
labelList zonedSurfaces =
|
||||||
labelList unzonedSurfaces = surfaces.getUnnamedSurfaces();
|
surfaceZonesInfo::getNamedSurfaces(surfaces.surfZones());
|
||||||
|
labelList unzonedSurfaces =
|
||||||
|
surfaceZonesInfo::getUnnamedSurfaces(surfaces.surfZones());
|
||||||
|
|
||||||
|
|
||||||
// Faces that do not move
|
// Faces that do not move
|
||||||
@ -1386,13 +1397,13 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. All faces on zoned surfaces
|
// 2. All faces on zoned surfaces
|
||||||
const wordList& faceZoneNames = surfaces.faceZoneNames();
|
const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones();
|
||||||
const faceZoneMesh& fZones = mesh.faceZones();
|
const faceZoneMesh& fZones = mesh.faceZones();
|
||||||
|
|
||||||
forAll(zonedSurfaces, i)
|
forAll(zonedSurfaces, i)
|
||||||
{
|
{
|
||||||
const label zoneSurfI = zonedSurfaces[i];
|
const label zoneSurfI = zonedSurfaces[i];
|
||||||
const faceZone& fZone = fZones[faceZoneNames[zoneSurfI]];
|
const faceZone& fZone = fZones[surfZones[zoneSurfI].faceZoneName()];
|
||||||
|
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
@ -1557,9 +1568,7 @@ void Foam::autoSnapDriver::doSnap
|
|||||||
{
|
{
|
||||||
const faceZoneMesh& fZones = mesh.faceZones();
|
const faceZoneMesh& fZones = mesh.faceZones();
|
||||||
const refinementSurfaces& surfaces = meshRefiner_.surfaces();
|
const refinementSurfaces& surfaces = meshRefiner_.surfaces();
|
||||||
const wordList& faceZoneNames = surfaces.faceZoneNames();
|
const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones();
|
||||||
const List<refinementSurfaces::faceZoneType>& faceType =
|
|
||||||
surfaces.faceType();
|
|
||||||
|
|
||||||
// Determine which
|
// Determine which
|
||||||
// - faces to remove from list of baffles (so not merge)
|
// - faces to remove from list of baffles (so not merge)
|
||||||
@ -1568,18 +1577,23 @@ void Foam::autoSnapDriver::doSnap
|
|||||||
label nFilterFaces = 0;
|
label nFilterFaces = 0;
|
||||||
PackedBoolList duplicatePoint(mesh.nPoints());
|
PackedBoolList duplicatePoint(mesh.nPoints());
|
||||||
label nDuplicatePoints = 0;
|
label nDuplicatePoints = 0;
|
||||||
forAll(faceZoneNames, surfI)
|
forAll(surfZones, surfI)
|
||||||
{
|
{
|
||||||
|
const word& faceZoneName = surfZones[surfI].faceZoneName();
|
||||||
|
|
||||||
|
const surfaceZonesInfo::faceZoneType& faceType =
|
||||||
|
surfZones[surfI].faceType();
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
faceType[surfI] == refinementSurfaces::BAFFLE
|
faceType == surfaceZonesInfo::BAFFLE
|
||||||
|| faceType[surfI] == refinementSurfaces::BOUNDARY
|
|| faceType == surfaceZonesInfo::BOUNDARY
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (faceZoneNames[surfI].size())
|
if (faceZoneName.size())
|
||||||
{
|
{
|
||||||
// Filter out all faces for this zone.
|
// Filter out all faces for this zone.
|
||||||
label zoneI = fZones.findZoneID(faceZoneNames[surfI]);
|
label zoneI = fZones.findZoneID(faceZoneName);
|
||||||
const faceZone& fZone = fZones[zoneI];
|
const faceZone& fZone = fZones[zoneI];
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
@ -1588,7 +1602,7 @@ void Foam::autoSnapDriver::doSnap
|
|||||||
nFilterFaces++;
|
nFilterFaces++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faceType[surfI] == refinementSurfaces::BOUNDARY)
|
if (faceType == surfaceZonesInfo::BOUNDARY)
|
||||||
{
|
{
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -337,8 +337,10 @@ void Foam::autoSnapDriver::calcNearestFace
|
|||||||
faceSurfaceGlobalRegion = -1;
|
faceSurfaceGlobalRegion = -1;
|
||||||
|
|
||||||
// Divide surfaces into zoned and unzoned
|
// Divide surfaces into zoned and unzoned
|
||||||
labelList zonedSurfaces = surfaces.getNamedSurfaces();
|
const labelList zonedSurfaces =
|
||||||
labelList unzonedSurfaces = surfaces.getUnnamedSurfaces();
|
surfaceZonesInfo::getNamedSurfaces(surfaces.surfZones());
|
||||||
|
const labelList unzonedSurfaces =
|
||||||
|
surfaceZonesInfo::getUnnamedSurfaces(surfaces.surfZones());
|
||||||
|
|
||||||
// Per pp face the current surface snapped to
|
// Per pp face the current surface snapped to
|
||||||
labelList snapSurf(pp.size(), -1);
|
labelList snapSurf(pp.size(), -1);
|
||||||
@ -349,20 +351,22 @@ void Foam::autoSnapDriver::calcNearestFace
|
|||||||
// Zoned faces only attract to corresponding surface
|
// Zoned faces only attract to corresponding surface
|
||||||
|
|
||||||
// Extract faces per zone
|
// Extract faces per zone
|
||||||
const wordList& faceZoneNames = surfaces.faceZoneNames();
|
const PtrList<surfaceZonesInfo>& surfZones = surfaces.surfZones();
|
||||||
|
|
||||||
forAll(zonedSurfaces, i)
|
forAll(zonedSurfaces, i)
|
||||||
{
|
{
|
||||||
label zoneSurfI = zonedSurfaces[i];
|
label zoneSurfI = zonedSurfaces[i];
|
||||||
|
|
||||||
|
const word& faceZoneName = surfZones[zoneSurfI].faceZoneName();
|
||||||
|
|
||||||
// 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(faceZoneNames[zoneSurfI]);
|
label zoneI = mesh.faceZones().findZoneID(faceZoneName);
|
||||||
if (zoneI == -1)
|
if (zoneI == -1)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoSnapDriver::calcNearestFace(..)"
|
"autoSnapDriver::calcNearestFace(..)"
|
||||||
) << "Problem. Cannot find zone " << faceZoneNames[zoneSurfI]
|
) << "Problem. Cannot find zone " << faceZoneName
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
const faceZone& fZone = mesh.faceZones()[zoneI];
|
const faceZone& fZone = mesh.faceZones()[zoneI];
|
||||||
|
|||||||
@ -1235,19 +1235,22 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
|
|||||||
// keep owner&neighbour of such a surface zone on the same
|
// keep owner&neighbour of such a surface zone on the same
|
||||||
// processor.
|
// processor.
|
||||||
|
|
||||||
const wordList& fzNames = surfaces().faceZoneNames();
|
const PtrList<surfaceZonesInfo>& surfZones =
|
||||||
|
surfaces().surfZones();
|
||||||
const faceZoneMesh& fZones = mesh_.faceZones();
|
const faceZoneMesh& fZones = mesh_.faceZones();
|
||||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||||
|
|
||||||
// Get faces whose owner and neighbour should stay together,
|
// Get faces whose owner and neighbour should stay together,
|
||||||
// i.e. they are not 'blocked'.
|
// i.e. they are not 'blocked'.
|
||||||
|
|
||||||
forAll(fzNames, surfI)
|
forAll(surfZones, surfI)
|
||||||
{
|
{
|
||||||
if (fzNames[surfI].size())
|
const word& fzName = surfZones[surfI].faceZoneName();
|
||||||
|
|
||||||
|
if (fzName.size())
|
||||||
{
|
{
|
||||||
// Get zone
|
// Get zone
|
||||||
const faceZone& fZone = fZones[fzNames[surfI]];
|
const faceZone& fZone = fZones[fzName];
|
||||||
|
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -287,7 +287,10 @@ void Foam::meshRefinement::getBafflePatches
|
|||||||
const pointField& cellCentres = mesh_.cellCentres();
|
const pointField& cellCentres = mesh_.cellCentres();
|
||||||
|
|
||||||
// Surfaces that need to be baffled
|
// Surfaces that need to be baffled
|
||||||
const labelList surfacesToBaffle(surfaces_.getUnnamedSurfaces());
|
const labelList surfacesToBaffle
|
||||||
|
(
|
||||||
|
surfaceZonesInfo::getUnnamedSurfaces(surfaces_.surfZones())
|
||||||
|
);
|
||||||
|
|
||||||
ownPatch.setSize(mesh_.nFaces());
|
ownPatch.setSize(mesh_.nFaces());
|
||||||
ownPatch = -1;
|
ownPatch = -1;
|
||||||
@ -416,15 +419,17 @@ Foam::Map<Foam::labelPair> Foam::meshRefinement::getZoneBafflePatches
|
|||||||
{
|
{
|
||||||
Map<labelPair> bafflePatch(mesh_.nFaces()/1000);
|
Map<labelPair> bafflePatch(mesh_.nFaces()/1000);
|
||||||
|
|
||||||
const wordList& faceZoneNames = surfaces_.faceZoneNames();
|
const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones();
|
||||||
const faceZoneMesh& fZones = mesh_.faceZones();
|
const faceZoneMesh& fZones = mesh_.faceZones();
|
||||||
|
|
||||||
forAll(faceZoneNames, surfI)
|
forAll(surfZones, surfI)
|
||||||
{
|
{
|
||||||
if (faceZoneNames[surfI].size())
|
const word& faceZoneName = surfZones[surfI].faceZoneName();
|
||||||
|
|
||||||
|
if (faceZoneName.size())
|
||||||
{
|
{
|
||||||
// Get zone
|
// Get zone
|
||||||
label zoneI = fZones.findZoneID(faceZoneNames[surfI]);
|
label zoneI = fZones.findZoneID(faceZoneName);
|
||||||
|
|
||||||
const faceZone& fZone = fZones[zoneI];
|
const faceZone& fZone = fZones[zoneI];
|
||||||
|
|
||||||
@ -703,7 +708,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
|
|||||||
List<labelPair>& baffles
|
List<labelPair>& baffles
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
labelList zonedSurfaces = surfaces_.getNamedSurfaces();
|
const labelList zonedSurfaces
|
||||||
|
(
|
||||||
|
surfaceZonesInfo::getNamedSurfaces(surfaces_.surfZones())
|
||||||
|
);
|
||||||
|
|
||||||
autoPtr<mapPolyMesh> map;
|
autoPtr<mapPolyMesh> map;
|
||||||
|
|
||||||
@ -1434,11 +1442,14 @@ void Foam::meshRefinement::findCellZoneInsideWalk
|
|||||||
// Force calculation of face decomposition (used in findCell)
|
// Force calculation of face decomposition (used in findCell)
|
||||||
(void)mesh_.tetBasePtIs();
|
(void)mesh_.tetBasePtIs();
|
||||||
|
|
||||||
|
const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones();
|
||||||
|
|
||||||
// For all locationSurface find the cell
|
// For all locationSurface find the cell
|
||||||
forAll(locationSurfaces, i)
|
forAll(locationSurfaces, i)
|
||||||
{
|
{
|
||||||
label surfI = locationSurfaces[i];
|
label surfI = locationSurfaces[i];
|
||||||
const point& insidePoint = surfaces_.zoneInsidePoints()[surfI];
|
|
||||||
|
const point& insidePoint = surfZones[surfI].zoneInsidePoint();
|
||||||
|
|
||||||
Info<< "For surface " << surfaces_.names()[surfI]
|
Info<< "For surface " << surfaces_.names()[surfI]
|
||||||
<< " finding inside point " << insidePoint
|
<< " finding inside point " << insidePoint
|
||||||
@ -2503,143 +2514,36 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
const bool allowFreeStandingZoneFaces
|
const bool allowFreeStandingZoneFaces
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const wordList& cellZoneNames = surfaces_.cellZoneNames();
|
const PtrList<surfaceZonesInfo>& surfZones = surfaces_.surfZones();
|
||||||
const wordList& faceZoneNames = surfaces_.faceZoneNames();
|
|
||||||
|
|
||||||
labelList namedSurfaces(surfaces_.getNamedSurfaces());
|
labelList namedSurfaces(surfaceZonesInfo::getNamedSurfaces(surfZones));
|
||||||
|
|
||||||
forAll(namedSurfaces, i)
|
forAll(namedSurfaces, i)
|
||||||
{
|
{
|
||||||
label surfI = namedSurfaces[i];
|
label surfI = namedSurfaces[i];
|
||||||
|
|
||||||
Info<< "Surface : " << surfaces_.names()[surfI] << nl
|
Info<< "Surface : " << surfaces_.names()[surfI] << nl
|
||||||
<< " faceZone : " << faceZoneNames[surfI] << nl
|
<< " faceZone : " << surfZones[surfI].faceZoneName() << nl
|
||||||
<< " cellZone : " << cellZoneNames[surfI] << endl;
|
<< " cellZone : " << surfZones[surfI].cellZoneName() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add zones to mesh
|
// Add zones to mesh
|
||||||
|
labelList surfaceToFaceZone =
|
||||||
|
surfaceZonesInfo::addFaceZonesToMesh
|
||||||
|
(
|
||||||
|
surfZones,
|
||||||
|
namedSurfaces,
|
||||||
|
mesh_
|
||||||
|
);
|
||||||
|
|
||||||
labelList surfaceToFaceZone(faceZoneNames.size(), -1);
|
labelList surfaceToCellZone =
|
||||||
{
|
surfaceZonesInfo::addCellZonesToMesh
|
||||||
faceZoneMesh& faceZones = mesh_.faceZones();
|
(
|
||||||
|
surfZones,
|
||||||
forAll(namedSurfaces, i)
|
namedSurfaces,
|
||||||
{
|
mesh_
|
||||||
label surfI = namedSurfaces[i];
|
);
|
||||||
|
|
||||||
label zoneI = faceZones.findZoneID(faceZoneNames[surfI]);
|
|
||||||
|
|
||||||
if (zoneI == -1)
|
|
||||||
{
|
|
||||||
zoneI = faceZones.size();
|
|
||||||
faceZones.setSize(zoneI+1);
|
|
||||||
faceZones.set
|
|
||||||
(
|
|
||||||
zoneI,
|
|
||||||
new faceZone
|
|
||||||
(
|
|
||||||
faceZoneNames[surfI], //name
|
|
||||||
labelList(0), //addressing
|
|
||||||
boolList(0), //flipmap
|
|
||||||
zoneI, //index
|
|
||||||
faceZones //faceZoneMesh
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Pout<< "Faces on " << surfaces_.names()[surfI]
|
|
||||||
<< " will go into faceZone " << zoneI << endl;
|
|
||||||
}
|
|
||||||
surfaceToFaceZone[surfI] = zoneI;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check they are synced
|
|
||||||
List<wordList> allFaceZones(Pstream::nProcs());
|
|
||||||
allFaceZones[Pstream::myProcNo()] = faceZones.names();
|
|
||||||
Pstream::gatherList(allFaceZones);
|
|
||||||
Pstream::scatterList(allFaceZones);
|
|
||||||
|
|
||||||
for (label procI = 1; procI < allFaceZones.size(); procI++)
|
|
||||||
{
|
|
||||||
if (allFaceZones[procI] != allFaceZones[0])
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"meshRefinement::zonify"
|
|
||||||
"(const label, const point&)"
|
|
||||||
) << "Zones not synchronised among processors." << nl
|
|
||||||
<< " Processor0 has faceZones:" << allFaceZones[0]
|
|
||||||
<< " , processor" << procI
|
|
||||||
<< " has faceZones:" << allFaceZones[procI]
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
labelList surfaceToCellZone(cellZoneNames.size(), -1);
|
|
||||||
{
|
|
||||||
cellZoneMesh& cellZones = mesh_.cellZones();
|
|
||||||
|
|
||||||
forAll(namedSurfaces, i)
|
|
||||||
{
|
|
||||||
label surfI = namedSurfaces[i];
|
|
||||||
|
|
||||||
if (cellZoneNames[surfI] != word::null)
|
|
||||||
{
|
|
||||||
label zoneI = cellZones.findZoneID(cellZoneNames[surfI]);
|
|
||||||
|
|
||||||
if (zoneI == -1)
|
|
||||||
{
|
|
||||||
zoneI = cellZones.size();
|
|
||||||
cellZones.setSize(zoneI+1);
|
|
||||||
cellZones.set
|
|
||||||
(
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
surfaceToCellZone[surfI] = zoneI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check they are synced
|
|
||||||
List<wordList> allCellZones(Pstream::nProcs());
|
|
||||||
allCellZones[Pstream::myProcNo()] = cellZones.names();
|
|
||||||
Pstream::gatherList(allCellZones);
|
|
||||||
Pstream::scatterList(allCellZones);
|
|
||||||
|
|
||||||
for (label procI = 1; procI < allCellZones.size(); procI++)
|
|
||||||
{
|
|
||||||
if (allCellZones[procI] != allCellZones[0])
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"meshRefinement::zonify"
|
|
||||||
"(const label, const point&)"
|
|
||||||
) << "Zones not synchronised among processors." << nl
|
|
||||||
<< " Processor0 has cellZones:" << allCellZones[0]
|
|
||||||
<< " , processor" << procI
|
|
||||||
<< " has cellZones:" << allCellZones[procI]
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const pointField& cellCentres = mesh_.cellCentres();
|
const pointField& cellCentres = mesh_.cellCentres();
|
||||||
@ -2663,7 +2567,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Statistics: number of faces per faceZone
|
// Statistics: number of faces per faceZone
|
||||||
labelList nSurfFaces(faceZoneNames.size(), 0);
|
labelList nSurfFaces(surfZones.size(), 0);
|
||||||
|
|
||||||
// Note: for all internal faces? internal + coupled?
|
// Note: for all internal faces? internal + coupled?
|
||||||
// Since zonify is run after baffling the surfaceIndex_ on baffles is
|
// Since zonify is run after baffling the surfaceIndex_ on baffles is
|
||||||
@ -2767,7 +2671,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// surfaceIndex migh have different surfaces on both sides if
|
// surfaceIndex might have different surfaces on both sides if
|
||||||
// there happen to be a (obviously thin) surface with different
|
// there happen to be a (obviously thin) surface with different
|
||||||
// regions between the cell centres. If one is on a named surface
|
// regions between the cell centres. If one is on a named surface
|
||||||
// and the other is not this might give problems so sync.
|
// and the other is not this might give problems so sync.
|
||||||
@ -2806,7 +2710,15 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
// Closed surfaces with cellZone specified.
|
// Closed surfaces with cellZone specified.
|
||||||
labelList closedNamedSurfaces(surfaces_.getClosedNamedSurfaces());
|
labelList closedNamedSurfaces
|
||||||
|
(
|
||||||
|
surfaceZonesInfo::getClosedNamedSurfaces
|
||||||
|
(
|
||||||
|
surfZones,
|
||||||
|
surfaces_.geometry(),
|
||||||
|
surfaces_.surfaces()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (closedNamedSurfaces.size())
|
if (closedNamedSurfaces.size())
|
||||||
{
|
{
|
||||||
@ -2830,7 +2742,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
|||||||
// Set using provided locations
|
// Set using provided locations
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
labelList locationSurfaces(surfaces_.getInsidePointNamedSurfaces());
|
labelList locationSurfaces
|
||||||
|
(
|
||||||
|
surfaceZonesInfo::getInsidePointNamedSurfaces(surfZones)
|
||||||
|
);
|
||||||
|
|
||||||
if (locationSurfaces.size())
|
if (locationSurfaces.size())
|
||||||
{
|
{
|
||||||
Info<< "Found " << locationSurfaces.size()
|
Info<< "Found " << locationSurfaces.size()
|
||||||
|
|||||||
@ -568,7 +568,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
|
|||||||
labelList hitSurface;
|
labelList hitSurface;
|
||||||
surfaces_.findNearest
|
surfaces_.findNearest
|
||||||
(
|
(
|
||||||
surfaces_.getUnnamedSurfaces(),
|
surfaceZonesInfo::getUnnamedSurfaces(surfaces_.surfZones()),
|
||||||
localPoints,
|
localPoints,
|
||||||
scalarField(localPoints.size(), sqr(GREAT)), // sqr of attraction
|
scalarField(localPoints.size(), sqr(GREAT)), // sqr of attraction
|
||||||
hitSurface,
|
hitSurface,
|
||||||
|
|||||||
@ -33,45 +33,6 @@ License
|
|||||||
#include "UPtrList.H"
|
#include "UPtrList.H"
|
||||||
#include "volumeType.H"
|
#include "volumeType.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
template<>
|
|
||||||
const char* Foam::NamedEnum
|
|
||||||
<
|
|
||||||
Foam::refinementSurfaces::areaSelectionAlgo,
|
|
||||||
4
|
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"inside",
|
|
||||||
"outside",
|
|
||||||
"insidePoint",
|
|
||||||
"none"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>
|
|
||||||
Foam::refinementSurfaces::areaSelectionAlgoNames;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
template<>
|
|
||||||
const char* Foam::NamedEnum
|
|
||||||
<
|
|
||||||
Foam::refinementSurfaces::faceZoneType,
|
|
||||||
3
|
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"internal",
|
|
||||||
"baffle",
|
|
||||||
"boundary"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const Foam::NamedEnum<Foam::refinementSurfaces::faceZoneType, 3>
|
|
||||||
Foam::refinementSurfaces::faceZoneTypeNames;
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::refinementSurfaces::refinementSurfaces
|
Foam::refinementSurfaces::refinementSurfaces
|
||||||
@ -84,19 +45,15 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
allGeometry_(allGeometry),
|
allGeometry_(allGeometry),
|
||||||
surfaces_(surfacesDict.size()),
|
surfaces_(surfacesDict.size()),
|
||||||
names_(surfacesDict.size()),
|
names_(surfacesDict.size()),
|
||||||
faceZoneNames_(surfacesDict.size()),
|
surfZones_(surfacesDict.size()),
|
||||||
cellZoneNames_(surfacesDict.size()),
|
|
||||||
zoneInside_(surfacesDict.size(), NONE),
|
|
||||||
zoneInsidePoints_(surfacesDict.size()),
|
|
||||||
faceType_(surfacesDict.size(), INTERNAL),
|
|
||||||
regionOffset_(surfacesDict.size())
|
regionOffset_(surfacesDict.size())
|
||||||
{
|
{
|
||||||
// Wilcard specification : loop over all surface, all regions
|
// Wildcard specification : loop over all surface, all regions
|
||||||
// and try to find a match.
|
// and try to find a match.
|
||||||
|
|
||||||
// Count number of surfaces.
|
// Count number of surfaces.
|
||||||
label surfI = 0;
|
label surfI = 0;
|
||||||
forAll(allGeometry.names(), geomI)
|
forAll(allGeometry_.names(), geomI)
|
||||||
{
|
{
|
||||||
const word& geomName = allGeometry_.names()[geomI];
|
const word& geomName = allGeometry_.names()[geomI];
|
||||||
|
|
||||||
@ -109,10 +66,7 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
// Size lists
|
// Size lists
|
||||||
surfaces_.setSize(surfI);
|
surfaces_.setSize(surfI);
|
||||||
names_.setSize(surfI);
|
names_.setSize(surfI);
|
||||||
faceZoneNames_.setSize(surfI);
|
surfZones_.setSize(surfI);
|
||||||
cellZoneNames_.setSize(surfI);
|
|
||||||
zoneInside_.setSize(surfI, NONE);
|
|
||||||
faceType_.setSize(surfI, INTERNAL),
|
|
||||||
regionOffset_.setSize(surfI);
|
regionOffset_.setSize(surfI);
|
||||||
|
|
||||||
labelList globalMinLevel(surfI, 0);
|
labelList globalMinLevel(surfI, 0);
|
||||||
@ -130,7 +84,7 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
HashSet<word> unmatchedKeys(surfacesDict.toc());
|
HashSet<word> unmatchedKeys(surfacesDict.toc());
|
||||||
|
|
||||||
surfI = 0;
|
surfI = 0;
|
||||||
forAll(allGeometry.names(), geomI)
|
forAll(allGeometry_.names(), geomI)
|
||||||
{
|
{
|
||||||
const word& geomName = allGeometry_.names()[geomI];
|
const word& geomName = allGeometry_.names()[geomI];
|
||||||
|
|
||||||
@ -173,80 +127,10 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
|
||||||
// Global zone names per surface
|
// Surface zones
|
||||||
if (dict.readIfPresent("faceZone", faceZoneNames_[surfI]))
|
surfZones_.set(surfI, new surfaceZonesInfo(surface, dict));
|
||||||
{
|
|
||||||
// Read optional entry to determine inside of faceZone
|
|
||||||
|
|
||||||
word method;
|
|
||||||
bool hasSide = dict.readIfPresent("cellZoneInside", method);
|
|
||||||
if (hasSide)
|
|
||||||
{
|
|
||||||
zoneInside_[surfI] = areaSelectionAlgoNames[method];
|
|
||||||
if (zoneInside_[surfI] == INSIDEPOINT)
|
|
||||||
{
|
|
||||||
dict.lookup("insidePoint") >> zoneInsidePoints_[surfI];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Check old syntax
|
|
||||||
bool inside;
|
|
||||||
if (dict.readIfPresent("zoneInside", inside))
|
|
||||||
{
|
|
||||||
hasSide = true;
|
|
||||||
zoneInside_[surfI] = (inside ? INSIDE : OUTSIDE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read optional cellZone name
|
|
||||||
|
|
||||||
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(
|
|
||||||
zoneInside_[surfI] == INSIDE
|
|
||||||
|| zoneInside_[surfI] == OUTSIDE
|
|
||||||
)
|
|
||||||
&& !allGeometry_[surfaces_[surfI]].hasVolumeType()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IOWarningIn
|
|
||||||
(
|
|
||||||
"refinementSurfaces::refinementSurfaces(..)",
|
|
||||||
dict
|
|
||||||
) << "Illegal entry zoneInside "
|
|
||||||
<< areaSelectionAlgoNames[zoneInside_[surfI]]
|
|
||||||
<< " for faceZone "
|
|
||||||
<< faceZoneNames_[surfI]
|
|
||||||
<< " since surface " << names_[surfI]
|
|
||||||
<< " is not closed." << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (hasSide)
|
|
||||||
{
|
|
||||||
IOWarningIn
|
|
||||||
(
|
|
||||||
"refinementSurfaces::refinementSurfaces(..)",
|
|
||||||
dict
|
|
||||||
) << "Unused entry zoneInside for faceZone "
|
|
||||||
<< faceZoneNames_[surfI]
|
|
||||||
<< " since no cellZone specified."
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// How to handle faces on faceZone
|
|
||||||
word faceTypeMethod;
|
|
||||||
if (dict.readIfPresent("faceType", faceTypeMethod))
|
|
||||||
{
|
|
||||||
faceType_[surfI] = faceZoneTypeNames[faceTypeMethod];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Global perpendicular angle
|
// Global perpendicular angle
|
||||||
if (dict.found("patchInfo"))
|
if (dict.found("patchInfo"))
|
||||||
@ -262,8 +146,7 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
if (dict.found("regions"))
|
if (dict.found("regions"))
|
||||||
{
|
{
|
||||||
const dictionary& regionsDict = dict.subDict("regions");
|
const dictionary& regionsDict = dict.subDict("regions");
|
||||||
const wordList& regionNames =
|
const wordList& regionNames = surface.regions();
|
||||||
allGeometry_[surfaces_[surfI]].regions();
|
|
||||||
|
|
||||||
forAll(regionNames, regionI)
|
forAll(regionNames, regionI)
|
||||||
{
|
{
|
||||||
@ -307,8 +190,6 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (regionDict.found("perpendicularAngle"))
|
if (regionDict.found("perpendicularAngle"))
|
||||||
{
|
{
|
||||||
regionAngle[surfI].insert
|
regionAngle[surfI].insert
|
||||||
@ -429,11 +310,7 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
const searchableSurfaces& allGeometry,
|
const searchableSurfaces& allGeometry,
|
||||||
const labelList& surfaces,
|
const labelList& surfaces,
|
||||||
const wordList& names,
|
const wordList& names,
|
||||||
const wordList& faceZoneNames,
|
const PtrList<surfaceZonesInfo>& surfZones,
|
||||||
const wordList& cellZoneNames,
|
|
||||||
const List<areaSelectionAlgo>& zoneInside,
|
|
||||||
const pointField& zoneInsidePoints,
|
|
||||||
const List<faceZoneType>& faceType,
|
|
||||||
const labelList& regionOffset,
|
const labelList& regionOffset,
|
||||||
const labelList& minLevel,
|
const labelList& minLevel,
|
||||||
const labelList& maxLevel,
|
const labelList& maxLevel,
|
||||||
@ -445,11 +322,7 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
allGeometry_(allGeometry),
|
allGeometry_(allGeometry),
|
||||||
surfaces_(surfaces),
|
surfaces_(surfaces),
|
||||||
names_(names),
|
names_(names),
|
||||||
faceZoneNames_(faceZoneNames),
|
surfZones_(surfZones),
|
||||||
cellZoneNames_(cellZoneNames),
|
|
||||||
zoneInside_(zoneInside),
|
|
||||||
zoneInsidePoints_(zoneInsidePoints),
|
|
||||||
faceType_(faceType),
|
|
||||||
regionOffset_(regionOffset),
|
regionOffset_(regionOffset),
|
||||||
minLevel_(minLevel),
|
minLevel_(minLevel),
|
||||||
maxLevel_(maxLevel),
|
maxLevel_(maxLevel),
|
||||||
@ -469,90 +342,6 @@ Foam::refinementSurfaces::refinementSurfaces
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Get indices of unnamed surfaces (surfaces without faceZoneName)
|
|
||||||
Foam::labelList Foam::refinementSurfaces::getUnnamedSurfaces() const
|
|
||||||
{
|
|
||||||
labelList anonymousSurfaces(faceZoneNames_.size());
|
|
||||||
|
|
||||||
label i = 0;
|
|
||||||
forAll(faceZoneNames_, surfI)
|
|
||||||
{
|
|
||||||
if (faceZoneNames_[surfI].empty())
|
|
||||||
{
|
|
||||||
anonymousSurfaces[i++] = surfI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
anonymousSurfaces.setSize(i);
|
|
||||||
|
|
||||||
return anonymousSurfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Get indices of named surfaces (surfaces with faceZoneName)
|
|
||||||
Foam::labelList Foam::refinementSurfaces::getNamedSurfaces() const
|
|
||||||
{
|
|
||||||
labelList namedSurfaces(faceZoneNames_.size());
|
|
||||||
|
|
||||||
label namedI = 0;
|
|
||||||
forAll(faceZoneNames_, surfI)
|
|
||||||
{
|
|
||||||
if (faceZoneNames_[surfI].size())
|
|
||||||
{
|
|
||||||
namedSurfaces[namedI++] = surfI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
namedSurfaces.setSize(namedI);
|
|
||||||
|
|
||||||
return namedSurfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Get indices of closed named surfaces
|
|
||||||
Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const
|
|
||||||
{
|
|
||||||
labelList closed(cellZoneNames_.size());
|
|
||||||
|
|
||||||
label closedI = 0;
|
|
||||||
forAll(cellZoneNames_, surfI)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
cellZoneNames_[surfI].size()
|
|
||||||
&& (
|
|
||||||
zoneInside_[surfI] == INSIDE
|
|
||||||
|| zoneInside_[surfI] == OUTSIDE
|
|
||||||
)
|
|
||||||
&& allGeometry_[surfaces_[surfI]].hasVolumeType()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
closed[closedI++] = surfI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closed.setSize(closedI);
|
|
||||||
|
|
||||||
return closed;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Get indices of named surfaces with a
|
|
||||||
Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
|
|
||||||
{
|
|
||||||
labelList closed(cellZoneNames_.size());
|
|
||||||
|
|
||||||
label closedI = 0;
|
|
||||||
forAll(cellZoneNames_, surfI)
|
|
||||||
{
|
|
||||||
if (cellZoneNames_[surfI].size() && zoneInside_[surfI] == INSIDEPOINT)
|
|
||||||
{
|
|
||||||
closed[closedI++] = surfI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closed.setSize(closedI);
|
|
||||||
|
|
||||||
return closed;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// // 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)
|
||||||
// {
|
// {
|
||||||
@ -843,7 +632,9 @@ void Foam::refinementSurfaces::findAllHigherIntersections
|
|||||||
|
|
||||||
forAll(surfaces_, surfI)
|
forAll(surfaces_, surfI)
|
||||||
{
|
{
|
||||||
allGeometry_[surfaces_[surfI]].findLineAll(start, end, hitInfo);
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
|
||||||
|
surface.findLineAll(start, end, hitInfo);
|
||||||
|
|
||||||
// Repack hits for surface into flat list
|
// Repack hits for surface into flat list
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -873,8 +664,8 @@ void Foam::refinementSurfaces::findAllHigherIntersections
|
|||||||
|
|
||||||
labelList surfRegion(n);
|
labelList surfRegion(n);
|
||||||
vectorField surfNormal(n);
|
vectorField surfNormal(n);
|
||||||
allGeometry_[surfaces_[surfI]].getRegion(surfInfo, surfRegion);
|
surface.getRegion(surfInfo, surfRegion);
|
||||||
allGeometry_[surfaces_[surfI]].getNormal(surfInfo, surfNormal);
|
surface.getNormal(surfInfo, surfNormal);
|
||||||
|
|
||||||
surfInfo.clear();
|
surfInfo.clear();
|
||||||
|
|
||||||
@ -929,9 +720,11 @@ void Foam::refinementSurfaces::findAllHigherIntersections
|
|||||||
labelList pRegions;
|
labelList pRegions;
|
||||||
vectorField pNormals;
|
vectorField pNormals;
|
||||||
|
|
||||||
forAll(surfaces_, surfI)
|
forAll(surfaces(), surfI)
|
||||||
{
|
{
|
||||||
allGeometry_[surfaces_[surfI]].findLineAll(start, end, hitInfo);
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
|
||||||
|
surface.findLineAll(start, end, hitInfo);
|
||||||
|
|
||||||
// Repack hits for surface into flat list
|
// Repack hits for surface into flat list
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -961,8 +754,8 @@ void Foam::refinementSurfaces::findAllHigherIntersections
|
|||||||
|
|
||||||
labelList surfRegion(n);
|
labelList surfRegion(n);
|
||||||
vectorField surfNormal(n);
|
vectorField surfNormal(n);
|
||||||
allGeometry_[surfaces_[surfI]].getRegion(surfInfo, surfRegion);
|
surface.getRegion(surfInfo, surfRegion);
|
||||||
allGeometry_[surfaces_[surfI]].getNormal(surfInfo, surfNormal);
|
surface.getNormal(surfInfo, surfNormal);
|
||||||
|
|
||||||
// Extract back into pointwise
|
// Extract back into pointwise
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -1023,14 +816,16 @@ void Foam::refinementSurfaces::findNearestIntersection
|
|||||||
{
|
{
|
||||||
label surfI = surfacesToTest[testI];
|
label surfI = surfacesToTest[testI];
|
||||||
|
|
||||||
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
|
||||||
// See if any intersection between start and current nearest
|
// See if any intersection between start and current nearest
|
||||||
allGeometry_[surfaces_[surfI]].findLine
|
surface.findLine
|
||||||
(
|
(
|
||||||
start,
|
start,
|
||||||
nearest,
|
nearest,
|
||||||
nearestInfo
|
nearestInfo
|
||||||
);
|
);
|
||||||
allGeometry_[surfaces_[surfI]].getRegion
|
surface.getRegion
|
||||||
(
|
(
|
||||||
nearestInfo,
|
nearestInfo,
|
||||||
region
|
region
|
||||||
@ -1076,14 +871,16 @@ void Foam::refinementSurfaces::findNearestIntersection
|
|||||||
{
|
{
|
||||||
label surfI = surfacesToTest[testI];
|
label surfI = surfacesToTest[testI];
|
||||||
|
|
||||||
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
|
||||||
// See if any intersection between end and current nearest
|
// See if any intersection between end and current nearest
|
||||||
allGeometry_[surfaces_[surfI]].findLine
|
surface.findLine
|
||||||
(
|
(
|
||||||
end,
|
end,
|
||||||
nearest,
|
nearest,
|
||||||
nearestInfo
|
nearestInfo
|
||||||
);
|
);
|
||||||
allGeometry_[surfaces_[surfI]].getRegion
|
surface.getRegion
|
||||||
(
|
(
|
||||||
nearestInfo,
|
nearestInfo,
|
||||||
region
|
region
|
||||||
@ -1489,20 +1286,29 @@ void Foam::refinementSurfaces::findInside
|
|||||||
{
|
{
|
||||||
label surfI = testSurfaces[i];
|
label surfI = testSurfaces[i];
|
||||||
|
|
||||||
if (zoneInside_[surfI] != INSIDE && zoneInside_[surfI] != OUTSIDE)
|
const searchableSurface& surface = allGeometry_[surfaces_[surfI]];
|
||||||
|
|
||||||
|
const surfaceZonesInfo::areaSelectionAlgo selectionMethod =
|
||||||
|
surfZones_[surfI].zoneInside();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
selectionMethod != surfaceZonesInfo::INSIDE
|
||||||
|
&& selectionMethod != surfaceZonesInfo::OUTSIDE
|
||||||
|
)
|
||||||
{
|
{
|
||||||
FatalErrorIn("refinementSurfaces::findInside(..)")
|
FatalErrorIn("refinementSurfaces::findInside(..)")
|
||||||
<< "Trying to use surface "
|
<< "Trying to use surface "
|
||||||
<< allGeometry_[surfaces_[surfI]].name()
|
<< surface.name()
|
||||||
<< " which has non-geometric inside selection method "
|
<< " which has non-geometric inside selection method "
|
||||||
<< areaSelectionAlgoNames[zoneInside_[surfI]]
|
<< surfaceZonesInfo::areaSelectionAlgoNames[selectionMethod]
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allGeometry_[surfaces_[surfI]].hasVolumeType())
|
if (surface.hasVolumeType())
|
||||||
{
|
{
|
||||||
List<volumeType> volType;
|
List<volumeType> volType;
|
||||||
allGeometry_[surfaces_[surfI]].getVolumeType(pt, volType);
|
surface.getVolumeType(pt, volType);
|
||||||
|
|
||||||
forAll(volType, pointI)
|
forAll(volType, pointI)
|
||||||
{
|
{
|
||||||
@ -1512,11 +1318,11 @@ void Foam::refinementSurfaces::findInside
|
|||||||
(
|
(
|
||||||
(
|
(
|
||||||
volType[pointI] == volumeType::INSIDE
|
volType[pointI] == volumeType::INSIDE
|
||||||
&& zoneInside_[surfI] == INSIDE
|
&& selectionMethod == surfaceZonesInfo::INSIDE
|
||||||
)
|
)
|
||||||
|| (
|
|| (
|
||||||
volType[pointI] == volumeType::OUTSIDE
|
volType[pointI] == volumeType::OUTSIDE
|
||||||
&& zoneInside_[surfI] == OUTSIDE
|
&& selectionMethod == surfaceZonesInfo::OUTSIDE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,6 +41,7 @@ SourceFiles
|
|||||||
#include "triSurfaceFields.H"
|
#include "triSurfaceFields.H"
|
||||||
#include "vectorList.H"
|
#include "vectorList.H"
|
||||||
#include "pointIndexHit.H"
|
#include "pointIndexHit.H"
|
||||||
|
#include "surfaceZonesInfo.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,31 +60,6 @@ typedef List<point> pointList;
|
|||||||
|
|
||||||
class refinementSurfaces
|
class refinementSurfaces
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
//- Types of selection of area
|
|
||||||
enum areaSelectionAlgo
|
|
||||||
{
|
|
||||||
INSIDE,
|
|
||||||
OUTSIDE,
|
|
||||||
INSIDEPOINT,
|
|
||||||
NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
static const NamedEnum<areaSelectionAlgo, 4> areaSelectionAlgoNames;
|
|
||||||
|
|
||||||
//- What to do with faceZone faces
|
|
||||||
enum faceZoneType
|
|
||||||
{
|
|
||||||
INTERNAL,
|
|
||||||
BAFFLE,
|
|
||||||
BOUNDARY
|
|
||||||
};
|
|
||||||
|
|
||||||
static const NamedEnum<faceZoneType, 3> faceZoneTypeNames;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to all geometry.
|
//- Reference to all geometry.
|
||||||
@ -95,23 +71,8 @@ private:
|
|||||||
//- Surface name (word)
|
//- Surface name (word)
|
||||||
wordList names_;
|
wordList names_;
|
||||||
|
|
||||||
//- Per 'interface' surface : name of faceZone to put faces into
|
//- List of surface zone (face and cell zone) information
|
||||||
wordList faceZoneNames_;
|
PtrList<surfaceZonesInfo> surfZones_;
|
||||||
|
|
||||||
//- Per 'interface' surface : name of cellZone to put cells into
|
|
||||||
wordList cellZoneNames_;
|
|
||||||
|
|
||||||
//- Per 'interface' surface : (only used if surface is closed)
|
|
||||||
// How to select zone cells : surface inside or outside or given
|
|
||||||
// inside location.
|
|
||||||
List<areaSelectionAlgo> zoneInside_;
|
|
||||||
|
|
||||||
//- If zoneInside=location gives the corresponding inside point
|
|
||||||
pointField zoneInsidePoints_;
|
|
||||||
|
|
||||||
//- Per 'interface' surface :
|
|
||||||
// What to do with outside
|
|
||||||
List<faceZoneType> faceType_;
|
|
||||||
|
|
||||||
//- From local region number to global region number
|
//- From local region number to global region number
|
||||||
labelList regionOffset_;
|
labelList regionOffset_;
|
||||||
@ -159,11 +120,7 @@ public:
|
|||||||
const searchableSurfaces& allGeometry,
|
const searchableSurfaces& allGeometry,
|
||||||
const labelList& surfaces,
|
const labelList& surfaces,
|
||||||
const wordList& names,
|
const wordList& names,
|
||||||
const wordList& faceZoneNames,
|
const PtrList<surfaceZonesInfo>& surfZones,
|
||||||
const wordList& cellZoneNames,
|
|
||||||
const List<areaSelectionAlgo>& zoneInside,
|
|
||||||
const pointField& zoneInsidePoints,
|
|
||||||
const List<faceZoneType>& faceType,
|
|
||||||
const labelList& regionOffset,
|
const labelList& regionOffset,
|
||||||
const labelList& minLevel,
|
const labelList& minLevel,
|
||||||
const labelList& maxLevel,
|
const labelList& maxLevel,
|
||||||
@ -193,44 +150,9 @@ public:
|
|||||||
return names_;
|
return names_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Per 'interface' surface : empty or name of faceZone to put
|
const PtrList<surfaceZonesInfo>& surfZones() const
|
||||||
// faces into
|
|
||||||
const wordList& faceZoneNames() const
|
|
||||||
{
|
{
|
||||||
return faceZoneNames_;
|
return surfZones_;
|
||||||
}
|
|
||||||
|
|
||||||
//- Per 'interface' surface : empty or name of cellZone to put
|
|
||||||
// cells into
|
|
||||||
const wordList& cellZoneNames() const
|
|
||||||
{
|
|
||||||
return cellZoneNames_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Get indices of unnamed surfaces (surfaces without faceZoneName)
|
|
||||||
labelList getUnnamedSurfaces() const;
|
|
||||||
|
|
||||||
//- Get indices of named surfaces (surfaces with faceZoneName)
|
|
||||||
labelList getNamedSurfaces() const;
|
|
||||||
|
|
||||||
//- Get indices of surfaces with a cellZone that are closed and
|
|
||||||
// have 'inside' or 'outside' selection.
|
|
||||||
labelList getClosedNamedSurfaces() const;
|
|
||||||
|
|
||||||
//- Get indices of surfaces with a cellZone that have 'insidePoint'
|
|
||||||
// section.
|
|
||||||
labelList getInsidePointNamedSurfaces() const;
|
|
||||||
|
|
||||||
//- Get specified inside locations for surfaces with a cellZone
|
|
||||||
const pointField& zoneInsidePoints() const
|
|
||||||
{
|
|
||||||
return zoneInsidePoints_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- How to handle face of surfaces with a faceZone
|
|
||||||
const List<faceZoneType>& faceType() const
|
|
||||||
{
|
|
||||||
return faceType_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- From local region number to global region number
|
//- From local region number to global region number
|
||||||
|
|||||||
@ -0,0 +1,421 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "surfaceZonesInfo.H"
|
||||||
|
#include "searchableSurface.H"
|
||||||
|
#include "searchableSurfaces.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::surfaceZonesInfo::areaSelectionAlgo,
|
||||||
|
4
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"inside",
|
||||||
|
"outside",
|
||||||
|
"insidePoint",
|
||||||
|
"none"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const Foam::NamedEnum<Foam::surfaceZonesInfo::areaSelectionAlgo, 4>
|
||||||
|
Foam::surfaceZonesInfo::areaSelectionAlgoNames;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::surfaceZonesInfo::faceZoneType,
|
||||||
|
3
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"internal",
|
||||||
|
"baffle",
|
||||||
|
"boundary"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const Foam::NamedEnum<Foam::surfaceZonesInfo::faceZoneType, 3>
|
||||||
|
Foam::surfaceZonesInfo::faceZoneTypeNames;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::surfaceZonesInfo::surfaceZonesInfo
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& surfacesDict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faceZoneName_(),
|
||||||
|
cellZoneName_(),
|
||||||
|
zoneInside_(NONE),
|
||||||
|
zoneInsidePoint_(point::min),
|
||||||
|
faceType_(INTERNAL)
|
||||||
|
{
|
||||||
|
// Global zone names per surface
|
||||||
|
if (surfacesDict.readIfPresent("faceZone", faceZoneName_))
|
||||||
|
{
|
||||||
|
// Read optional entry to determine inside of faceZone
|
||||||
|
|
||||||
|
word method;
|
||||||
|
bool hasSide = surfacesDict.readIfPresent("cellZoneInside", method);
|
||||||
|
if (hasSide)
|
||||||
|
{
|
||||||
|
zoneInside_ = areaSelectionAlgoNames[method];
|
||||||
|
if (zoneInside_ == INSIDEPOINT)
|
||||||
|
{
|
||||||
|
surfacesDict.lookup("insidePoint") >> zoneInsidePoint_;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check old syntax
|
||||||
|
bool inside;
|
||||||
|
if (surfacesDict.readIfPresent("zoneInside", inside))
|
||||||
|
{
|
||||||
|
hasSide = true;
|
||||||
|
zoneInside_ = (inside ? INSIDE : OUTSIDE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read optional cellZone name
|
||||||
|
|
||||||
|
if (surfacesDict.readIfPresent("cellZone", cellZoneName_))
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(
|
||||||
|
zoneInside_ == INSIDE
|
||||||
|
|| zoneInside_ == OUTSIDE
|
||||||
|
)
|
||||||
|
&& !surface.hasVolumeType()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOWarningIn
|
||||||
|
(
|
||||||
|
"refinementSurfaces::refinementSurfaces(..)",
|
||||||
|
surfacesDict
|
||||||
|
) << "Illegal entry zoneInside "
|
||||||
|
<< areaSelectionAlgoNames[zoneInside_]
|
||||||
|
<< " for faceZone "
|
||||||
|
<< faceZoneName_
|
||||||
|
<< " since surface is not closed." << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (hasSide)
|
||||||
|
{
|
||||||
|
IOWarningIn
|
||||||
|
(
|
||||||
|
"refinementSurfaces::refinementSurfaces(..)",
|
||||||
|
surfacesDict
|
||||||
|
) << "Unused entry zoneInside for faceZone "
|
||||||
|
<< faceZoneName_
|
||||||
|
<< " since no cellZone specified."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// How to handle faces on faceZone
|
||||||
|
word faceTypeMethod;
|
||||||
|
if (surfacesDict.readIfPresent("faceType", faceTypeMethod))
|
||||||
|
{
|
||||||
|
faceType_ = faceZoneTypeNames[faceTypeMethod];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::surfaceZonesInfo::surfaceZonesInfo
|
||||||
|
(
|
||||||
|
const word& faceZoneName,
|
||||||
|
const word& cellZoneName,
|
||||||
|
const areaSelectionAlgo& zoneInside,
|
||||||
|
const point& zoneInsidePoint,
|
||||||
|
const faceZoneType& faceType
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faceZoneName_(faceZoneName),
|
||||||
|
cellZoneName_(cellZoneName),
|
||||||
|
zoneInside_(zoneInside),
|
||||||
|
zoneInsidePoint_(zoneInsidePoint),
|
||||||
|
faceType_(faceType)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::surfaceZonesInfo::surfaceZonesInfo(const surfaceZonesInfo& surfZone)
|
||||||
|
:
|
||||||
|
faceZoneName_(surfZone.faceZoneName()),
|
||||||
|
cellZoneName_(surfZone.cellZoneName()),
|
||||||
|
zoneInside_(surfZone.zoneInside()),
|
||||||
|
zoneInsidePoint_(surfZone.zoneInsidePoint()),
|
||||||
|
faceType_(surfZone.faceType())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Get indices of unnamed surfaces (surfaces without faceZoneName)
|
||||||
|
Foam::labelList Foam::surfaceZonesInfo::getUnnamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
|
)
|
||||||
|
{
|
||||||
|
labelList anonymousSurfaces(surfList.size());
|
||||||
|
|
||||||
|
label i = 0;
|
||||||
|
forAll(surfList, surfI)
|
||||||
|
{
|
||||||
|
if (surfList[surfI].faceZoneName().empty())
|
||||||
|
{
|
||||||
|
anonymousSurfaces[i++] = surfI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
anonymousSurfaces.setSize(i);
|
||||||
|
|
||||||
|
return anonymousSurfaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get indices of named surfaces (surfaces with faceZoneName)
|
||||||
|
Foam::labelList Foam::surfaceZonesInfo::getNamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
|
)
|
||||||
|
{
|
||||||
|
labelList namedSurfaces(surfList.size());
|
||||||
|
|
||||||
|
label namedI = 0;
|
||||||
|
forAll(surfList, surfI)
|
||||||
|
{
|
||||||
|
if (surfList[surfI].faceZoneName().size())
|
||||||
|
{
|
||||||
|
namedSurfaces[namedI++] = surfI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
namedSurfaces.setSize(namedI);
|
||||||
|
|
||||||
|
return namedSurfaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get indices of closed named surfaces
|
||||||
|
Foam::labelList Foam::surfaceZonesInfo::getClosedNamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList,
|
||||||
|
const searchableSurfaces& allGeometry,
|
||||||
|
const labelList& surfaces
|
||||||
|
)
|
||||||
|
{
|
||||||
|
labelList closed(surfList.size());
|
||||||
|
|
||||||
|
label closedI = 0;
|
||||||
|
forAll(surfList, surfI)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
surfList[surfI].cellZoneName().size()
|
||||||
|
&& (
|
||||||
|
surfList[surfI].zoneInside() == surfaceZonesInfo::INSIDE
|
||||||
|
|| surfList[surfI].zoneInside() == surfaceZonesInfo::OUTSIDE
|
||||||
|
)
|
||||||
|
&& allGeometry[surfaces[surfI]].hasVolumeType()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
closed[closedI++] = surfI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closed.setSize(closedI);
|
||||||
|
|
||||||
|
return closed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get indices of named surfaces with a
|
||||||
|
Foam::labelList Foam::surfaceZonesInfo::getInsidePointNamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
|
)
|
||||||
|
{
|
||||||
|
labelList closed(surfList.size());
|
||||||
|
|
||||||
|
label closedI = 0;
|
||||||
|
forAll(surfList, surfI)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
surfList[surfI].cellZoneName().size()
|
||||||
|
&& surfList[surfI].zoneInside() == surfaceZonesInfo::INSIDEPOINT
|
||||||
|
)
|
||||||
|
{
|
||||||
|
closed[closedI++] = surfI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closed.setSize(closedI);
|
||||||
|
|
||||||
|
return closed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::surfaceZonesInfo::addCellZonesToMesh
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList,
|
||||||
|
const labelList& namedSurfaces,
|
||||||
|
polyMesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
labelList surfaceToCellZone(surfList.size(), -1);
|
||||||
|
|
||||||
|
cellZoneMesh& cellZones = mesh.cellZones();
|
||||||
|
|
||||||
|
forAll(namedSurfaces, i)
|
||||||
|
{
|
||||||
|
label surfI = namedSurfaces[i];
|
||||||
|
|
||||||
|
const word& cellZoneName = surfList[surfI].cellZoneName();
|
||||||
|
|
||||||
|
if (cellZoneName != word::null)
|
||||||
|
{
|
||||||
|
label zoneI = cellZones.findZoneID(cellZoneName);
|
||||||
|
|
||||||
|
if (zoneI == -1)
|
||||||
|
{
|
||||||
|
zoneI = cellZones.size();
|
||||||
|
cellZones.setSize(zoneI+1);
|
||||||
|
cellZones.set
|
||||||
|
(
|
||||||
|
zoneI,
|
||||||
|
new cellZone
|
||||||
|
(
|
||||||
|
cellZoneName, //name
|
||||||
|
labelList(0), //addressing
|
||||||
|
zoneI, //index
|
||||||
|
cellZones //cellZoneMesh
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
surfaceToCellZone[surfI] = zoneI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check they are synced
|
||||||
|
List<wordList> allCellZones(Pstream::nProcs());
|
||||||
|
allCellZones[Pstream::myProcNo()] = cellZones.names();
|
||||||
|
Pstream::gatherList(allCellZones);
|
||||||
|
Pstream::scatterList(allCellZones);
|
||||||
|
|
||||||
|
for (label procI = 1; procI < allCellZones.size(); procI++)
|
||||||
|
{
|
||||||
|
if (allCellZones[procI] != allCellZones[0])
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"meshRefinement::zonify"
|
||||||
|
"(const label, const point&)"
|
||||||
|
) << "Zones not synchronised among processors." << nl
|
||||||
|
<< " Processor0 has cellZones:" << allCellZones[0]
|
||||||
|
<< " , processor" << procI
|
||||||
|
<< " has cellZones:" << allCellZones[procI]
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return surfaceToCellZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::surfaceZonesInfo::addFaceZonesToMesh
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList,
|
||||||
|
const labelList& namedSurfaces,
|
||||||
|
polyMesh& mesh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
labelList surfaceToFaceZone(surfList.size(), -1);
|
||||||
|
|
||||||
|
faceZoneMesh& faceZones = mesh.faceZones();
|
||||||
|
|
||||||
|
forAll(namedSurfaces, i)
|
||||||
|
{
|
||||||
|
label surfI = namedSurfaces[i];
|
||||||
|
|
||||||
|
const word& faceZoneName = surfList[surfI].faceZoneName();
|
||||||
|
|
||||||
|
label zoneI = faceZones.findZoneID(faceZoneName);
|
||||||
|
|
||||||
|
if (zoneI == -1)
|
||||||
|
{
|
||||||
|
zoneI = faceZones.size();
|
||||||
|
faceZones.setSize(zoneI+1);
|
||||||
|
faceZones.set
|
||||||
|
(
|
||||||
|
zoneI,
|
||||||
|
new faceZone
|
||||||
|
(
|
||||||
|
faceZoneName, //name
|
||||||
|
labelList(0), //addressing
|
||||||
|
boolList(0), //flipmap
|
||||||
|
zoneI, //index
|
||||||
|
faceZones //faceZoneMesh
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
surfaceToFaceZone[surfI] = zoneI;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check they are synced
|
||||||
|
List<wordList> allFaceZones(Pstream::nProcs());
|
||||||
|
allFaceZones[Pstream::myProcNo()] = faceZones.names();
|
||||||
|
Pstream::gatherList(allFaceZones);
|
||||||
|
Pstream::scatterList(allFaceZones);
|
||||||
|
|
||||||
|
for (label procI = 1; procI < allFaceZones.size(); procI++)
|
||||||
|
{
|
||||||
|
if (allFaceZones[procI] != allFaceZones[0])
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"meshRefinement::zonify"
|
||||||
|
"(const label, const point&)"
|
||||||
|
) << "Zones not synchronised among processors." << nl
|
||||||
|
<< " Processor0 has faceZones:" << allFaceZones[0]
|
||||||
|
<< " , processor" << procI
|
||||||
|
<< " has faceZones:" << allFaceZones[procI]
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return surfaceToFaceZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,233 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::surfaceZonesInfo
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
surfaceZonesInfo.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef surfaceZonesInfo_H
|
||||||
|
#define surfaceZonesInfo_H
|
||||||
|
|
||||||
|
#include "NamedEnum.H"
|
||||||
|
#include "point.H"
|
||||||
|
#include "word.H"
|
||||||
|
#include "PtrList.H"
|
||||||
|
#include "labelList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class searchableSurface;
|
||||||
|
class searchableSurfaces;
|
||||||
|
class polyMesh;
|
||||||
|
class dictionary;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class surfaceZonesInfo Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class surfaceZonesInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Types of selection of area
|
||||||
|
enum areaSelectionAlgo
|
||||||
|
{
|
||||||
|
INSIDE,
|
||||||
|
OUTSIDE,
|
||||||
|
INSIDEPOINT,
|
||||||
|
NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
static const NamedEnum<areaSelectionAlgo, 4> areaSelectionAlgoNames;
|
||||||
|
|
||||||
|
//- What to do with faceZone faces
|
||||||
|
enum faceZoneType
|
||||||
|
{
|
||||||
|
INTERNAL,
|
||||||
|
BAFFLE,
|
||||||
|
BOUNDARY
|
||||||
|
};
|
||||||
|
|
||||||
|
static const NamedEnum<faceZoneType, 3> faceZoneTypeNames;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Per 'interface' surface : name of faceZone to put faces into
|
||||||
|
word faceZoneName_;
|
||||||
|
|
||||||
|
//- Per 'interface' surface : name of cellZone to put cells into
|
||||||
|
word cellZoneName_;
|
||||||
|
|
||||||
|
//- Per 'interface' surface : (only used if surface is closed)
|
||||||
|
// How to select zone cells : surface inside or outside or given
|
||||||
|
// inside location.
|
||||||
|
areaSelectionAlgo zoneInside_;
|
||||||
|
|
||||||
|
//- If zoneInside=location gives the corresponding inside point
|
||||||
|
point zoneInsidePoint_;
|
||||||
|
|
||||||
|
//- Per 'interface' surface :
|
||||||
|
// What to do with outside
|
||||||
|
faceZoneType faceType_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const surfaceZonesInfo&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from surfaces and dictionary
|
||||||
|
surfaceZonesInfo
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& surfacesDict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
surfaceZonesInfo
|
||||||
|
(
|
||||||
|
const word& faceZoneNames,
|
||||||
|
const word& cellZoneNames,
|
||||||
|
const areaSelectionAlgo& zoneInside,
|
||||||
|
const point& zoneInsidePoints,
|
||||||
|
const faceZoneType& faceType
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Copy constructor
|
||||||
|
surfaceZonesInfo(const surfaceZonesInfo&);
|
||||||
|
|
||||||
|
//- Return clone
|
||||||
|
autoPtr<surfaceZonesInfo> clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<surfaceZonesInfo>(new surfaceZonesInfo(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Per 'interface' surface : empty or name of faceZone to put
|
||||||
|
// faces into
|
||||||
|
const word& faceZoneName() const
|
||||||
|
{
|
||||||
|
return faceZoneName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Per 'interface' surface : empty or name of cellZone to put
|
||||||
|
// cells into
|
||||||
|
const word& cellZoneName() const
|
||||||
|
{
|
||||||
|
return cellZoneName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const areaSelectionAlgo& zoneInside() const
|
||||||
|
{
|
||||||
|
return zoneInside_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Get specified inside locations for surfaces with a cellZone
|
||||||
|
const point& zoneInsidePoint() const
|
||||||
|
{
|
||||||
|
return zoneInsidePoint_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- How to handle face of surfaces with a faceZone
|
||||||
|
const faceZoneType& faceType() const
|
||||||
|
{
|
||||||
|
return faceType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Query
|
||||||
|
|
||||||
|
//- Get indices of unnamed surfaces (surfaces without faceZoneName)
|
||||||
|
static labelList getUnnamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Get indices of named surfaces (surfaces with faceZoneName)
|
||||||
|
static labelList getNamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Get indices of surfaces with a cellZone that are closed and
|
||||||
|
// have 'inside' or 'outside' selection.
|
||||||
|
static labelList getClosedNamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList,
|
||||||
|
const searchableSurfaces& allGeometry,
|
||||||
|
const labelList& surfaces
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Get indices of surfaces with a cellZone that have 'insidePoint'
|
||||||
|
// section.
|
||||||
|
static labelList getInsidePointNamedSurfaces
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList
|
||||||
|
);
|
||||||
|
|
||||||
|
static labelList addCellZonesToMesh
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList,
|
||||||
|
const labelList& namedSurfaces,
|
||||||
|
polyMesh& mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
static labelList addFaceZonesToMesh
|
||||||
|
(
|
||||||
|
const PtrList<surfaceZonesInfo>& surfList,
|
||||||
|
const labelList& namedSurfaces,
|
||||||
|
polyMesh& mesh
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user