diff --git a/examples/spu_2p.cpp b/examples/spu_2p.cpp index 6bcd81ad..3ae07036 100644 --- a/examples/spu_2p.cpp +++ b/examples/spu_2p.cpp @@ -37,21 +37,13 @@ #include "config.h" #endif // HAVE_CONFIG_H -//#include -#include - -// #define EXPERIMENT_ISTL -#ifdef EXPERIMENT_ISTL -#include -#endif - #include #include -#include #include -#include +#include #include +#include #include #include #include @@ -64,6 +56,12 @@ #include #include +#include +// #define EXPERIMENT_ISTL +#ifdef EXPERIMENT_ISTL +#include +#endif + #include #include #include @@ -224,29 +222,6 @@ static void outputState(const UnstructuredGrid& grid, } } -/// Create a src vector equivalent to a wells structure. -/// For this to be valid, the wells must be all rate-controlled and -/// single-perforation. -static void wellsToSrc(const Wells& wells, const int num_cells, std::vector& src) -{ - src.resize(num_cells); - for (int w = 0; w < wells.number_of_wells; ++w) { - if (wells.ctrls[w]->num != 1) { - THROW("In wellsToSrc(): well has more than one control."); - } - if (wells.ctrls[w]->type[0] != RATE) { - THROW("In wellsToSrc(): well is BHP, not RATE."); - } - if (wells.well_connpos[w+1] - wells.well_connpos[w] != 1) { - THROW("In wellsToSrc(): well has multiple perforations."); - } - const double flow = wells.ctrls[w]->target[0]; - const double cell = wells.well_cells[wells.well_connpos[w]]; - src[cell] = (wells.type[w] == INJECTOR) ? flow : -flow; - } -} - - /// Encapsulates the watercut curves. class Watercut @@ -540,7 +515,7 @@ main(int argc, char** argv) { std::cout << "==== Scenario 0: simple wells or single-cell source and sink.\n"; if (wells->c_wells()) { - wellsToSrc(*wells->c_wells(), num_cells, src); + Opm::wellsToSrc(*wells->c_wells(), num_cells, src); } else { double flow_per_sec = 0.1*tot_porevol/Opm::unit::day; src[0] = flow_per_sec; @@ -616,7 +591,7 @@ main(int argc, char** argv) } state.initWaterOilContact(*grid->c_grid(), *props, water_oil_contact); if (wells->c_wells()) { - wellsToSrc(*wells->c_wells(), num_cells, src); + Opm::wellsToSrc(*wells->c_wells(), num_cells, src); } else { double flow_per_sec = 0.01*tot_porevol/Opm::unit::day; src[0] = flow_per_sec;