refactor well controls use new well controls gourp.

This commit is contained in:
Liu Ming
2014-01-10 14:15:24 +08:00
parent 7243418cc5
commit 139bfb7e62
4 changed files with 34 additions and 21 deletions

View File

@@ -31,7 +31,7 @@
#include <opm/polymer/PolymerBlackoilState.hpp>
#include <opm/core/simulator/WellState.hpp>
#include <opm/core/utility/ErrorMacros.hpp>
#include <opm/core/well_controls.h>
#include <cassert>
#include <cmath>
#include <iostream>
@@ -590,7 +590,7 @@ namespace {
const ADB perf_mob = producer.select(subset(cell_mob, well_cells),
perf_mob_injector);
const ADB perf_flux = perf_mob * (nkgradp_well); // No gravity term for perforations.
well_perf_rates[phase] = (perf_flux*perf_b);
well_perf_rates[phase] = (perf_flux * perf_b);
const ADB well_rates = wops_.p2w * well_perf_rates[phase];
well_rates_all += superset(well_rates, Span(nw, 1, phase*nw), nw*np);
@@ -617,15 +617,18 @@ namespace {
M rate_distr(nw, np*nw);
for (int w = 0; w < nw; ++w) {
const WellControls* wc = wells_.ctrls[w];
if (wc->type[wc->current] == BHP) {
bhp_targets[w] = wc->target[wc->current];
if (well_controls_get_current_type(wc) == BHP) {
bhp_targets[w] = well_controls_get_current_target(wc);
rate_targets[w] = -1e100;
} else if (wc->type[wc->current] == SURFACE_RATE) {
} else if (well_controls_get_current_type(wc) == SURFACE_RATE) {
bhp_targets[w] = -1e100;
rate_targets[w] = wc->target[wc->current];
for (int phase = 0; phase < np; ++phase) {
rate_distr.insert(w, phase*nw + w) = wc->distr[phase];
}
rate_targets[w] = well_controls_get_current_target(wc);
{
const double* distr = well_controls_get_current_distr(wc);
for (int phase = 0; phase < np; ++phase) {
rate_distr.insert(w, phase*nw + w) = distr[phase];
}
}
} else {
OPM_THROW(std::runtime_error, "Can only handle BHP and SURFACE_RATE type controls.");
}