ENH: snappyHexMesh: block walk through other surfaces.
This commit is contained in:
parent
3f1f191034
commit
a9f8bc079f
@ -2408,14 +2408,18 @@ void Foam::meshRefinement::growCellZone
|
||||
|
||||
|
||||
List<wallPoints> allFaceInfo(mesh_.nFaces());
|
||||
FaceCellWave<wallPoints> wallDistCalc
|
||||
|
||||
const bitSet isBlockedFace(mesh_.nFaces());
|
||||
wallPoints::trackData td(isBlockedFace);
|
||||
FaceCellWave<wallPoints, wallPoints::trackData> wallDistCalc
|
||||
(
|
||||
mesh_,
|
||||
changedFaces,
|
||||
faceDist,
|
||||
allFaceInfo,
|
||||
allCellInfo,
|
||||
0 // max iterations
|
||||
0, // max iterations
|
||||
td
|
||||
);
|
||||
wallDistCalc.iterate(nGrowCellZones);
|
||||
|
||||
|
@ -514,8 +514,8 @@ Foam::label Foam::meshRefinement::markProximityRefinementWave
|
||||
}
|
||||
}
|
||||
// Clever limiting of the number of iterations (= max cells in the channel)
|
||||
// since it has too many problematic issues, e.g. with volume refinement.
|
||||
// Since the real check uses the proper distance anyway just disable.
|
||||
// since it has too many problematic issues, e.g. with volume refinement
|
||||
// and the real check uses the proper distance anyway just disable.
|
||||
const label nIters = mesh_.globalData().nTotalCells();
|
||||
|
||||
|
||||
@ -613,11 +613,21 @@ Foam::label Foam::meshRefinement::markProximityRefinementWave
|
||||
DynamicList<FixedList<label, 3>> originSurface(2);
|
||||
//DynamicList<point> originNormal(2);
|
||||
|
||||
|
||||
//- To avoid walking through surfaces we mark all faces that have been
|
||||
// intersected. We can either mark only those faces intersecting
|
||||
// blockedSurfaces (i.e. with a 'blockLevel') or mark faces intersecting
|
||||
// any (refinement) surface (this includes e.g. faceZones). This is
|
||||
// much easier since that information is already cached
|
||||
// (meshRefinement::intersectedFaces())
|
||||
|
||||
//bitSet isBlockedFace(mesh_.nFaces());
|
||||
forAll(testFaces, i)
|
||||
{
|
||||
if (hit1[i].hit())
|
||||
{
|
||||
const label facei = testFaces[i];
|
||||
//isBlockedFace.set(facei);
|
||||
const point& fc = mesh_.faceCentres()[facei];
|
||||
const labelList& fz1 = faceZones[surface1[i]];
|
||||
|
||||
@ -656,6 +666,8 @@ Foam::label Foam::meshRefinement::markProximityRefinementWave
|
||||
);
|
||||
}
|
||||
|
||||
// Collect all seed data. Currently walking does not look at
|
||||
// surface direction - if so pass in surface normal as well
|
||||
faceDist[n] = wallPoints
|
||||
(
|
||||
originLocation, // origin
|
||||
@ -683,14 +695,21 @@ Foam::label Foam::meshRefinement::markProximityRefinementWave
|
||||
List<wallPoints> allFaceInfo(mesh_.nFaces());
|
||||
List<wallPoints> allCellInfo(mesh_.nCells());
|
||||
|
||||
FaceCellWave<wallPoints> wallDistCalc
|
||||
// Any refinement surface (even a faceZone) should stop the gap walking.
|
||||
// This is exactly the information which is cached in the surfaceIndex_
|
||||
// field.
|
||||
const bitSet isBlockedFace(intersectedFaces());
|
||||
|
||||
wallPoints::trackData td(isBlockedFace);
|
||||
FaceCellWave<wallPoints, wallPoints::trackData> wallDistCalc
|
||||
(
|
||||
mesh_,
|
||||
changedFaces,
|
||||
faceDist,
|
||||
allFaceInfo,
|
||||
allCellInfo,
|
||||
0 // max iterations
|
||||
0, // max iterations
|
||||
td
|
||||
);
|
||||
wallDistCalc.iterate(nIters);
|
||||
|
||||
|
@ -42,6 +42,7 @@ SourceFiles
|
||||
#include "tensor.H"
|
||||
#include "DynamicList.H"
|
||||
#include "labelList.H"
|
||||
#include "bitSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -61,6 +62,23 @@ Ostream& operator<<(Ostream&, const wallPoints&);
|
||||
|
||||
class wallPoints
|
||||
{
|
||||
public:
|
||||
|
||||
//- Class used to pass additional data in
|
||||
class trackData
|
||||
{
|
||||
public:
|
||||
|
||||
//- Per face whether the face should not be walked through
|
||||
const bitSet& isBlockedFace_;
|
||||
|
||||
trackData(const bitSet& isBlockedFace)
|
||||
:
|
||||
isBlockedFace_(isBlockedFace)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Data
|
||||
|
@ -241,30 +241,34 @@ inline bool Foam::wallPoints::updateFace
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const point& fc = mesh.faceCentres()[thisFacei];
|
||||
|
||||
// From cell to its faces.
|
||||
bool hasChanged = false;
|
||||
forAll(neighbourInfo.surface_, i)
|
||||
{
|
||||
const FixedList<label, 3>& nbrSurface = neighbourInfo.surface_[i];
|
||||
|
||||
// Find in my surfaces
|
||||
label index = surface_.find(nbrSurface);
|
||||
if (index == -1)
|
||||
if (!td.isBlockedFace_[thisFacei])
|
||||
{
|
||||
const point& fc = mesh.faceCentres()[thisFacei];
|
||||
|
||||
forAll(neighbourInfo.surface_, i)
|
||||
{
|
||||
// Append
|
||||
origin_.append(neighbourInfo.origin_[i]);
|
||||
distSqr_.append(magSqr(fc-neighbourInfo.origin_[i]));
|
||||
surface_.append(nbrSurface);
|
||||
//normal_.append(neighbourInfo.normal_[i]);
|
||||
hasChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasChanged =
|
||||
update(fc, index, neighbourInfo, i, tol, td)
|
||||
|| hasChanged;
|
||||
const FixedList<label, 3>& nbrSurface = neighbourInfo.surface_[i];
|
||||
|
||||
// Find in my surfaces
|
||||
label index = surface_.find(nbrSurface);
|
||||
if (index == -1)
|
||||
{
|
||||
// Append
|
||||
origin_.append(neighbourInfo.origin_[i]);
|
||||
distSqr_.append(magSqr(fc-neighbourInfo.origin_[i]));
|
||||
surface_.append(nbrSurface);
|
||||
//normal_.append(neighbourInfo.normal_[i]);
|
||||
hasChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasChanged =
|
||||
update(fc, index, neighbourInfo, i, tol, td)
|
||||
|| hasChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,30 +287,34 @@ inline bool Foam::wallPoints::updateFace
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const point& fc = mesh.faceCentres()[thisFacei];
|
||||
|
||||
// From face to face (e.g. coupled faces)
|
||||
bool hasChanged = false;
|
||||
forAll(neighbourInfo.surface_, i)
|
||||
{
|
||||
const FixedList<label, 3>& nbrSurface = neighbourInfo.surface_[i];
|
||||
|
||||
// Find in my surfaces
|
||||
label index = surface_.find(nbrSurface);
|
||||
if (index == -1)
|
||||
if (!td.isBlockedFace_[thisFacei])
|
||||
{
|
||||
const point& fc = mesh.faceCentres()[thisFacei];
|
||||
|
||||
forAll(neighbourInfo.surface_, i)
|
||||
{
|
||||
// Append
|
||||
origin_.append(neighbourInfo.origin_[i]);
|
||||
distSqr_.append(magSqr(fc-neighbourInfo.origin_[i]));
|
||||
surface_.append(nbrSurface);
|
||||
//normal_.append(neighbourInfo.normal_[i]);
|
||||
hasChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasChanged =
|
||||
update(fc, index, neighbourInfo, i, tol, td)
|
||||
|| hasChanged;
|
||||
const FixedList<label, 3>& nbrSurface = neighbourInfo.surface_[i];
|
||||
|
||||
// Find in my surfaces
|
||||
const label index = surface_.find(nbrSurface);
|
||||
if (index == -1)
|
||||
{
|
||||
// Append
|
||||
origin_.append(neighbourInfo.origin_[i]);
|
||||
distSqr_.append(magSqr(fc-neighbourInfo.origin_[i]));
|
||||
surface_.append(nbrSurface);
|
||||
//normal_.append(neighbourInfo.normal_[i]);
|
||||
hasChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasChanged =
|
||||
update(fc, index, neighbourInfo, i, tol, td)
|
||||
|| hasChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2012 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format binary;
|
||||
class cellSet;
|
||||
arch "LSB;label=32;scalar=64";
|
||||
location "0/polyMesh/sets";
|
||||
object cellsToRemove;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
0()
|
||||
|
||||
// ************************************************************************* //
|
@ -113,8 +113,10 @@ castellatedMeshControls
|
||||
// surfaces
|
||||
//gapLevel (1 2 10);
|
||||
|
||||
//MEJ: from cell level 2 onwards start checking for opposite
|
||||
// surfaces
|
||||
// Block any gap (opposite surfaces or opposite disconnected region
|
||||
// of surface):
|
||||
// - thinner than 2*blockcellsize where blockcellsize
|
||||
// is the size of a cell at blockLevel
|
||||
blockLevel 2;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user