mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
avoid dividing by zero in updateWellStateRates()
This commit is contained in:
parent
f47cceda63
commit
5f344eef26
@ -1181,11 +1181,13 @@ namespace Opm
|
|||||||
// Set the currently-zero phase flows to be nonzero in proportion to well_q_s.
|
// Set the currently-zero phase flows to be nonzero in proportion to well_q_s.
|
||||||
const double initial_nonzero_rate = ws.surface_rates[nonzero_rate_index];
|
const double initial_nonzero_rate = ws.surface_rates[nonzero_rate_index];
|
||||||
const int comp_idx_nz = this->flowPhaseToEbosCompIdx(nonzero_rate_index);
|
const int comp_idx_nz = this->flowPhaseToEbosCompIdx(nonzero_rate_index);
|
||||||
for (int p = 0; p < this->number_of_phases_; ++p) {
|
if (std::abs(well_q_s[comp_idx_nz]) > floating_point_error_epsilon) {
|
||||||
if (p != nonzero_rate_index) {
|
for (int p = 0; p < this->number_of_phases_; ++p) {
|
||||||
const int comp_idx = this->flowPhaseToEbosCompIdx(p);
|
if (p != nonzero_rate_index) {
|
||||||
double& rate = ws.surface_rates[p];
|
const int comp_idx = this->flowPhaseToEbosCompIdx(p);
|
||||||
rate = (initial_nonzero_rate/well_q_s[comp_idx_nz]) * (well_q_s[comp_idx]);
|
double& rate = ws.surface_rates[p];
|
||||||
|
rate = (initial_nonzero_rate / well_q_s[comp_idx_nz]) * (well_q_s[comp_idx]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user