Merge pull request #4110 from GitPaean/avoiding_overshoot_primary_variables

avoiding wrong sign for QTotal primary variable for top segment
This commit is contained in:
Tor Harald Sandve 2022-09-15 08:13:03 +02:00 committed by GitHub
commit fe19d94b4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -463,6 +463,13 @@ updatePrimaryVariables(const WellState& well_state) const
total_seg_rate += baseif_.scalingFactor(p) * segment_rates[baseif_.numPhases() * seg + p];
}
if (seg == 0) {
if (baseif_.isInjector()) {
total_seg_rate = std::max(total_seg_rate, 0.);
} else {
total_seg_rate = std::min(total_seg_rate, 0.);
}
}
primary_variables_[seg][GTotal] = total_seg_rate;
if (std::abs(total_seg_rate) > 0.) {
if (has_wfrac_variable) {