From 4049426ec9ca3e6a8ca2e04d31c9e9c0ae591bb2 Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Tue, 28 Jan 2014 21:11:51 +0100 Subject: [PATCH 1/6] Updated Namespace of PhaseEnum from opm-parser --- opm/core/props/phaseUsageFromDeck.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/core/props/phaseUsageFromDeck.hpp b/opm/core/props/phaseUsageFromDeck.hpp index e69d6ee2f..d022dcc41 100644 --- a/opm/core/props/phaseUsageFromDeck.hpp +++ b/opm/core/props/phaseUsageFromDeck.hpp @@ -39,13 +39,13 @@ namespace Opm std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0); // Discover phase usage. - if (eclipseState->hasPhase(PhaseEnum::WATER)) { + if (eclipseState->hasPhase(Phase::PhaseEnum::WATER)) { pu.phase_used[BlackoilPhases::Aqua] = 1; } - if (eclipseState->hasPhase(PhaseEnum::OIL)) { + if (eclipseState->hasPhase(Phase::PhaseEnum::OIL)) { pu.phase_used[BlackoilPhases::Liquid] = 1; } - if (eclipseState->hasPhase(PhaseEnum::GAS)) { + if (eclipseState->hasPhase(Phase::PhaseEnum::GAS)) { pu.phase_used[BlackoilPhases::Vapour] = 1; } pu.num_phases = 0; From 74c3040c43c67d7cdba1282cb3df1bb63ee520a9 Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Mon, 27 Jan 2014 13:45:59 +0100 Subject: [PATCH 2/6] Added an extra data file with an extra well --- tests/test_wellsmanager.cpp | 58 ++++++++++++++++----- tests/wells_manager_data_expanded.data | 72 ++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 13 deletions(-) create mode 100755 tests/wells_manager_data_expanded.data diff --git a/tests/test_wellsmanager.cpp b/tests/test_wellsmanager.cpp index 3bf36eae3..25c9678a1 100644 --- a/tests/test_wellsmanager.cpp +++ b/tests/test_wellsmanager.cpp @@ -174,8 +174,6 @@ void check_controls_epoch1( struct WellControls ** ctrls) { } - - BOOST_AUTO_TEST_CASE(Constructor_Works) { Opm::EclipseGridParser Deck("wells_manager_data.data"); Opm::GridManager gridManager(Deck); @@ -194,7 +192,7 @@ BOOST_AUTO_TEST_CASE(Constructor_Works) { Opm::WellsManager wellsManager(Deck, *gridManager.c_grid(), NULL); const Wells* wells = wellsManager.c_wells(); - wells_static_check( wells ); + wells_static_check( wells ); check_controls_epoch1( wells->ctrls ); } } @@ -212,11 +210,15 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works) { Opm::WellsManager wellsManager(eclipseState, 0, Deck, *gridManager.c_grid(), NULL); Opm::WellsManager oldWellsManager(Deck, *gridManager.c_grid(), NULL); - const Wells* wells = wellsManager.c_wells(); - wells_static_check( wells ); - check_controls_epoch0( wells->ctrls ); + std::cout << "Checking new well structure, epoch 0" << std::endl; + wells_static_check( wellsManager.c_wells() ); - BOOST_CHECK(wells_equal(wells, oldWellsManager.c_wells())); + std::cout << "Checking old well structure, epoch 0" << std::endl; + wells_static_check( oldWellsManager.c_wells() ); + + check_controls_epoch0( wellsManager.c_wells()->ctrls ); + + BOOST_CHECK(wells_equal(wellsManager.c_wells(), oldWellsManager.c_wells())); } Deck.setCurrentEpoch(1); @@ -224,11 +226,41 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works) { Opm::WellsManager wellsManager(eclipseState, 1,Deck, *gridManager.c_grid(), NULL); Opm::WellsManager oldWellsManager(Deck, *gridManager.c_grid(), NULL); - const Wells* wells = wellsManager.c_wells(); - wells_static_check( wells ); - check_controls_epoch1( wells->ctrls ); + std::cout << "Checking new well structure, epoch 1" << std::endl; + wells_static_check( wellsManager.c_wells() ); - BOOST_CHECK(wells_equal(wells, oldWellsManager.c_wells())); + std::cout << "Checking old well structure, epoch 1" << std::endl; + wells_static_check( oldWellsManager.c_wells() ); + + check_controls_epoch1( wellsManager.c_wells()->ctrls ); + + BOOST_CHECK(wells_equal( wellsManager.c_wells(), oldWellsManager.c_wells())); + } +} + + +BOOST_AUTO_TEST_CASE(New_Constructor_Works_ExpandedData) { + + Opm::ParserPtr parser(new Opm::Parser()); + Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(parser->parseFile("wells_manager_data_expanded.data"))); + + Opm::EclipseGridParser Deck("wells_manager_data_expanded.data"); + Opm::GridManager gridManager(Deck); + + Deck.setCurrentEpoch(0); + { + Opm::WellsManager wellsManager(eclipseState, 0, Deck, *gridManager.c_grid(), NULL); + Opm::WellsManager oldWellsManager(Deck, *gridManager.c_grid(), NULL); + + BOOST_CHECK(wells_equal(wellsManager.c_wells(), oldWellsManager.c_wells())); + } + + Deck.setCurrentEpoch(1); + { + Opm::WellsManager wellsManager(eclipseState, 1,Deck, *gridManager.c_grid(), NULL); + Opm::WellsManager oldWellsManager(Deck, *gridManager.c_grid(), NULL); + + BOOST_CHECK(wells_equal( wellsManager.c_wells(), oldWellsManager.c_wells())); } } @@ -244,8 +276,8 @@ BOOST_AUTO_TEST_CASE(WellsEqual) { Deck.setCurrentEpoch(1); Opm::WellsManager wellsManager1(Deck, *gridManager.c_grid(), NULL); - BOOST_CHECK( wells_equal( wellsManager0.c_wells() , wellsManager0.c_wells()) ); - BOOST_CHECK( !wells_equal( wellsManager0.c_wells() , wellsManager1.c_wells()) ); + BOOST_CHECK( wells_equal( wellsManager0.c_wells() , wellsManager0.c_wells()) ); + BOOST_CHECK( !wells_equal( wellsManager0.c_wells() , wellsManager1.c_wells()) ); } diff --git a/tests/wells_manager_data_expanded.data b/tests/wells_manager_data_expanded.data new file mode 100755 index 000000000..dfcd0b48e --- /dev/null +++ b/tests/wells_manager_data_expanded.data @@ -0,0 +1,72 @@ +OIL +GAS +WATER + +DIMENS + 10 10 5 / + +GRID + +DXV +10*1000.0 / + +DYV +10*1000.0 / + +DZV +10.0 20.0 30.0 10.0 5.0 / + +SCHEDULE + +WELSPECS + 'INJ1' 'G' 1 1 8335 'GAS' / + 'PROD1' 'G' 10 10 8400 'OIL' / +/ + +COMPDAT + 'INJ1' 1 1 1 2 'OPEN' 1 10.6092 0.5 / + 'INJ1' 1 1 3 5 'OPEN' 1 12.6092 0.5 / + 'INJ1' 1 1 2* 'OPEN' 1 14.6092 0.5 / + 'PROD1' 10 3 3 3 'OPEN' 0 10.6092 0.5 / +/ + +WCONPROD + 'PROD1' 'OPEN' 'ORAT' 20000 4* 1000 / +/ + +WCONINJE + 'INJ1' 'GAS' 'OPEN' 'RATE' 100 200 400 / +/ + + +DATES + 1 'FEB' 2000 / +/ + +WELSPECS + 'INJ1' 'G3' 1 1 8335 'GAS' / + 'QNJ2' 'G3' 1 1 8335 'GAS' / +/ + + +COMPDAT + 'QNJ2' 3 4 1 2 'OPEN' 1 10.6092 0.5 / + 'QNJ2' 4 4 3 5 'OPEN' 1 12.6092 0.5 / +/ + +WCONPROD + 'PROD1' 'OPEN' 'RESV' 999 3* 123 100 / +/ + +WCONINJE + 'INJ1' 'WATER' 'OPEN' 'RESV' 10 20 40 / + 'QNJ2' 'WATER' 'OPEN' 'RESV' 7 33 39 / +/ + + + +TSTEP +14.0 + / + +END From 7ce9cb9055048338d5b29b8919511a65405d6c39 Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Tue, 28 Jan 2014 21:02:47 +0100 Subject: [PATCH 3/6] Compdat extraction from new CompletionXXX classes --- opm/core/wells/WellsManager.cpp | 245 +++++++++++++++---------- opm/core/wells/WellsManager.hpp | 2 +- tests/wells_manager_data_expanded.data | 2 +- 3 files changed, 145 insertions(+), 104 deletions(-) diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index 81a3f1c66..a03e3cc53 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -253,6 +253,24 @@ namespace Opm return; } + // global_cell is a map from compressed cells to Cartesian grid cells. + // We must make the inverse lookup. + const int* global_cell = grid.global_cell; + const int* cpgdim = grid.cartdims; + std::map cartesian_to_compressed; + + if (global_cell) { + for (int i = 0; i < grid.number_of_cells; ++i) { + cartesian_to_compressed.insert(std::make_pair(global_cell[i], i)); + } + } + else { + for (int i = 0; i < grid.number_of_cells; ++i) { + cartesian_to_compressed.insert(std::make_pair(i, i)); + } + } + + // Obtain phase usage data. PhaseUsage pu = phaseUsageFromDeck(eclipseState); @@ -273,123 +291,146 @@ namespace Opm std::vector wells = schedule->getWells(timeStep); well_names.reserve(wells.size()); well_data.reserve(wells.size()); + wellperf_data.resize(wells.size()); int well_index = 0; for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) { WellConstPtr well = (*wellIter); - well_names_to_index[well->name()] = well_index; - well_names.push_back(well->name()); - { - WellData wd; - // If negative (defaulted), set refdepth to a marker - // value, will be changed after getting perforation - // data to the centroid of the cell of the top well - // perforation. - wd.reference_bhp_depth = (well->getRefDepth() < 0.0) ? -1e100 : well->getRefDepth(); - wd.welspecsline = -1; - well_data.push_back(wd); + { // WELSPECS handling + well_names_to_index[well->name()] = well_index; + well_names.push_back(well->name()); + { + WellData wd; + // If negative (defaulted), set refdepth to a marker + // value, will be changed after getting perforation + // data to the centroid of the cell of the top well + // perforation. + wd.reference_bhp_depth = (well->getRefDepth() < 0.0) ? -1e100 : well->getRefDepth(); + wd.welspecsline = -1; + well_data.push_back(wd); + } + } + + { // COMPDAT handling + CompletionSetConstPtr completionSet = well->getCompletions(timeStep); + for (size_t c=0; csize(); c++) { + CompletionConstPtr completion = completionSet->get(c); + int i = completion->getI() - 1; + int j = completion->getJ() - 1; + int k = completion->getK() - 1; + int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k); + std::map::const_iterator cgit = cartesian_to_compressed.find(cart_grid_indx); + if (cgit == cartesian_to_compressed.end()) { + OPM_THROW(std::runtime_error, "Cell with i,j,k indices " << i << ' ' << j << ' ' + << k << " not found in grid (well = " << well->name() << ')'); + } + int cell = cgit->second; + PerfData pd; + pd.cell = cell; + if (completion->getCF() > 0.0) { + pd.well_index = completion->getCF(); + } else { + double radius = 0.5*completion->getDiameter(); + if (radius <= 0.0) { + radius = 0.5*unit::feet; + OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius); + } + std::array cubical = getCubeDim(grid, cell); + const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell]; + pd.well_index = computeWellIndex(radius, cubical, cell_perm, + completion->getDiameter()); + } + wellperf_data[well_index].push_back(pd); + } } well_index++; } - const int num_wells = well_data.size(); - wellperf_data.resize(num_wells); - // global_cell is a map from compressed cells to Cartesian grid cells. - // We must make the inverse lookup. - const int* global_cell = grid.global_cell; - const int* cpgdim = grid.cartdims; - std::map cartesian_to_compressed; - if (global_cell) { - for (int i = 0; i < grid.number_of_cells; ++i) { - cartesian_to_compressed.insert(std::make_pair(global_cell[i], i)); - } - } - else { - for (int i = 0; i < grid.number_of_cells; ++i) { - cartesian_to_compressed.insert(std::make_pair(i, i)); - } - } - // Get COMPDAT data - // It is *not* allowed to have multiple lines corresponding to - // the same perforation! - const COMPDAT& compdat = deck.getCOMPDAT(); - const int num_compdat = compdat.compdat.size(); - for (int kw = 0; kw < num_compdat; ++kw) { - // Extract well name, or the part of the well name that - // comes before the '*'. - std::string name = compdat.compdat[kw].well_; - std::string::size_type len = name.find('*'); - if (len != std::string::npos) { - name = name.substr(0, len); - } - // Look for well with matching name. - bool found = false; - for (int wix = 0; wix < num_wells; ++wix) { - if (well_names[wix].compare(0,len, name) == 0) { // equal - // We have a matching name. - int ix = compdat.compdat[kw].grid_ind_[0] - 1; - int jy = compdat.compdat[kw].grid_ind_[1] - 1; - int kz1 = compdat.compdat[kw].grid_ind_[2] - 1; - int kz2 = compdat.compdat[kw].grid_ind_[3] - 1; - WellConstPtr well = schedule->getWell(well_names[wix]); - if (ix < 0) { - // Defaulted I location. Extract from WELSPECS. - ix = well->getHeadI() - 1; - } - if (jy < 0) { - // Defaulted J location. Extract from WELSPECS. - jy = well->getHeadJ() - 1; - } - if (kz1 < 0) { - // Defaulted KZ1. Use top layer. - kz1 = 0; - } - if (kz2 < 0) { - // Defaulted KZ2. Use bottom layer. - kz2 = cpgdim[2] - 1; - } +// // Get COMPDAT data +// // It is *not* allowed to have multiple lines corresponding to +// // the same perforation! +// const COMPDAT& compdat = deck.getCOMPDAT(); +// const int num_compdat = compdat.compdat.size(); +// for (int kw = 0; kw < num_compdat; ++kw) { +// // Extract well name, or the part of the well name that +// // comes before the '*'. +// std::string name = compdat.compdat[kw].well_; +// std::string::size_type len = name.find('*'); +// if (len != std::string::npos) { +// name = name.substr(0, len); +// } +// // Look for well with matching name. +// bool found = false; +// for (int wix = 0; wix < num_wells; ++wix) { +// if (well_names[wix].compare(0,len, name) == 0) { // equal +// // We have a matching name. +// int ix = compdat.compdat[kw].grid_ind_[0] - 1; +// int jy = compdat.compdat[kw].grid_ind_[1] - 1; +// int kz1 = compdat.compdat[kw].grid_ind_[2] - 1; +// int kz2 = compdat.compdat[kw].grid_ind_[3] - 1; - for (int kz = kz1; kz <= kz2; ++kz) { - int cart_grid_indx = ix + cpgdim[0]*(jy + cpgdim[1]*kz); - std::map::const_iterator cgit = - cartesian_to_compressed.find(cart_grid_indx); - if (cgit == cartesian_to_compressed.end()) { - OPM_THROW(std::runtime_error, "Cell with i,j,k indices " << ix << ' ' << jy << ' ' - << kz << " not found in grid (well = " << name << ')'); - } - int cell = cgit->second; - PerfData pd; - pd.cell = cell; - if (compdat.compdat[kw].connect_trans_fac_ > 0.0) { - pd.well_index = compdat.compdat[kw].connect_trans_fac_; - } else { - double radius = 0.5*compdat.compdat[kw].diameter_; - if (radius <= 0.0) { - radius = 0.5*unit::feet; - OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius); - } - std::array cubical = getCubeDim(grid, cell); - const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell]; - pd.well_index = computeWellIndex(radius, cubical, cell_perm, - compdat.compdat[kw].skin_factor_); - } - wellperf_data[wix].push_back(pd); - } - found = true; - break; - } - } - if (!found) { - OPM_THROW(std::runtime_error, "Undefined well name: " << compdat.compdat[kw].well_ - << " in COMPDAT"); - } - } +// WellConstPtr well = schedule->getWell(well_names[wix]); +// if (ix < 0) { +// // Defaulted I location. Extract from WELSPECS. +// ix = well->getHeadI() - 1; +// } +// if (jy < 0) { +// // Defaulted J location. Extract from WELSPECS. +// jy = well->getHeadJ() - 1; +// } +// if (kz1 < 0) { +// // Defaulted KZ1. Use top layer. +// kz1 = 0; +// } +// if (kz2 < 0) { +// // Defaulted KZ2. Use bottom layer. +// kz2 = cpgdim[2] - 1; +// } + +// for (int kz = kz1; kz <= kz2; ++kz) { +// int cart_grid_indx = ix + cpgdim[0]*(jy + cpgdim[1]*kz); +// std::map::const_iterator cgit = +// cartesian_to_compressed.find(cart_grid_indx); +// if (cgit == cartesian_to_compressed.end()) { +// OPM_THROW(std::runtime_error, "Cell with i,j,k indices " << ix << ' ' << jy << ' ' +// << kz << " not found in grid (well = " << name << ')'); +// } +// int cell = cgit->second; +// PerfData pd; +// pd.cell = cell; +// if (compdat.compdat[kw].connect_trans_fac_ > 0.0) { +// pd.well_index = compdat.compdat[kw].connect_trans_fac_; +// } else { +// double radius = 0.5*compdat.compdat[kw].diameter_; +// if (radius <= 0.0) { +// radius = 0.5*unit::feet; +// OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius); +// } +// std::array cubical = getCubeDim(grid, cell); +// const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell]; +// pd.well_index = computeWellIndex(radius, cubical, cell_perm, +// compdat.compdat[kw].skin_factor_); +// } +// wellperf_data[wix].push_back(pd); +// } +// found = true; +// break; +// } +// } +// if (!found) { +// OPM_THROW(std::runtime_error, "Undefined well name: " << compdat.compdat[kw].well_ +// << " in COMPDAT"); +// } +// } // Set up reference depths that were defaulted. Count perfs. + + const int num_wells = well_data.size(); + int num_perfs = 0; assert(grid.dimensions == 3); for (int w = 0; w < num_wells; ++w) { diff --git a/opm/core/wells/WellsManager.hpp b/opm/core/wells/WellsManager.hpp index f14be7946..145fb2e25 100644 --- a/opm/core/wells/WellsManager.hpp +++ b/opm/core/wells/WellsManager.hpp @@ -124,7 +124,7 @@ namespace Opm // Data Wells* w_; - WellCollection well_collection_; + WellCollection well_collection_; diff --git a/tests/wells_manager_data_expanded.data b/tests/wells_manager_data_expanded.data index dfcd0b48e..3d97003ae 100755 --- a/tests/wells_manager_data_expanded.data +++ b/tests/wells_manager_data_expanded.data @@ -26,7 +26,7 @@ WELSPECS COMPDAT 'INJ1' 1 1 1 2 'OPEN' 1 10.6092 0.5 / 'INJ1' 1 1 3 5 'OPEN' 1 12.6092 0.5 / - 'INJ1' 1 1 2* 'OPEN' 1 14.6092 0.5 / + 'INJ1' 1 1 1 1 'OPEN' 1 14.6092 0.5 / 'PROD1' 10 3 3 3 'OPEN' 0 10.6092 0.5 / / From 0d492ce407ddb28981b980a71a9c26115ef77ed7 Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Wed, 29 Jan 2014 10:32:17 +0100 Subject: [PATCH 4/6] Changed data file not not have same perforation multiple times, as the old system doesn't support this --- tests/wells_manager_data_expanded.data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wells_manager_data_expanded.data b/tests/wells_manager_data_expanded.data index 3d97003ae..d025d6278 100755 --- a/tests/wells_manager_data_expanded.data +++ b/tests/wells_manager_data_expanded.data @@ -26,7 +26,7 @@ WELSPECS COMPDAT 'INJ1' 1 1 1 2 'OPEN' 1 10.6092 0.5 / 'INJ1' 1 1 3 5 'OPEN' 1 12.6092 0.5 / - 'INJ1' 1 1 1 1 'OPEN' 1 14.6092 0.5 / + 'INJ1' 2 2 1 1 'OPEN' 1 14.6092 0.5 / 'PROD1' 10 3 3 3 'OPEN' 0 10.6092 0.5 / / From fbe2f316530a83fad28803c0e993dd43977a85b3 Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Wed, 29 Jan 2014 11:57:45 +0100 Subject: [PATCH 5/6] Updated COMPDAT i,j,k indices, and removed the old commented part --- opm/core/wells/WellsManager.cpp | 92 +++------------------------------ tests/test_wellsmanager.cpp | 14 ++--- 2 files changed, 13 insertions(+), 93 deletions(-) diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index a03e3cc53..63d868cf6 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -315,9 +315,9 @@ namespace Opm CompletionSetConstPtr completionSet = well->getCompletions(timeStep); for (size_t c=0; csize(); c++) { CompletionConstPtr completion = completionSet->get(c); - int i = completion->getI() - 1; - int j = completion->getJ() - 1; - int k = completion->getK() - 1; + int i = completion->getI(); + int j = completion->getJ(); + int k = completion->getK(); int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k); std::map::const_iterator cgit = cartesian_to_compressed.find(cart_grid_indx); if (cgit == cartesian_to_compressed.end()) { @@ -337,8 +337,7 @@ namespace Opm } std::array cubical = getCubeDim(grid, cell); const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell]; - pd.well_index = computeWellIndex(radius, cubical, cell_perm, - completion->getDiameter()); + pd.well_index = computeWellIndex(radius, cubical, cell_perm, completion->getDiameter()); } wellperf_data[well_index].push_back(pd); } @@ -346,87 +345,6 @@ namespace Opm well_index++; } - - - - -// // Get COMPDAT data -// // It is *not* allowed to have multiple lines corresponding to -// // the same perforation! -// const COMPDAT& compdat = deck.getCOMPDAT(); -// const int num_compdat = compdat.compdat.size(); -// for (int kw = 0; kw < num_compdat; ++kw) { -// // Extract well name, or the part of the well name that -// // comes before the '*'. -// std::string name = compdat.compdat[kw].well_; -// std::string::size_type len = name.find('*'); -// if (len != std::string::npos) { -// name = name.substr(0, len); -// } -// // Look for well with matching name. -// bool found = false; -// for (int wix = 0; wix < num_wells; ++wix) { -// if (well_names[wix].compare(0,len, name) == 0) { // equal -// // We have a matching name. -// int ix = compdat.compdat[kw].grid_ind_[0] - 1; -// int jy = compdat.compdat[kw].grid_ind_[1] - 1; -// int kz1 = compdat.compdat[kw].grid_ind_[2] - 1; -// int kz2 = compdat.compdat[kw].grid_ind_[3] - 1; - -// WellConstPtr well = schedule->getWell(well_names[wix]); -// if (ix < 0) { -// // Defaulted I location. Extract from WELSPECS. -// ix = well->getHeadI() - 1; -// } -// if (jy < 0) { -// // Defaulted J location. Extract from WELSPECS. -// jy = well->getHeadJ() - 1; -// } -// if (kz1 < 0) { -// // Defaulted KZ1. Use top layer. -// kz1 = 0; -// } -// if (kz2 < 0) { -// // Defaulted KZ2. Use bottom layer. -// kz2 = cpgdim[2] - 1; -// } - -// for (int kz = kz1; kz <= kz2; ++kz) { -// int cart_grid_indx = ix + cpgdim[0]*(jy + cpgdim[1]*kz); -// std::map::const_iterator cgit = -// cartesian_to_compressed.find(cart_grid_indx); -// if (cgit == cartesian_to_compressed.end()) { -// OPM_THROW(std::runtime_error, "Cell with i,j,k indices " << ix << ' ' << jy << ' ' -// << kz << " not found in grid (well = " << name << ')'); -// } -// int cell = cgit->second; -// PerfData pd; -// pd.cell = cell; -// if (compdat.compdat[kw].connect_trans_fac_ > 0.0) { -// pd.well_index = compdat.compdat[kw].connect_trans_fac_; -// } else { -// double radius = 0.5*compdat.compdat[kw].diameter_; -// if (radius <= 0.0) { -// radius = 0.5*unit::feet; -// OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius); -// } -// std::array cubical = getCubeDim(grid, cell); -// const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell]; -// pd.well_index = computeWellIndex(radius, cubical, cell_perm, -// compdat.compdat[kw].skin_factor_); -// } -// wellperf_data[wix].push_back(pd); -// } -// found = true; -// break; -// } -// } -// if (!found) { -// OPM_THROW(std::runtime_error, "Undefined well name: " << compdat.compdat[kw].well_ -// << " in COMPDAT"); -// } -// } - // Set up reference depths that were defaulted. Count perfs. const int num_wells = well_data.size(); @@ -435,6 +353,7 @@ namespace Opm assert(grid.dimensions == 3); for (int w = 0; w < num_wells; ++w) { num_perfs += wellperf_data[w].size(); + printf("New version; num_perfs %d \n", num_perfs); if (well_data[w].reference_bhp_depth < 0.0) { // It was defaulted. Set reference depth to minimum perforation depth. double min_depth = 1e100; @@ -1025,6 +944,7 @@ namespace Opm assert(grid.dimensions == 3); for (int w = 0; w < num_wells; ++w) { num_perfs += wellperf_data[w].size(); + printf("Old version; num_perfs %d \n", num_perfs); if (well_data[w].reference_bhp_depth < 0.0) { // It was defaulted. Set reference depth to minimum perforation depth. double min_depth = 1e100; diff --git a/tests/test_wellsmanager.cpp b/tests/test_wellsmanager.cpp index 25c9678a1..dfbb84fed 100644 --- a/tests/test_wellsmanager.cpp +++ b/tests/test_wellsmanager.cpp @@ -61,7 +61,7 @@ void wells_static_check(const Wells* wells) { } -/* +/* The number of controls is determined by looking at which elements have been given explicit - non-default - values in the WCONxxxx keyword. Is that at all interesting? @@ -71,7 +71,7 @@ void wells_static_check(const Wells* wells) { void check_controls_epoch0( struct WellControls ** ctrls) { // The injector { - const struct WellControls * ctrls0 = ctrls[0]; + const struct WellControls * ctrls0 = ctrls[0]; BOOST_CHECK_EQUAL( 3 , well_controls_get_num(ctrls0)); // The number of controls for the injector == 3?? BOOST_CHECK_EQUAL( SURFACE_RATE , well_controls_iget_type(ctrls0 , 0) ); @@ -87,7 +87,7 @@ void check_controls_epoch0( struct WellControls ** ctrls) { BOOST_CHECK_EQUAL( 0 , well_controls_get_current(ctrls0) ); // The phase distribution in the active target - { + { const double * distr = well_controls_iget_distr( ctrls0 , 0 ); BOOST_CHECK_EQUAL( 0 , distr[0] ); // Water BOOST_CHECK_EQUAL( 0 , distr[1] ); // Oil @@ -110,7 +110,7 @@ void check_controls_epoch0( struct WellControls ** ctrls) { BOOST_CHECK_EQUAL( 0 , well_controls_get_current(ctrls1)); // The phase distribution in the active target - { + { const double * distr = well_controls_iget_distr( ctrls1 , 0 ); BOOST_CHECK_EQUAL( 0 , distr[0] ); // Water BOOST_CHECK_EQUAL( 1 , distr[1] ); // Oil @@ -125,7 +125,7 @@ void check_controls_epoch0( struct WellControls ** ctrls) { void check_controls_epoch1( struct WellControls ** ctrls) { // The injector { - const struct WellControls * ctrls0 = ctrls[0]; + const struct WellControls * ctrls0 = ctrls[0]; BOOST_CHECK_EQUAL( 3 , well_controls_get_num(ctrls0)); // The number of controls for the injector == 3?? BOOST_CHECK_EQUAL( SURFACE_RATE , well_controls_iget_type(ctrls0 , 0 )); @@ -140,7 +140,7 @@ void check_controls_epoch1( struct WellControls ** ctrls) { // Which control is active BOOST_CHECK_EQUAL( 1 , well_controls_get_current(ctrls0)); - { + { const double * distr = well_controls_iget_distr( ctrls0 , 1 ); BOOST_CHECK_EQUAL( 1 , distr[0] ); // Water BOOST_CHECK_EQUAL( 0 , distr[1] ); // Oil @@ -164,7 +164,7 @@ void check_controls_epoch1( struct WellControls ** ctrls) { // Which control is active BOOST_CHECK_EQUAL( 1 , well_controls_get_current(ctrls1) ); - { + { const double * distr = well_controls_iget_distr( ctrls1 , 1 ); BOOST_CHECK_EQUAL( 1 , distr[0] ); // Water BOOST_CHECK_EQUAL( 1 , distr[1] ); // Oil From d621fdfe79edf91bc7c14719393317b843e5eebc Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Wed, 29 Jan 2014 12:30:03 +0100 Subject: [PATCH 6/6] Removed print statement --- opm/core/wells/WellsManager.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index 63d868cf6..58e5b8639 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -353,7 +353,6 @@ namespace Opm assert(grid.dimensions == 3); for (int w = 0; w < num_wells; ++w) { num_perfs += wellperf_data[w].size(); - printf("New version; num_perfs %d \n", num_perfs); if (well_data[w].reference_bhp_depth < 0.0) { // It was defaulted. Set reference depth to minimum perforation depth. double min_depth = 1e100; @@ -944,7 +943,6 @@ namespace Opm assert(grid.dimensions == 3); for (int w = 0; w < num_wells; ++w) { num_perfs += wellperf_data[w].size(); - printf("Old version; num_perfs %d \n", num_perfs); if (well_data[w].reference_bhp_depth < 0.0) { // It was defaulted. Set reference depth to minimum perforation depth. double min_depth = 1e100;