dont scale d factor from wdfaccor

This commit is contained in:
Tor Harald Sandve 2023-11-20 11:22:06 +01:00
parent b00d3ca4bb
commit ecd9930225

View File

@ -1368,8 +1368,10 @@ namespace Opm
} }
auto& perf_data = ws.perf_data; auto& perf_data = ws.perf_data;
double tot_tw = 0.0; double tot_tw = 0.0;
for (const auto& c : this->well_ecl_.getConnections()) { if (wdfac.getType() == WDFACTYPE::CON_DFACTOR || wdfac.getType() == WDFACTYPE::DFACTOR) {
tot_tw += c.CF(); for (const auto& c : this->well_ecl_.getConnections()) {
tot_tw += c.CF();
}
} }
for (int perf = 0; perf < this->number_of_perforations_; ++perf) { for (int perf = 0; perf < this->number_of_perforations_; ++perf) {
const int cell_idx = this->well_cells_[perf]; const int cell_idx = this->well_cells_[perf];
@ -1398,18 +1400,19 @@ namespace Opm
double h = Kh / Ke; double h = Kh / Ke;
double rw = connection.rw(); double rw = connection.rw();
const auto& wdfac = this->well_ecl_.getWDFAC(); const auto& wdfac = this->well_ecl_.getWDFAC();
if (wdfac.useConnectionDFactor()) { if (wdfac.getType() == WDFACTYPE::CON_DFACTOR) {
double d = connection.dFactor(); double d = connection.dFactor();
// If a negative d factor is set in COMPDAT individual connection d factors should be used directly. // If a negative d factor is set in COMPDAT individual connection d factors should be used directly.
if (d < 0) if (d < 0)
return -d; return -d;
// If a positive d factor is set in COMPDAT the connection d factors is treated like a well d factor. // If a positive d factor is set in COMPDAT the connection d factors is treated like a well d factor.
// and thus scaled with the well index // and thus scaled with the connection index
return d * total_tw / connection.CF();
} else {
double d = wdfac.getDFactor(rho, mu, Ke, phi, rw, h);
return d * total_tw / connection.CF(); return d * total_tw / connection.CF();
} else if (wdfac.getType() == WDFACTYPE::DFACTOR) {
// scale with the connection index
return wdfac.getDFactor(rho, mu, Ke, phi, rw, h) * total_tw / connection.CF();
} else { // WDFACCOR
return wdfac.getDFactor(rho, mu, Ke, phi, rw, h);
} }
} }