mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: mutliple inside points. Fixes #2981
This commit is contained in:
@ -225,6 +225,8 @@ castellatedMeshControls
|
|||||||
//cellZone sphere;
|
//cellZone sphere;
|
||||||
//cellZoneInside inside; // outside/insidePoint
|
//cellZoneInside inside; // outside/insidePoint
|
||||||
//insidePoint (1 1 1); // if (cellZoneInside == insidePoint)
|
//insidePoint (1 1 1); // if (cellZoneInside == insidePoint)
|
||||||
|
// or alternative multiple insidePoints:
|
||||||
|
//insidePoints ((1 1 1)); // if (cellZoneInside == insidePoint)
|
||||||
|
|
||||||
//- Optional specification of what to do with faceZone faces:
|
//- Optional specification of what to do with faceZone faces:
|
||||||
// internal : keep them as internal faces (default)
|
// internal : keep them as internal faces (default)
|
||||||
|
|||||||
@ -3344,24 +3344,33 @@ void Foam::meshRefinement::zonify
|
|||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
// Collect per surface the -insidePoint -cellZone
|
// Collect per surface the -insidePoint -cellZone
|
||||||
pointField insidePoints(locationSurfaces.size());
|
// Usually only a single inside point per surface so no clever
|
||||||
labelList insidePointCellZoneIDs(locationSurfaces.size(), -1);
|
// counting - just use DynamicField
|
||||||
|
DynamicField<point> insidePoints(locationSurfaces.size());
|
||||||
|
DynamicList<label> insidePointCellZoneIDs(locationSurfaces.size());
|
||||||
forAll(locationSurfaces, i)
|
forAll(locationSurfaces, i)
|
||||||
{
|
{
|
||||||
label surfI = locationSurfaces[i];
|
const label surfI = locationSurfaces[i];
|
||||||
insidePoints[i] = surfZones[surfI].zoneInsidePoint();
|
const auto& surfInsidePoints = surfZones[surfI].zoneInsidePoints();
|
||||||
|
|
||||||
const word& name = surfZones[surfI].cellZoneName();
|
const word& name = surfZones[surfI].cellZoneName();
|
||||||
|
label zoneID = -1;
|
||||||
if (name != "none")
|
if (name != "none")
|
||||||
{
|
{
|
||||||
label zoneID = mesh_.cellZones().findZoneID(name);
|
zoneID = mesh_.cellZones().findZoneID(name);
|
||||||
if (zoneID == -1)
|
if (zoneID == -1)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "problem"
|
<< "Specified non-existing cellZone " << name
|
||||||
|
<< " for surface " << surfaces_.names()[surfI]
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
insidePointCellZoneIDs[i] = zoneID;
|
}
|
||||||
|
|
||||||
|
for (const auto& pt : surfInsidePoints)
|
||||||
|
{
|
||||||
|
insidePoints.append(pt);
|
||||||
|
insidePointCellZoneIDs.append(zoneID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2013-2015 OpenFOAM Foundation
|
Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -83,7 +83,7 @@ Foam::surfaceZonesInfo::surfaceZonesInfo
|
|||||||
faceZoneNames_(),
|
faceZoneNames_(),
|
||||||
cellZoneName_(),
|
cellZoneName_(),
|
||||||
zoneInside_(NONE),
|
zoneInside_(NONE),
|
||||||
zoneInsidePoint_(point::min),
|
zoneInsidePoints_(),
|
||||||
faceType_(INTERNAL)
|
faceType_(INTERNAL)
|
||||||
{
|
{
|
||||||
const label nRegions = surface.regions().size();
|
const label nRegions = surface.regions().size();
|
||||||
@ -156,9 +156,31 @@ Foam::surfaceZonesInfo::surfaceZonesInfo
|
|||||||
zoneInside_ = areaSelectionAlgoNames[method];
|
zoneInside_ = areaSelectionAlgoNames[method];
|
||||||
if (zoneInside_ == INSIDEPOINT)
|
if (zoneInside_ == INSIDEPOINT)
|
||||||
{
|
{
|
||||||
surfacesDict.readEntry("insidePoint", zoneInsidePoint_);
|
const bool foundPoints = surfacesDict.readIfPresent
|
||||||
}
|
(
|
||||||
|
"insidePoints",
|
||||||
|
zoneInsidePoints_,
|
||||||
|
keyType::LITERAL
|
||||||
|
);
|
||||||
|
|
||||||
|
if (foundPoints)
|
||||||
|
{
|
||||||
|
if (surfacesDict.found("insidePoint", keyType::LITERAL))
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction(surfacesDict)
|
||||||
|
<< "Cannot supply both 'insidePoint'"
|
||||||
|
<< " and 'insidePoints'" << exit(FatalIOError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zoneInsidePoints_ = pointField
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
surfacesDict.get<point>("insidePoint", keyType::LITERAL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -216,14 +238,14 @@ Foam::surfaceZonesInfo::surfaceZonesInfo
|
|||||||
const wordList& faceZoneNames,
|
const wordList& faceZoneNames,
|
||||||
const word& cellZoneName,
|
const word& cellZoneName,
|
||||||
const areaSelectionAlgo& zoneInside,
|
const areaSelectionAlgo& zoneInside,
|
||||||
const point& zoneInsidePoint,
|
const pointField& zoneInsidePoints,
|
||||||
const faceZoneType& faceType
|
const faceZoneType& faceType
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
faceZoneNames_(faceZoneNames),
|
faceZoneNames_(faceZoneNames),
|
||||||
cellZoneName_(cellZoneName),
|
cellZoneName_(cellZoneName),
|
||||||
zoneInside_(zoneInside),
|
zoneInside_(zoneInside),
|
||||||
zoneInsidePoint_(zoneInsidePoint),
|
zoneInsidePoints_(zoneInsidePoints),
|
||||||
faceType_(faceType)
|
faceType_(faceType)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -233,7 +255,7 @@ Foam::surfaceZonesInfo::surfaceZonesInfo(const surfaceZonesInfo& surfZone)
|
|||||||
faceZoneNames_(surfZone.faceZoneNames()),
|
faceZoneNames_(surfZone.faceZoneNames()),
|
||||||
cellZoneName_(surfZone.cellZoneName()),
|
cellZoneName_(surfZone.cellZoneName()),
|
||||||
zoneInside_(surfZone.zoneInside()),
|
zoneInside_(surfZone.zoneInside()),
|
||||||
zoneInsidePoint_(surfZone.zoneInsidePoint()),
|
zoneInsidePoints_(surfZone.zoneInsidePoints()),
|
||||||
faceType_(surfZone.faceType())
|
faceType_(surfZone.faceType())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2014 OpenFOAM Foundation
|
Copyright (C) 2014 OpenFOAM Foundation
|
||||||
Copyright (C) 2015 OpenCFD Ltd.
|
Copyright (C) 2015,2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,7 +38,7 @@ SourceFiles
|
|||||||
#define surfaceZonesInfo_H
|
#define surfaceZonesInfo_H
|
||||||
|
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
#include "point.H"
|
#include "pointField.H"
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
@ -110,7 +110,7 @@ private:
|
|||||||
areaSelectionAlgo zoneInside_;
|
areaSelectionAlgo zoneInside_;
|
||||||
|
|
||||||
//- If zoneInside=location gives the corresponding inside point
|
//- If zoneInside=location gives the corresponding inside point
|
||||||
point zoneInsidePoint_;
|
pointField zoneInsidePoints_;
|
||||||
|
|
||||||
//- Per 'interface' surface :
|
//- Per 'interface' surface :
|
||||||
// What to do with outside
|
// What to do with outside
|
||||||
@ -142,7 +142,7 @@ public:
|
|||||||
const wordList& faceZoneNames,
|
const wordList& faceZoneNames,
|
||||||
const word& cellZoneNames,
|
const word& cellZoneNames,
|
||||||
const areaSelectionAlgo& zoneInside,
|
const areaSelectionAlgo& zoneInside,
|
||||||
const point& zoneInsidePoints,
|
const pointField& zoneInsidePoints,
|
||||||
const faceZoneType& faceType
|
const faceZoneType& faceType
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -179,10 +179,16 @@ public:
|
|||||||
return zoneInside_;
|
return zoneInside_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Get specified inside locations for surfaces with a cellZone
|
//- Get specified inside location for surfaces with a cellZone
|
||||||
const point& zoneInsidePoint() const
|
const point zoneInsidePoint() const
|
||||||
{
|
{
|
||||||
return zoneInsidePoint_;
|
return zoneInsidePoints_[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Get specified inside locations for surfaces with a cellZone
|
||||||
|
const pointField& zoneInsidePoints() const
|
||||||
|
{
|
||||||
|
return zoneInsidePoints_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- How to handle face of surfaces with a faceZone
|
//- How to handle face of surfaces with a faceZone
|
||||||
|
|||||||
Reference in New Issue
Block a user