Updated COMPDAT i,j,k indices, and removed the old commented part

This commit is contained in:
Kristian Flikka
2014-01-29 11:57:45 +01:00
parent 0d492ce407
commit fbe2f31653
2 changed files with 13 additions and 93 deletions

View File

@@ -315,9 +315,9 @@ namespace Opm
CompletionSetConstPtr completionSet = well->getCompletions(timeStep);
for (size_t c=0; c<completionSet->size(); 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<int, int>::const_iterator cgit = cartesian_to_compressed.find(cart_grid_indx);
if (cgit == cartesian_to_compressed.end()) {
@@ -337,8 +337,7 @@ namespace Opm
}
std::array<double, 3> 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<int, int>::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<double, 3> 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;

View File

@@ -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