Added computations for total flow for each well

This commit is contained in:
Kjetil Olsen Lye 2012-04-13 14:22:44 +02:00
parent f8b3a8c3f9
commit c9a866fce0
3 changed files with 22 additions and 2 deletions

View File

@ -73,9 +73,12 @@ int main(int argc, char** argv) {
std::vector<double> face_flux;
std::vector<double> well_bhp;
std::vector<double> well_rate;
pressure_solver.solve(totmob, omega, src, wdp, bcs.c_bcs(), pressure, face_flux, well_bhp, well_rate);
std::vector<double> well_rate_per_cell;
pressure_solver.solve(totmob, omega, src, wdp, bcs.c_bcs(), pressure, face_flux, well_bhp, well_rate_per_cell);
std::cout << "Solved" << std::endl;
std::vector<double> well_rate;
computeFlowRatePerWell(*wells.c_wells(), well_rate_per_cell, well_rate);
if(wells.wellCollection().conditionsMet(well_bhp, well_rate, *grid.c_grid(), state.saturation() )) {
std::cout << "Conditions met for wells!" << std::endl;
}

View File

@ -437,6 +437,20 @@ namespace Opm
}
}
}
void computeFlowRatePerWell(const Wells& wells, const std::vector<double>& flow_rates_per_cell,
std::vector<double>& flow_rates_per_well)
{
int index_in_flow_rates = 0;
for(int w = 0; w < wells.number_of_wells; w++) {
int number_of_cells = wells.well_connpos[w+1]-wells.well_connpos[w];
double flow_sum = 0.0;
for(int i = 0; i < number_of_cells; i++) {
flow_sum += flow_rates_per_cell[index_in_flow_rates++];
}
flow_rates_per_well.push_back(flow_sum);
}
}
} // namespace Opm

View File

@ -180,6 +180,9 @@ namespace Opm
void computeWDP(const Wells& wells, const UnstructuredGrid& grid, const std::vector<double>& saturations,
const std::vector<double>& densities, std::vector<double>& wdp);
void computeFlowRatePerWell(const Wells& wells, const std::vector<double>& flow_rates_per_cell,
std::vector<double>& flow_rates_per_well);
/// Encapsulates the watercut curves.
class Watercut
{