From c2f9390d9533ffe262d19a97313b0d963478dd3a Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Mon, 12 Jan 2015 12:20:33 +0100 Subject: [PATCH] Wellsmanager will check completion status With this commit the WellsManager will check the status of completions before adding them to the internal struct wells datastructure. Completions can be in the four states: OPEN, SHUT, AUTO, POPN Completions with state == SHUT will be ignored, wheras the wellsmanager will throw if the states AUTO or POPN are encountered. The WELOPEN keyword can also have the value 'STOP'; for completions that is translated to 'SHUT' by Schedule object. --- opm/core/wells/WellsManager_impl.hpp | 60 +++++++++++++++------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/opm/core/wells/WellsManager_impl.hpp b/opm/core/wells/WellsManager_impl.hpp index 436bdca6b..4967980a8 100644 --- a/opm/core/wells/WellsManager_impl.hpp +++ b/opm/core/wells/WellsManager_impl.hpp @@ -155,40 +155,46 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t CompletionSetConstPtr completionSet = well->getCompletions(timeStep); for (size_t c=0; csize(); c++) { CompletionConstPtr completion = completionSet->get(c); - int i = completion->getI(); - int j = completion->getJ(); - int k = completion->getK(); + if (completion->getState() == WellCompletion::OPEN) { + int i = completion->getI(); + int j = completion->getJ(); + int k = completion->getK(); - const int* cpgdim = cart_dims; - 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()) { + const int* cpgdim = cart_dims; + 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->getConnectionTransmissibilityFactor() > 0.0) { - pd.well_index = completion->getConnectionTransmissibilityFactor(); - } 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); } + int cell = cgit->second; + PerfData pd; + pd.cell = cell; + if (completion->getConnectionTransmissibilityFactor() > 0.0) { + pd.well_index = completion->getConnectionTransmissibilityFactor(); + } 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); + } - const std::array cubical = - WellsManagerDetail::getCubeDim<3>(c2f, begin_face_centroids, cell); + const std::array cubical = + WellsManagerDetail::getCubeDim<3>(c2f, begin_face_centroids, cell); - const double* cell_perm = &permeability[dimensions*dimensions*cell]; - pd.well_index = - WellsManagerDetail::computeWellIndex(radius, cubical, cell_perm, - completion->getSkinFactor(), - completion->getDirection(), - ntg[cell]); + const double* cell_perm = &permeability[dimensions*dimensions*cell]; + pd.well_index = + WellsManagerDetail::computeWellIndex(radius, cubical, cell_perm, + completion->getSkinFactor(), + completion->getDirection(), + ntg[cell]); + } + wellperf_data[well_index].push_back(pd); + } else { + if (completion->getState() != WellCompletion::SHUT) { + OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion->getState() ) << " not handled"); + } } - wellperf_data[well_index].push_back(pd); } } well_index++;