Only calculate well potentials for cases with well groups

This commit is contained in:
Tor Harald Sandve 2016-04-04 09:03:13 +02:00
parent bd81bda57b
commit e4b52a457f

View File

@ -222,7 +222,10 @@ namespace Opm
// Increment timer, remember well state. // Increment timer, remember well state.
++timer; ++timer;
prev_well_state = well_state; prev_well_state = well_state;
asImpl().computeWellPotentials(timer.currentStepNum(), wells, state, well_state, well_potentials); // Compute Well potentials (only used to determine default guide rates for group controlled wells)
if (schedule->numGroups() > 0 ) {
asImpl().computeWellPotentials(timer.currentStepNum(), wells, state, well_state, well_potentials);
}
} }
// Write final simulation state. // Write final simulation state.
@ -395,31 +398,28 @@ namespace Opm
const int nw = wells->number_of_wells; const int nw = wells->number_of_wells;
const int np = wells->number_of_phases; const int np = wells->number_of_phases;
well_potentials.clear(); well_potentials.clear();
well_potentials.resize(nw*np,0.0); well_potentials.resize(nw*np,0.0);
if( ! xw.wellMap().empty() ) for (int w = 0; w < nw; ++w) {
{ for (int perf = wells->well_connpos[w]; perf < wells->well_connpos[w + 1]; ++perf) {
for (int w = 0; w < nw; ++w) { const double well_cell_pressure = x.pressure()[wells->well_cells[perf]];
for (int perf = wells->well_connpos[w]; perf < wells->well_connpos[w + 1]; ++perf) { const double drawdown_used = well_cell_pressure - xw.perfPress()[perf];
const double well_cell_pressure = x.pressure()[wells->well_cells[perf]]; const WellControls* ctrl = wells->ctrls[w];
const double drawdown_used = well_cell_pressure - xw.perfPress()[perf]; const int nwc = well_controls_get_num(ctrl);
const WellControls* ctrl = wells->ctrls[w]; //Loop over all controls until we find a BHP control
const int nwc = well_controls_get_num(ctrl); //that specifies what we need...
//Loop over all controls until we find a BHP control double bhp = 0.0;
//that specifies what we need... for (int ctrl_index=0; ctrl_index < nwc; ++ctrl_index) {
double bhp = 0.0; if (well_controls_iget_type(ctrl, ctrl_index) == BHP) {
for (int ctrl_index=0; ctrl_index < nwc; ++ctrl_index) { bhp = well_controls_iget_target(ctrl, ctrl_index);
if (well_controls_iget_type(ctrl, ctrl_index) == BHP) {
bhp = well_controls_iget_target(ctrl, ctrl_index);
}
// TODO: do something for thp;
} }
// Calculate the pressure difference in the well perforation // TODO: do something for thp;
const double dp = xw.perfPress()[perf] - xw.bhp()[w]; }
const double drawdown_maximum = well_cell_pressure - (bhp + dp); // Calculate the pressure difference in the well perforation
const double dp = xw.perfPress()[perf] - xw.bhp()[w];
const double drawdown_maximum = well_cell_pressure - (bhp + dp);
for (int phase = 0; phase < np; ++phase) { for (int phase = 0; phase < np; ++phase) {
well_potentials[w*np + phase] += (drawdown_maximum / drawdown_used * xw.perfPhaseRates()[perf*np + phase]); well_potentials[w*np + phase] += (drawdown_maximum / drawdown_used * xw.perfPhaseRates()[perf*np + phase]);
}
} }
} }
} }