Use preferred phase of producer well to set comp_fraction.

This replaces the previous hack, that set comp_fraction to (0,1,0) always.
This commit is contained in:
Atgeirr Flø Rasmussen 2014-04-06 23:33:43 +02:00
parent 94d45c4c3d
commit db88058b34

View File

@ -762,10 +762,29 @@ namespace Opm
} }
set_current_control(well_index, cpos, w_); set_current_control(well_index, cpos, w_);
// Set well component fraction in producers to 1 for all phases. This HACK make sure volrates are nonzero for all perforations. // Set well component fraction to match preferred phase for the well.
double cf[3] = { 0, 1, 0}; double cf[3] = { 0.0, 0.0, 0.0 };
std::copy(cf, cf + phaseUsage.num_phases, w_->comp_frac + well_index*phaseUsage.num_phases); {
switch (well->getPreferredPhase()) {
case Phase::WATER:
if (!phaseUsage.phase_used[BlackoilPhases::Aqua]) {
OPM_THROW(std::runtime_error, "Water phase not used, yet found water-preferring well.");
}
cf[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0;
break;
case Phase::OIL:
if (!phaseUsage.phase_used[BlackoilPhases::Liquid]) {
OPM_THROW(std::runtime_error, "Oil phase not used, yet found oil-preferring well.");
}
cf[phaseUsage.phase_pos[BlackoilPhases::Liquid]] = 1.0;
case Phase::GAS:
if (!phaseUsage.phase_used[BlackoilPhases::Vapour]) {
OPM_THROW(std::runtime_error, "Gas phase not used, yet found gas-preferring well.");
}
cf[phaseUsage.phase_pos[BlackoilPhases::Vapour]] = 1.0;
}
std::copy(cf, cf + phaseUsage.num_phases, w_->comp_frac + well_index*phaseUsage.num_phases);
}
} }
well_index++; well_index++;
} }