Started work on supporting 3 phases for wellreport.

This commit is contained in:
Halvor Møll Nilsen 2012-08-27 12:22:32 +02:00
parent ea09af47f4
commit a6dcc52cba

View File

@ -574,9 +574,10 @@ namespace Opm
{ {
int nw = well_bhp.size(); int nw = well_bhp.size();
ASSERT(nw == wells.number_of_wells); ASSERT(nw == wells.number_of_wells);
if (props.numPhases() != 2) { int np = props.numPhases();
THROW("WellReport for now assumes two phase flow."); //if (props.numPhases() != 2) {
} // THROW("WellReport for now assumes two phase flow.");
//}
const double* visc = props.viscosity(); const double* visc = props.viscosity();
std::vector<double> data_now; std::vector<double> data_now;
data_now.reserve(1 + 3*nw); data_now.reserve(1 + 3*nw);
@ -586,7 +587,8 @@ namespace Opm
double well_rate_total = 0.0; double well_rate_total = 0.0;
double well_rate_water = 0.0; double well_rate_water = 0.0;
for (int perf = wells.well_connpos[w]; perf < wells.well_connpos[w + 1]; ++perf) { for (int perf = wells.well_connpos[w]; perf < wells.well_connpos[w + 1]; ++perf) {
const double perf_rate = well_perfrates[perf]*(unit::day/unit::second); const double perf_rate = unit::convert::to(well_perfrates[perf],
unit::cubic(unit::meter)/unit::day);
well_rate_total += perf_rate; well_rate_total += perf_rate;
if (perf_rate > 0.0) { if (perf_rate > 0.0) {
// Injection. // Injection.
@ -594,11 +596,14 @@ namespace Opm
} else { } else {
// Production. // Production.
const int cell = wells.well_cells[perf]; const int cell = wells.well_cells[perf];
double mob[2]; double mob[np];
props.relperm(1, &saturation[2*cell], &cell, mob, 0); props.relperm(1, &saturation[2*cell], &cell, mob, 0);
mob[0] /= visc[0]; double tmob=0;
mob[1] /= visc[1]; for(int i=0; i < np; ++i){
const double fracflow = mob[0]/(mob[0] + mob[1]); mob[i] /= visc[i];
tmob += mob[i];
}
const double fracflow = mob[0]/tmob;
well_rate_water += perf_rate*fracflow; well_rate_water += perf_rate*fracflow;
} }
} }
@ -627,9 +632,10 @@ namespace Opm
// TODO: refactor, since this is almost identical to the other push(). // TODO: refactor, since this is almost identical to the other push().
int nw = well_bhp.size(); int nw = well_bhp.size();
ASSERT(nw == wells.number_of_wells); ASSERT(nw == wells.number_of_wells);
if (props.numPhases() != 2) { int np = props.numPhases();
THROW("WellReport for now assumes two phase flow."); //if (props.numPhases() != 2) {
} // THROW("WellReport for now assumes two phase flow.");
//}
std::vector<double> data_now; std::vector<double> data_now;
data_now.reserve(1 + 3*nw); data_now.reserve(1 + 3*nw);
data_now.push_back(time/unit::day); data_now.push_back(time/unit::day);
@ -646,14 +652,19 @@ namespace Opm
} else { } else {
// Production. // Production.
const int cell = wells.well_cells[perf]; const int cell = wells.well_cells[perf];
double mob[2]; double mob[np];
props.relperm(1, &s[2*cell], &cell, mob, 0); props.relperm(1, &s[2*cell], &cell, mob, 0);
double visc[2]; double visc[np];
props.viscosity(1, &p[cell], &z[2*cell], &cell, visc, 0); props.viscosity(1, &p[cell], &z[2*cell], &cell, visc, 0);
mob[0] /= visc[0]; double tmob=0;
mob[1] /= visc[1]; for(int i=0; i < np; ++i){
const double fracflow = mob[0]/(mob[0] + mob[1]); mob[i] /= visc[i];
tmob += mob[i];
}
const double fracflow = mob[0]/(tmob);
well_rate_water += perf_rate*fracflow; well_rate_water += perf_rate*fracflow;
//const double fracflow = mob[0]/(tmob);
//well_rate_water += perf_rate*fracflow;
} }
} }
data_now.push_back(well_rate_total); data_now.push_back(well_rate_total);