Merge pull request #1468 from joakim-hove/connection-segment

Connection segment
This commit is contained in:
Joakim Hove 2020-02-14 06:49:43 +01:00 committed by GitHub
commit e4955d3d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 36 deletions

View File

@ -134,16 +134,18 @@ namespace Opm {
void setState(State state);
void setComplnum(int compnum);
void scaleWellPi(double wellPi);
void updateSegment(int segment_number, double center_depth, std::size_t seqIndex);
void updateSegment(int segment_number_arg,
double center_depth_arg,
std::size_t seqIndex,
std::size_t compseg_insert_index,
double start,
double end);
const std::size_t& getSeqIndex() const;
const bool& getDefaultSatTabId() const;
const std::size_t& getCompSegSeqIndex() const;
void setCompSegSeqIndex(std::size_t index);
void setDefaultSatTabId(bool id);
const double& getSegDistStart() const;
const double& getSegDistEnd() const;
void setSegDistStart(const double& distStart);
void setSegDistEnd(const double& distEnd);
std::string str() const;
bool ctfAssignedFromInput() const
{

View File

@ -260,27 +260,29 @@ namespace Opm {
center_depth = segment_depth + (center_distance - segment_distance) / segment_length * depth_change_segment;
}
void Compsegs::updateConnectionsWithSegment(const std::vector< Compsegs >& compsegs,
const EclipseGrid& grid,
WellConnections& connection_set) {
void
Compsegs::updateConnectionsWithSegment(const std::vector<Compsegs>& compsegs,
const EclipseGrid& grid,
WellConnections& connection_set)
{
for( const auto& compseg : compsegs ) {
for (const auto& compseg : compsegs) {
const int i = compseg.m_i;
const int j = compseg.m_j;
const int k = compseg.m_k;
if (grid.cellActive(i, j, k)) {
Connection& connection = connection_set.getFromIJK( i, j, k );
connection.updateSegment(compseg.segment_number, compseg.center_depth,compseg.m_seqIndex);
//keep connection sequence number from input sequence
connection.setCompSegSeqIndex(compseg.m_seqIndex);
connection.setSegDistStart(compseg.m_distance_start);
connection.setSegDistEnd(compseg.m_distance_end);
}
if (grid.cellActive(i, j, k)) {
Connection& connection = connection_set.getFromIJK(i, j, k);
connection.updateSegment(compseg.segment_number,
compseg.center_depth,
compseg.m_seqIndex,
compseg.m_seqIndex,
compseg.m_distance_start,
compseg.m_distance_end);
}
}
for (size_t ic = 0; ic < connection_set.size(); ++ic) {
if ( !(connection_set.get(ic).attachedToSegment()) ) {
if (!(connection_set.get(ic).attachedToSegment())) {
throw std::runtime_error("Not all the connections are attached with a segment. "
"The information from COMPSEGS is not complete");
}

View File

@ -30,10 +30,10 @@ namespace Opm {
const ParseContext& parseContext,
ErrorGuard& errors)
{
WellConnections * new_connection_set = new WellConnections(input_connections);
WellConnections new_connection_set = input_connections;
std::vector<Compsegs> compsegs_vector = Compsegs::compsegsFromCOMPSEGSKeyword( compsegs, grid, parseContext, errors);
Compsegs::processCOMPSEGS(compsegs_vector, segment_set);
Compsegs::updateConnectionsWithSegment(compsegs_vector, grid, *new_connection_set);
return new_connection_set;
Compsegs::updateConnectionsWithSegment(compsegs_vector, grid, new_connection_set);
return new WellConnections( std::move( new_connection_set ) );
}
}

View File

@ -34,6 +34,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
namespace Opm {
@ -155,22 +156,10 @@ namespace Opm {
}
void Connection::setCompSegSeqIndex(std::size_t index) {
m_compSeg_seqIndex = index;
}
void Connection::setDefaultSatTabId(bool id) {
m_defaultSatTabId = id;
}
void Connection::setSegDistStart(const double& distStart) {
m_segDistStart = distStart;
}
void Connection::setSegDistEnd(const double& distEnd) {
m_segDistEnd = distEnd;
}
double Connection::depth() const {
return this->center_depth;
}
@ -215,10 +204,18 @@ namespace Opm {
this->open_state = state;
}
void Connection::updateSegment(int segment_number_arg, double center_depth_arg, std::size_t seqIndex) {
void Connection::updateSegment(int segment_number_arg,
double center_depth_arg,
std::size_t seqIndex,
std::size_t compseg_insert_index,
double start,
double end) {
this->segment_number = segment_number_arg;
this->center_depth = center_depth_arg;
this->m_seqIndex = seqIndex;
this->m_compSeg_seqIndex = compseg_insert_index;
this->m_segDistStart = start;
this->m_segDistEnd = end;
}
int Connection::segment() const {

View File

@ -369,8 +369,12 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction
satTableId,
direction, ctf_kind,
noConn, conSDStart, conSDEnd, defaultSatTable);
prev->setCompSegSeqIndex(css_ind);
prev->updateSegment(conSegNo, conCDepth, con_SIndex);
prev->updateSegment(conSegNo,
conCDepth,
con_SIndex,
css_ind,
conSDStart,
conSDEnd);
}
}
}