From 0590d254e0c25fc753e057251450425a70a1dc7e Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Thu, 11 Apr 2019 17:27:01 +0200 Subject: [PATCH] Run-time bugfixes in donorBasedLayeredOverlapFringe Note: still need to thoroughly test in parallel and with multiple donor regions for a single background region --- src/overset/oversetMesh/Make/options | 8 +- .../donorBasedLayeredOverlapFringe.C | 341 +++++++++--------- .../donorBasedLayeredOverlapFringe.H | 33 +- 3 files changed, 197 insertions(+), 185 deletions(-) diff --git a/src/overset/oversetMesh/Make/options b/src/overset/oversetMesh/Make/options index 2afb673c2..9444c1444 100644 --- a/src/overset/oversetMesh/Make/options +++ b/src/overset/oversetMesh/Make/options @@ -2,14 +2,10 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lsurfMesh \ - -lsampling \ - -ldynamicMesh \ - -ldynamicFvMesh + -lsampling diff --git a/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C b/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C index ad53a485c..e7afc6bb4 100644 --- a/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C +++ b/src/overset/oversetMesh/oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C @@ -30,7 +30,6 @@ License #include "oversetRegion.H" #include "addToRunTimeSelectionTable.H" #include "syncTools.H" -#include "dynamicFvMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -56,6 +55,88 @@ Foam::donorBasedLayeredOverlapFringe::distTol_ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::donorBasedLayeredOverlapFringe::init() const +{ + // Set size of the list containing IDs + connectedRegionIDs_.setSize(connectedRegionNames_.size()); + + // Get list of all overset regions + const PtrList& allRegions = + this->region().overset().regions(); + + // Create list of all region names for easy lookup + wordList allRegionNames(allRegions.size()); + forAll (allRegionNames, arI) + { + allRegionNames[arI] = allRegions[arI].name(); + } + + // Loop through all regions and check whether the overlap has been found + forAll (connectedRegionNames_, crI) + { + // Get name of this connected region + const word& crName = connectedRegionNames_[crI]; + + // Find this region in the list of all regions + const label regionID = findIndex(allRegionNames, crName); + + if (regionID == -1) + { + FatalErrorIn("void donorBasedLayeredOverlapFringe::init() const") + << "Region " << crName << " not found in list of regions." + << "List of overset regions: " << allRegionNames + << abort(FatalError); + } + + // Collect the region index in the list + connectedRegionIDs_[crI] = regionID; + + // Sanity check: if the specified connected donor region has more than 1 + // donor regions, this fringe algorithm is attempted to be used for + // something that's not intended. Issue an error + if (allRegions[regionID].donorRegions().size() != 1) + { + FatalErrorIn("void donorBasedLayeredOverlapFringe::init() const") + << "Region " << crName << " specified as connected region, but" + << " that region has " + << allRegions[regionID].donorRegions().size() + << " donor regions." + << abort(FatalError); + } + + // Sanity check whether the donor region of connected region is actually + // this region + if (allRegions[regionID].donorRegions()[0] != this->region().index()) + { + FatalErrorIn("void donorBasedLayeredOverlapFringe::init() const") + << "The donor region of region " << crName + << " should be only region " << this->region().name() + << abort(FatalError); + } + } + + // Sanity check: number of (optionally) specified centre points must be + // equal to the number of connected regions + if + ( + !regionCentrePoints_.empty() + && (regionCentrePoints_.size() != connectedRegionIDs_.size()) + ) + { + FatalErrorIn("void donorBasedLayeredOverlapFringe::init() const") + << "You have specified " + << regionCentrePoints_.size() + << " regionCentrePoints, while specifying " + << connectedRegionIDs_.size() + << " connectedRegions." + << nl + << "If you'd like to avoid using automatic centre point detection," + << " make sure to specify centre points for all connected regions." + << abort(FatalError); + } +} + + void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const { // Make sure that either acceptorsPtr is unnalocated or if it is allocated, @@ -69,6 +150,13 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const << abort(FatalError); } + if (!isInitialized_) + { + // This is the first call, initialize the data and set flag to true + init(); + isInitialized_ = true; + } + // Get list of all overset regions const PtrList& allRegions = this->region().overset().regions(); @@ -118,6 +206,9 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const if (allFringesReady) { + Info<< "All dependent fringes are ready. Starting donor based layered" + << " overlap assembly..." << endl; + // Loop through connected regions forAll (connectedRegionIDs_, crI) { @@ -217,10 +308,18 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const const label nUniqueDonors = returnReduce(donors.size(), sumOp