mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3983 from blattms/fix-perf-all-zero
[bugfix] Fixes deadlocks with agressively distributed wells
This commit is contained in:
commit
af28030123
@ -1596,12 +1596,17 @@ namespace Opm
|
|||||||
// approximate the perforation mixture using the mobility ratio
|
// approximate the perforation mixture using the mobility ratio
|
||||||
// and weight the perforations using the well transmissibility.
|
// and weight the perforations using the well transmissibility.
|
||||||
bool all_zero = std::all_of(perfRates.begin(), perfRates.end(), [](double val) { return val == 0.0; });
|
bool all_zero = std::all_of(perfRates.begin(), perfRates.end(), [](double val) { return val == 0.0; });
|
||||||
|
const auto& comm = this->parallel_well_info_.communication();
|
||||||
|
if (comm.size() > 1)
|
||||||
|
{
|
||||||
|
all_zero = (comm.min(all_zero ? 1 : 0) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
if ( all_zero && this->isProducer() ) {
|
if ( all_zero && this->isProducer() ) {
|
||||||
double total_tw = 0;
|
double total_tw = 0;
|
||||||
for (int perf = 0; perf < nperf; ++perf) {
|
for (int perf = 0; perf < nperf; ++perf) {
|
||||||
total_tw += this->well_index_[perf];
|
total_tw += this->well_index_[perf];
|
||||||
}
|
}
|
||||||
const auto& comm = this->parallel_well_info_.communication();
|
|
||||||
if (comm.size() > 1)
|
if (comm.size() > 1)
|
||||||
{
|
{
|
||||||
total_tw = comm.sum(total_tw);
|
total_tw = comm.sum(total_tw);
|
||||||
|
@ -63,9 +63,10 @@ void WellState::initSingleProducer(const Well& well,
|
|||||||
const double temp = 273.15 + 15.56;
|
const double temp = 273.15 + 15.56;
|
||||||
|
|
||||||
auto& ws = this->wells_.add(well.name(), SingleWellState{well.name(), well_info, true, pressure_first_connection, well_perf_data, pu, temp});
|
auto& ws = this->wells_.add(well.name(), SingleWellState{well.name(), well_info, true, pressure_first_connection, well_perf_data, pu, temp});
|
||||||
if ( ws.perf_data.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
// the rest of the code needs to executed even if ws.perf_data is empty
|
||||||
|
// as this does not say anything for the whole well if it is distributed.
|
||||||
|
// Hence never ever return here!
|
||||||
if (well.getStatus() == Well::Status::OPEN) {
|
if (well.getStatus() == Well::Status::OPEN) {
|
||||||
ws.status = Well::Status::OPEN;
|
ws.status = Well::Status::OPEN;
|
||||||
}
|
}
|
||||||
@ -85,9 +86,10 @@ void WellState::initSingleInjector(const Well& well,
|
|||||||
const double temp = inj_controls.temperature;
|
const double temp = inj_controls.temperature;
|
||||||
|
|
||||||
auto& ws = this->wells_.add(well.name(), SingleWellState{well.name(), well_info, false, pressure_first_connection, well_perf_data, pu, temp});
|
auto& ws = this->wells_.add(well.name(), SingleWellState{well.name(), well_info, false, pressure_first_connection, well_perf_data, pu, temp});
|
||||||
if ( ws.perf_data.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
// the rest of the code needs to executed even if ws.perf_data is empty
|
||||||
|
// as this does not say anything for the whole well if it is distributed.
|
||||||
|
// Hence never ever return here!
|
||||||
if (well.getStatus() == Well::Status::OPEN) {
|
if (well.getStatus() == Well::Status::OPEN) {
|
||||||
ws.status = Well::Status::OPEN;
|
ws.status = Well::Status::OPEN;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user