Bugfixes in automatic overlap assembly
adaptiveOverlapFringe: 1. When combining user specified holes and cut holes, we need to get rid of possible duplicates, 2. All holes transferred to fringeHolesPtr_, not just cutHoles, 3. Removed minLocalSuit_ data member as the donorSuitability::threshold is basically the same thing. donorSuitability: 1. Correct definition of isDonorSuitable
This commit is contained in:
parent
dbbad653fe
commit
6ba57d44fc
4 changed files with 40 additions and 88 deletions
|
@ -181,24 +181,25 @@ void Foam::adaptiveOverlapFringe::calcAddressing() const
|
|||
|
||||
// Read user specified holes into allHoles list. Note: if the cell set
|
||||
// is not found, the list will be empty
|
||||
labelList allHoles
|
||||
cellSet allHoles
|
||||
(
|
||||
cellSet
|
||||
(
|
||||
mesh,
|
||||
holesSetName_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
).toc()
|
||||
mesh,
|
||||
holesSetName_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
// Extend allHoles with cutHoles
|
||||
allHoles.append(cutHoles);
|
||||
forAll (cutHoles, chI)
|
||||
{
|
||||
// Note: cellSet is a hashSet so it automatically removes duplicates
|
||||
allHoles.insert(cutHoles[chI]);
|
||||
}
|
||||
|
||||
// Mark all holes
|
||||
forAll (allHoles, hI)
|
||||
forAllConstIter (labelHashSet, allHoles, iter)
|
||||
{
|
||||
const label& holeCellI = allHoles[hI];
|
||||
const label& holeCellI = iter.key();
|
||||
|
||||
// Mask eligible acceptors
|
||||
eligibleAcceptors[holeCellI] = false;
|
||||
|
@ -216,10 +217,10 @@ void Foam::adaptiveOverlapFringe::calcAddressing() const
|
|||
dynamicLabelList candidateAcceptors(mesh.nCells());
|
||||
|
||||
// Loop through all holes and find acceptor candidates
|
||||
forAll (allHoles, hI)
|
||||
forAllConstIter (labelHashSet, allHoles, iter)
|
||||
{
|
||||
// Get neighbours of this hole cell
|
||||
const labelList& hNbrs = cc[allHoles[hI]];
|
||||
const labelList& hNbrs = cc[iter.key()];
|
||||
|
||||
// Loop through neighbours of this hole cell
|
||||
forAll (hNbrs, nbrI)
|
||||
|
@ -361,7 +362,7 @@ void Foam::adaptiveOverlapFringe::calcAddressing() const
|
|||
// Transfer the acceptor list and allocate empty fringeHoles list, which
|
||||
// may be populated in updateIteration member function
|
||||
acceptorsPtr_ = new labelList(candidateAcceptors.xfer());
|
||||
fringeHolesPtr_ = new labelList(cutHoles);
|
||||
fringeHolesPtr_ = new labelList(allHoles.toc().xfer());
|
||||
}
|
||||
|
||||
|
||||
|
@ -416,48 +417,9 @@ Foam::adaptiveOverlapFringe::adaptiveOverlapFringe
|
|||
(
|
||||
dict.lookupOrDefault<scalar>("orphanSuitability", 1)
|
||||
),
|
||||
minLocalSuit_
|
||||
(
|
||||
dict.lookupOrDefault<scalar>("minLocalSuit", 1)
|
||||
),
|
||||
suitablePairsSuit_(0)
|
||||
|
||||
{
|
||||
if (minLocalSuit_ < 0)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"Foam::adaptiveOverlapFringe::adaptiveOverlapFringe \n"
|
||||
"\t( "
|
||||
"\n \t const fvMesh& mesh,"
|
||||
"\n \t const oversetRegion& region, "
|
||||
"\n \t const dictionary& dict"
|
||||
"\n \t)"
|
||||
) << "Chosen minimal local suitability is less than or equal to 0."
|
||||
<< nl
|
||||
<< "This means all donor/acceptor pairs, except the ones "
|
||||
<< "whose donor is not within bounding box, will be "
|
||||
<< "considered as suitable."
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
if (minLocalSuit_ > 1)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"Foam::adaptiveOverlapFringe::adaptiveOverlapFringe \n"
|
||||
"\t( "
|
||||
"\n \t const fvMesh& mesh,"
|
||||
"\n \t const oversetRegion& region, "
|
||||
"\n \t const dictionary& dict"
|
||||
"\n \t)"
|
||||
) << "Chosen minimal local suitability is greater than 1."
|
||||
<< nl
|
||||
<< "This means all donor/acceptor pairs will be considered"
|
||||
<< " unsuitable. "
|
||||
<< nl << endl;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
@ -502,7 +464,7 @@ bool Foam::adaptiveOverlapFringe::updateIteration
|
|||
<< fringeIter_ << endl;
|
||||
|
||||
// Store donor/acceptor pairs whose donors are not within bounding box or
|
||||
// their suitability is lower than minLocalSuit_ into unsuitableDAPairs
|
||||
// their suitability is lower than threshold into unsuitableDAPairs
|
||||
// donorAcceptorDynamicList. Neighbours of those acceptors will be
|
||||
// candidates for new acceptors.
|
||||
donorAcceptorDynamicList unsuitableDAPairs(donorAcceptorRegionData.size());
|
||||
|
@ -550,9 +512,9 @@ bool Foam::adaptiveOverlapFringe::updateIteration
|
|||
const scalar donorAcceptorSuit =
|
||||
donorSuitability_->suitabilityFraction(curDA);
|
||||
|
||||
if (donorAcceptorSuit < minLocalSuit_)
|
||||
if (!donorSuitability_->isDonorSuitable(curDA))
|
||||
{
|
||||
// Suitability of this pair is lower than minLocalSuit_.
|
||||
// Suitability of this pair is lower than threshold.
|
||||
// Append it to unsuitableDAPairs list.
|
||||
unsuitableDAPairs.append(curDA);
|
||||
|
||||
|
@ -561,7 +523,7 @@ bool Foam::adaptiveOverlapFringe::updateIteration
|
|||
}
|
||||
else
|
||||
{
|
||||
// Suitability of this pair is greater than minLocalSuit_.
|
||||
// Suitability of this pair is greater than threshold.
|
||||
|
||||
// Add suitability to suitablePairsSuit_
|
||||
suitablePairsSuit_ += donorAcceptorSuit;
|
||||
|
@ -1125,7 +1087,7 @@ bool Foam::adaptiveOverlapFringe::updateIteration
|
|||
<< " iteration. " << nl
|
||||
<< "Average donor/acceptor suitability is "
|
||||
<< maxObject().suitability()*100 << "%."
|
||||
<< endl;
|
||||
<< nl << endl;
|
||||
|
||||
// Final overlap is found. Clear iteration history.
|
||||
iterationDataHistory_.clear();
|
||||
|
|
|
@ -122,7 +122,7 @@ class adaptiveOverlapFringe
|
|||
mutable label fringeIter_;
|
||||
|
||||
//- User defined number of iterations - by default 4 iterations will
|
||||
// be made
|
||||
// be made
|
||||
const label specifiedIterationsNumber_;
|
||||
|
||||
//- Relative iteration counter
|
||||
|
@ -135,12 +135,6 @@ class adaptiveOverlapFringe
|
|||
// suitability
|
||||
const scalar orphanSuitability_;
|
||||
|
||||
//- Minimum local suitability - if donor/acceptor suitability
|
||||
// of donor/acceptor pair is lower than minimum local
|
||||
// fraction, neighbours of this acceptor are new acceptor
|
||||
// candidates
|
||||
const scalar minLocalSuit_;
|
||||
|
||||
// Suitable donor/acceptor pairs
|
||||
mutable donorAcceptorDynamicList suitableDAPairs_;
|
||||
|
||||
|
|
|
@ -100,20 +100,4 @@ void Foam::donorSuitability::donorSuitability::combineDonorSuitabilityFunction
|
|||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::oversetFringe&
|
||||
Foam::donorSuitability::donorSuitability::oversetFringeAlgorithm() const
|
||||
{
|
||||
return oversetFringe_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::dictionary&
|
||||
Foam::donorSuitability::donorSuitability::coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
|
||||
|
||||
//- Destructor
|
||||
// Note: the destructor is pure virtual to make this class abstract
|
||||
// Note: the destructor is pure virtual to make this class abstract
|
||||
virtual ~donorSuitability() = 0;
|
||||
|
||||
|
||||
|
@ -181,10 +181,22 @@ public:
|
|||
// Access
|
||||
|
||||
//- Return a const reference to oversetFringe algorithm
|
||||
const oversetFringe& oversetFringeAlgorithm() const;
|
||||
inline const oversetFringe& oversetFringeAlgorithm() const
|
||||
{
|
||||
return oversetFringe_;
|
||||
}
|
||||
|
||||
//- Return coefficient dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
inline const dictionary& coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
//- Return threshold
|
||||
inline const scalar& threshold() const
|
||||
{
|
||||
return threshold_;
|
||||
}
|
||||
|
||||
|
||||
// Overlap minimisation via Donor Suitability Function
|
||||
|
@ -194,7 +206,7 @@ public:
|
|||
// greater DSF to get relative difference. Return relative
|
||||
// difference (a value which is always between 0 and 1. Higher
|
||||
// value means better suitability).
|
||||
scalar suitabilityFraction
|
||||
scalar suitabilityFraction
|
||||
(
|
||||
const donorAcceptor& daPair
|
||||
) const
|
||||
|
@ -222,13 +234,13 @@ public:
|
|||
|
||||
|
||||
//- Is this donor/acceptor pair suitable?
|
||||
// if (1 - sutabilityFraction) < threshold
|
||||
// if sutabilityFraction > threshold
|
||||
bool isDonorSuitable
|
||||
(
|
||||
const donorAcceptor& daPair
|
||||
) const
|
||||
{
|
||||
return (1 - suitabilityFraction(daPair)) < threshold_;
|
||||
return (suitabilityFraction(daPair)) > threshold_;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Reference in a new issue