Merge pull request #5351 from blattms/feature/do-not-warn-for-suprious-nnc-in-parallel

Prevent spurious warnings about NNCs when applying EDITNNC in parallel.
This commit is contained in:
Bård Skaflestad 2024-06-10 16:19:22 +02:00 committed by GitHub
commit c076532fdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -287,6 +287,7 @@ protected:
bool enableEnergy_;
bool enableDiffusivity_;
bool enableDispersivity_;
bool warnEditNNC_ = true;
std::unordered_map<std::uint64_t, Scalar> thermalHalfTrans_; //NB this is based on direction map size is ca 2*trans_ (diffusivity_)
std::unordered_map<std::uint64_t, Scalar> diffusivity_;
std::unordered_map<std::uint64_t, Scalar> dispersivity_;

View File

@ -574,12 +574,18 @@ update(bool global, const TransUpdateQuantities update_quantities,
}
if (!disableNNC) {
// For EDITNNC and EDITNNCR we warn only once
// If transmissibility is used for load balancing this will be done
// when computing the gobal transmissibilities and all warnings will
// be seen in a parallel. Unfortunately, when we do not use transmissibilities
// we will only see warnings for the partition of process 0 and also false positives.
this->applyEditNncToGridTrans_(globalToLocal);
this->applyNncToGridTrans_(globalToLocal);
this->applyEditNncrToGridTrans_(globalToLocal);
if (applyNncMultregT) {
this->applyNncMultreg_(globalToLocal);
}
warnEditNNC_ = false;
}
// If disableNNC == true, remove all non-neighbouring transmissibilities.
@ -1190,9 +1196,12 @@ applyEditNncToGridTransHelper_(const std::unordered_map<std::size_t,int>& global
auto highIt = globalToLocal.find(c2);
if (lowIt == globalToLocal.end() || highIt == globalToLocal.end()) {
print_warning(*nnc);
// Prevent warnings for NNCs stored on other processes in parallel (both cells inactive)
if ( lowIt != highIt && warnEditNNC_) {
print_warning(*nnc);
warning_count++;
}
++nnc;
warning_count++;
continue;
}
@ -1202,7 +1211,7 @@ applyEditNncToGridTransHelper_(const std::unordered_map<std::size_t,int>& global
std::swap(low, high);
auto candidate = trans_.find(details::isId(low, high));
if (candidate == trans_.end()) {
if (candidate == trans_.end() && warnEditNNC_) {
print_warning(*nnc);
++nnc;
warning_count++;