Fix well classification that was only correct by accident

Specifically, the tests

   if (!wells->type[self_index] == INJECTOR)
   if (!wells->type[self_index] == PRODUCER)

produced the expected results *only* because INJECTOR==0 and PRODUCER==1
in the WellType enumeration, thus (!INJECTOR == PRODUCER) and
(!PRODUCER == INJECTOR).

Installing the (much) more appropriate

    if (wells->type[self_index] != INJECTOR)
    if (wells->type[self_index] != PRODUCER)

is not only more readable, it is also future-proof and scales better if
we ever introduce new WellTypes (e.g., a MONITOR).
This commit is contained in:
Bård Skaflestad 2012-10-24 21:12:29 +02:00
parent d8dd982408
commit 0c599b8868

View File

@ -794,7 +794,7 @@ namespace Opm
&& (injSpec().control_mode_ != InjectionSpecification::GRUP && injSpec().control_mode_ != InjectionSpecification::NONE)) {
return;
}
if (!wells_->type[self_index_] == INJECTOR) {
if (wells_->type[self_index_] != INJECTOR) {
ASSERT(target == 0.0);
return;
}
@ -871,7 +871,7 @@ namespace Opm
std::cout << "Returning" << std::endl;
return;
}
if (!wells_->type[self_index_] == PRODUCER) {
if (wells_->type[self_index_] != PRODUCER) {
ASSERT(target == 0.0);
return;
}