From bcdab3b78409d68cc056c9815580c977f9a5923d Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Thu, 11 Apr 2019 17:38:28 +0200 Subject: [PATCH] Robustness improvement in donorBasedLayeredOverlapFringe Looking at bounding box of the connected region to determine whether we are going in the right direction. --- .../donorBasedLayeredOverlapFringe.C | 36 +++++++++++++++++-- .../donorBasedLayeredOverlapFringe.H | 7 ++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C b/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C index e7afc6bb4..b05563034 100644 --- a/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C +++ b/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C @@ -331,6 +331,10 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const const unallocLabelList& owner = mesh.faceOwner(); const unallocLabelList& neighbour = mesh.faceNeighbour(); + // Get bounding box of this region for additional check when marking + // acceptors + const boundBox& bb = allRegions[regionID].globalBounds(); + // Mark cells that are eligible to be acceptors (not donors) boolList eligibleCells(mesh.nCells(), true); forAllConstIter (labelHashSet, donors, iter) @@ -372,9 +376,14 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const if ( - faceCentreToRegionCentreDist - - donorCentreToRegionCentreDist - < distTol_ + // First, distance based criterium + ( + faceCentreToRegionCentreDist + - donorCentreToRegionCentreDist + < distTol_ + ) + // Second, bounding box based criterium + && (bb.contains(faceCentre)) ) { // Face is closer to the centre point than cell: we @@ -681,6 +690,27 @@ Foam::donorBasedLayeredOverlapFringe::donorBasedLayeredOverlapFringe << "The number should be greater than 0." << abort(FatalError); } + + // Recommendation: use at least two layers in order to avoid going defining + // acceptors on the wrong side and filling in the whole region with holes + if (nLayers_ == 1) + { + WarningIn + ( + "donorBasedLayeredOverlapFringe::" + "donorBasedLayeredOverlapFringe\n" + "(\n" + " const fvMesh& mesh,\n" + " const oversetRegion& region,\n" + " const dictionary& dict\n" + ")" + ) << "It is recommended to use at least 2 layers (nLayers = 2) in" + << " order to avoid defining acceptor cells on the wrong side" + << " of the region." + << nl + << "Be sure to check the fringe layer for this region." + << endl; + } } diff --git a/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.H b/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.H index 2cdd2aed8..21e4cf5b1 100644 --- a/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.H +++ b/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.H @@ -37,6 +37,13 @@ Description each other (e.g. 10:1 cell ratio, where the finer cells are found on the background mesh will probably be problematic to correctly set-up). + Note: based on distance tolerance (see distTol_ member), specified number of + layers and the bounding box of the connected donor region, it is possible + that acceptors end also on the wrong side (from the region centre as opposed + to towards the region centre). I do all I can to prevent this by looking at + the bounding box and hinting that at least 2 layers should be used. Be sure + to check the overset assembly for this region using calcOverset utility. + Author Vuko Vukcevic, Wikki Ltd. All rights reserved.