From 905403e2ed86abe574932c4cf0e45134ecac89c8 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Fri, 1 Nov 2019 14:58:10 +0100 Subject: [PATCH 1/2] Fix BlackoilWellModel::numComponents for parallel runs. In the case with active solvent (BlackoilWellModel::has_solvent_ is true, e.g. case 2D_OILWATER_POLYMER.DATA) and one process have no wells while another has some this lead to numComponents returning different values. Later this lead to truncated message in MPI_Allgather. The underlying problem was the usage of numWells() which returns just the number of local wells. We resort to using wellsActive which returns whether there any well active regardless which process knows it. --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 84fdc6a16..81734d106 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1380,7 +1380,7 @@ namespace Opm { int BlackoilWellModel::numComponents() const { - if (numWells() > 0 && numPhases() < 3) { + if (wellsActive() && numPhases() < 3) { return numPhases(); } int numComp = FluidSystem::numComponents; From a5506956fbd00cf4e9378cad699372a2f59ccbc5 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Fri, 1 Nov 2019 15:11:21 +0100 Subject: [PATCH 2/2] renamed numWells to numLocalWells in BlackoilWellmodel as this better reflects that it is not the number of wells in the whole domain but just the one in the part of the domain stored in the local process. --- opm/simulators/wells/BlackoilWellModel.hpp | 2 +- opm/simulators/wells/BlackoilWellModel_impl.hpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 40856e1d1..fb8a8af0d 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -337,7 +337,7 @@ namespace Opm { // The number of components in the model. int numComponents() const; - int numWells() const; + int numLocalWells() const; int numPhases() const; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 81734d106..dfc40f9b6 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -620,7 +620,7 @@ namespace Opm { { std::vector well_container; - const int nw = numWells(); + const int nw = numLocalWells(); if (nw > 0) { well_container.reserve(nw); @@ -732,7 +732,7 @@ namespace Opm { const Well2& well_ecl = wells_ecl_[index_well_ecl]; // Finding the location of the well in wells struct. - const int nw = numWells(); + const int nw = numLocalWells(); int well_index_wells = -999; for (int w = 0; w < nw; ++w) { if (well_name == std::string(wells()->name[w])) { @@ -944,7 +944,7 @@ namespace Opm { BlackoilWellModel:: localWellsActive() const { - return numWells() > 0; + return numLocalWells() > 0; } @@ -1148,7 +1148,7 @@ namespace Opm { computeWellPotentials(std::vector& well_potentials, const int reportStepIdx, Opm::DeferredLogger& deferred_logger) { // number of wells and phases - const int nw = numWells(); + const int nw = numLocalWells(); const int np = numPhases(); well_potentials.resize(nw * np, 0.0); @@ -1393,7 +1393,7 @@ namespace Opm { template int - BlackoilWellModel:: numWells() const + BlackoilWellModel:: numLocalWells() const { return wells() ? wells()->number_of_wells : 0; }