Merge pull request #1519 from joakim-hove/completion-refactor

Completion refactor
This commit is contained in:
Joakim Hove 2018-06-28 09:58:51 +02:00 committed by GitHub
commit 7568ec0f90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 17 deletions

View File

@ -58,9 +58,8 @@ namespace Opm
// initialize the segment_perforations_ // initialize the segment_perforations_
const WellConnections& completion_set = well_ecl_->getConnections(current_step_); const WellConnections& completion_set = well_ecl_->getConnections(current_step_);
for (int perf = 0; perf < number_of_perforations_; ++perf) { for (int perf = 0; perf < number_of_perforations_; ++perf) {
const Connection& completion = completion_set.get(perf); const Connection& connection = completion_set.get(perf);
const int segment_number = completion.getSegmentNumber(); const int segment_index = segmentNumberToIndex(connection.segment_number);
const int segment_index = segmentNumberToIndex(segment_number);
segment_perforations_[segment_index].push_back(perf); segment_perforations_[segment_index].push_back(perf);
} }
@ -81,7 +80,7 @@ namespace Opm
for (int seg = 0; seg < numberOfSegments(); ++seg) { for (int seg = 0; seg < numberOfSegments(); ++seg) {
const double segment_depth = segmentSet()[seg].depth(); const double segment_depth = segmentSet()[seg].depth();
for (const int perf : segment_perforations_[seg]) { for (const int perf : segment_perforations_[seg]) {
perf_depth_[perf] = completion_set.get(perf).getCenterDepth(); perf_depth_[perf] = completion_set.get(perf).center_depth;
perforation_segment_depth_diffs_[perf] = perf_depth_[perf] - segment_depth; perforation_segment_depth_diffs_[perf] = perf_depth_[perf] - segment_depth;
} }
} }

View File

@ -757,7 +757,7 @@ namespace Opm
const auto& completionSet = well_ecl_->getConnections(current_step_); const auto& completionSet = well_ecl_->getConnections(current_step_);
for (size_t c=0; c<completionSet.size(); c++) { for (size_t c=0; c<completionSet.size(); c++) {
const auto& completion = completionSet.get(c); const auto& completion = completionSet.get(c);
if (completion.getState() == WellCompletion::OPEN) { if (completion.state == WellCompletion::OPEN) {
const int i = completion.getI(); const int i = completion.getI();
const int j = completion.getJ(); const int j = completion.getJ();
const int k = completion.getK(); const int k = completion.getK();
@ -781,12 +781,10 @@ namespace Opm
const std::array<double, 3> cubical = const std::array<double, 3> cubical =
WellsManagerDetail::getCubeDim<3>(cell_to_faces, begin_face_centroids, cell); WellsManagerDetail::getCubeDim<3>(cell_to_faces, begin_face_centroids, cell);
WellCompletion::DirectionEnum direction = completion.getDirection();
double re; // area equivalent radius of the grid block double re; // area equivalent radius of the grid block
double perf_length; // the length of the well perforation double perf_length; // the length of the well perforation
switch (direction) { switch (completion.dir) {
case Opm::WellCompletion::DirectionEnum::X: case Opm::WellCompletion::DirectionEnum::X:
re = std::sqrt(cubical[1] * cubical[2] / M_PI); re = std::sqrt(cubical[1] * cubical[2] / M_PI);
perf_length = cubical[0]; perf_length = cubical[0];

View File

@ -558,9 +558,8 @@ namespace Opm
// that is why I think we should use a well model to initialize the WellState here // that is why I think we should use a well model to initialize the WellState here
std::vector<std::vector<int>> segment_perforations(well_nseg); std::vector<std::vector<int>> segment_perforations(well_nseg);
for (int perf = 0; perf < nperf; ++perf) { for (int perf = 0; perf < nperf; ++perf) {
const Connection& completion = completion_set.get(perf); const Connection& connection = completion_set.get(perf);
const int segment_number = completion.getSegmentNumber(); const int segment_index = segment_set.segmentNumberToIndex(connection.segment_number);
const int segment_index = segment_set.segmentNumberToIndex(segment_number);
segment_perforations[segment_index].push_back(perf); segment_perforations[segment_index].push_back(perf);
} }

View File

@ -165,7 +165,7 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
// shut completions and open ones stored in this process will have 1 others 0. // shut completions and open ones stored in this process will have 1 others 0.
for(const auto& completion : well->getConnections(timeStep)) { for(const auto& completion : well->getConnections(timeStep)) {
if (completion.getState() == WellCompletion::OPEN) { if (completion.state == WellCompletion::OPEN) {
int i = completion.getI(); int i = completion.getI();
int j = completion.getJ(); int j = completion.getJ();
int k = completion.getK(); int k = completion.getK();
@ -195,7 +195,7 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
pd.cell = cell; pd.cell = cell;
{ {
const Value<double>& transmissibilityFactor = completion.getConnectionTransmissibilityFactorAsValueObject(); const Value<double>& transmissibilityFactor = completion.getConnectionTransmissibilityFactorAsValueObject();
const double wellPi = completion.getWellPi(); const double wellPi = completion.wellPi;
if (transmissibilityFactor.hasValue()) { if (transmissibilityFactor.hasValue()) {
pd.well_index = transmissibilityFactor.getValue(); pd.well_index = transmissibilityFactor.getValue();
} else { } else {
@ -217,17 +217,17 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
pd.well_index = pd.well_index =
WellsManagerDetail::computeWellIndex(radius, cubical, cell_perm, WellsManagerDetail::computeWellIndex(radius, cubical, cell_perm,
completion.getSkinFactor(), completion.getSkinFactor(),
completion.getDirection(), completion.dir,
ntg[cell]); ntg[cell]);
} }
pd.satnumid = completion.getSatTableId(); pd.satnumid = completion.sat_tableId;
pd.well_index *= wellPi; pd.well_index *= wellPi;
} }
wellperf_data[active_well_index].push_back(pd); wellperf_data[active_well_index].push_back(pd);
} }
} else { } else {
if (completion.getState() != WellCompletion::SHUT) { if (completion.state != WellCompletion::SHUT) {
OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion.getState() ) << " not handled"); OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion.state ) << " not handled");
} }
} }
} }