Avoid getting distr when current control index is -1.

This commit is contained in:
Atgeirr Flø Rasmussen 2019-08-13 10:14:37 +02:00
parent ffeb1529e8
commit f5070c6ba9
2 changed files with 3 additions and 4 deletions

View File

@ -2508,7 +2508,6 @@ namespace Opm
const WellControls* wc = well_controls_; const WellControls* wc = well_controls_;
const double* distr = well_controls_get_current_distr(wc);
const auto pu = phaseUsage(); const auto pu = phaseUsage();
if(std::abs(total_well_rate) > 0.) { if(std::abs(total_well_rate) > 0.) {
@ -2525,7 +2524,7 @@ namespace Opm
if (well_type_ == INJECTOR) { if (well_type_ == INJECTOR) {
// only single phase injection handled // only single phase injection handled
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
if (distr[Water] > 0.0) { if (well_ecl_.getPreferredPhase() == Phase::WATER) {
primary_variables_[WFrac] = 1.0; primary_variables_[WFrac] = 1.0;
} else { } else {
primary_variables_[WFrac] = 0.0; primary_variables_[WFrac] = 0.0;
@ -2533,7 +2532,7 @@ namespace Opm
} }
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
if (distr[pu.phase_pos[Gas]] > 0.0) { if (well_ecl_.getPreferredPhase() == Phase::GAS) {
primary_variables_[GFrac] = 1.0 - wsolvent(); primary_variables_[GFrac] = 1.0 - wsolvent();
if (has_solvent) { if (has_solvent) {
primary_variables_[SFrac] = wsolvent(); primary_variables_[SFrac] = wsolvent();

View File

@ -1205,7 +1205,6 @@ namespace Opm
WellInterface<TypeTag>::scalingFactor(const int phaseIdx) const WellInterface<TypeTag>::scalingFactor(const int phaseIdx) const
{ {
const WellControls* wc = well_controls_; const WellControls* wc = well_controls_;
const double* distr = well_controls_get_current_distr(wc);
if (well_controls_get_current(wc) != -1 && well_controls_get_current_type(wc) == RESERVOIR_RATE) { if (well_controls_get_current(wc) != -1 && well_controls_get_current_type(wc) == RESERVOIR_RATE) {
if (has_solvent && phaseIdx == contiSolventEqIdx ) { if (has_solvent && phaseIdx == contiSolventEqIdx ) {
@ -1215,6 +1214,7 @@ namespace Opm
return coeff; return coeff;
} }
// TODO: use the rateConverter here as well. // TODO: use the rateConverter here as well.
const double* distr = well_controls_get_current_distr(wc);
return distr[phaseIdx]; return distr[phaseIdx];
} }
const auto& pu = phaseUsage(); const auto& pu = phaseUsage();