WellConnections::add() does not inspect IJK

This commit is contained in:
Joakim Hove
2018-06-25 16:21:51 +02:00
parent 363b8589e6
commit fd3000cd31
12 changed files with 73 additions and 94 deletions

View File

@@ -80,6 +80,10 @@ namespace Opm {
bool operator==( const Connection& ) const;
bool operator!=( const Connection& ) const;
// related segment number
// -1 means the completion is not related to segment
int m_segment_number = -1;
double m_center_depth;
private:
int m_i, m_j, m_k;
@@ -93,10 +97,6 @@ namespace Opm {
WellCompletion::DirectionEnum m_direction;
Value<double> getDiameterAsValueObject() const;
Value<double> getSkinFactorAsValueObject() const;
// related segment number
// -1 means the completion is not related to segment
int m_segment_number = -1;
double m_center_depth;
};
}

View File

@@ -26,7 +26,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
namespace Opm {
WellConnections * updatingConnectionsWithSegments(const DeckKeyword& compsegs, const WellConnections& input_connections, const WellSegments& segments);
WellConnections * newConnectionsWithSegments(const DeckKeyword& compsegs, const WellConnections& input_connections, const WellSegments& segments);
}
#endif

View File

@@ -166,6 +166,7 @@ namespace Opm {
void addEvent(ScheduleEvents::Events event, size_t reportStep);
bool hasEvent(uint64_t eventMask, size_t reportStep) const;
void handleCOMPDAT(size_t time_step, const DeckRecord& record, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties);
void handleCOMPSEGS(const DeckKeyword& keyword, size_t time_step);
/*
Will remove all completions which are attached to inactive cells. Will

View File

@@ -238,8 +238,9 @@ namespace Opm {
const int j = compseg.m_j;
const int k = compseg.m_k;
const Connection& connection = connection_set.getFromIJK( i, j, k );
connection_set.add(Connection(connection, compseg.m_segment_number, compseg.m_center_depth) );
Connection& connection = connection_set.getFromIJK( i, j, k );
connection.m_segment_number = compseg.m_segment_number;
connection.m_center_depth = compseg.m_center_depth;
}
for (size_t ic = 0; ic < connection_set.size(); ++ic) {

View File

@@ -22,12 +22,11 @@
namespace Opm {
WellConnections * updatingConnectionsWithSegments(const DeckKeyword& compsegs,
const WellConnections& input_connections,
const WellSegments& segment_set)
WellConnections * newConnectionsWithSegments(const DeckKeyword& compsegs,
const WellConnections& input_connections,
const WellSegments& segment_set)
{
WellConnections * new_connection_set = new WellConnections(input_connections);
WellConnections * new_connection_set = new WellConnections(input_connections);
std::vector<Compsegs> compsegs_vector = Compsegs::compsegsFromCOMPSEGSKeyword( compsegs );
Compsegs::processCOMPSEGS(compsegs_vector, segment_set);

View File

@@ -1455,12 +1455,7 @@ namespace Opm {
const auto& record1 = keyword.getRecord(0);
const std::string& well_name = record1.getItem("WELL").getTrimmedString(0);
auto& well = this->m_wells.get( well_name );
const auto& segment_set = well.getWellSegments(currentStep);
const auto& completion_set = well.getConnections( currentStep );
WellConnections * new_completion_set = updatingConnectionsWithSegments(keyword, completion_set, segment_set);
well.updateWellConnections(currentStep, new_completion_set);
well.handleCOMPSEGS(keyword, currentStep);
}
void Schedule::handleWGRUPCON( const DeckKeyword& keyword, size_t currentStep) {

View File

@@ -26,6 +26,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
@@ -598,4 +599,12 @@ namespace Opm {
this->updateWellConnections(time_step, connections);
}
void Well::handleCOMPSEGS(const DeckKeyword& keyword, size_t time_step) {
const auto& segment_set = this->getWellSegments(time_step);
const auto& completion_set = this->getConnections( time_step );
WellConnections * new_connection_set = newConnectionsWithSegments(keyword, completion_set, segment_set);
this->updateWellConnections(time_step, new_connection_set);
}
}

View File

@@ -131,14 +131,37 @@ namespace Opm {
if (defaultSatTable)
satTableId = satnum.iget(grid.getGlobalIndex(I,J,k));
this->addConnection(I,J,k,
grid.getCellDepth( I,J,k ),
state,
connectionTransmissibilityFactor,
diameter,
skinFactor,
satTableId,
direction );
auto same_ijk = [&]( const Connection& c ) {
return c.sameCoordinate( I,J,k );
};
auto prev = std::find_if( this->m_connections.begin(),
this->m_connections.end(),
same_ijk );
if (prev == this->m_connections.end()) {
this->addConnection(I,J,k,
grid.getCellDepth( I,J,k ),
state,
connectionTransmissibilityFactor,
diameter,
skinFactor,
satTableId,
direction );
} else {
// The complnum value carries over; the rest of the state is fully specified by
// the current COMPDAT keyword.
int complnum = prev->complnum();
*prev = Connection(I,J,k,
complnum,
grid.getCellDepth(I,J,k),
state,
connectionTransmissibilityFactor,
diameter,
skinFactor,
satTableId,
direction );
}
}
}
@@ -174,21 +197,21 @@ namespace Opm {
void WellConnections::add( Connection connection ) {
auto same = [&]( const Connection& c ) {
return c.sameCoordinate( connection );
};
//auto same = [&]( const Connection& c ) {
// return c.sameCoordinate( connection );
//};
auto prev = std::find_if( this->m_connections.begin(),
this->m_connections.end(),
same );
//auto prev = std::find_if( this->m_connections.begin(),
// this->m_connections.end(),
// same );
if( prev != this->m_connections.end() ) {
// update the completion, but preserve it's number
*prev = Connection( connection, prev->complnum() );
return;
}
//if( prev != this->m_connections.end() ) {
// // update the completion, but preserve it's number
// *prev = Connection( connection, prev->complnum() );
// return;
//}
m_connections.emplace_back( connection );
m_connections.emplace_back( connection );
}
bool WellConnections::allConnectionsShut( ) const {

View File

@@ -122,20 +122,6 @@ BOOST_AUTO_TEST_CASE(WellConnectionsGetOutOfRangeThrows) {
BOOST_AUTO_TEST_CASE(AddCompletionSameCellUpdates) {
Opm::WellConnections completionSet;
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22), 0);
Opm::Connection completion2( 10,10,10, 1, 0.0,Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22), 0);
completionSet.add( completion1 );
BOOST_CHECK_EQUAL( 1U , completionSet.size() );
completionSet.add( completion2 );
BOOST_CHECK_EQUAL( 1U , completionSet.size() );
}
BOOST_AUTO_TEST_CASE(AddCompletionCopy) {
Opm::WellConnections completionSet;

View File

@@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) {
BOOST_CHECK_EQUAL(6U, segment_set.size());
const Opm::WellConnections * new_connection_set = Opm::updatingConnectionsWithSegments(compsegs, connection_set, segment_set);
const Opm::WellConnections * new_connection_set = Opm::newConnectionsWithSegments(compsegs, connection_set, segment_set);
BOOST_CHECK_EQUAL(7U, new_connection_set->size());

View File

@@ -337,41 +337,6 @@ BOOST_AUTO_TEST_CASE(NewWellZeroCompletions) {
BOOST_CHECK_EQUAL( 0U , well.getConnections( 0 ).size() );
}
BOOST_AUTO_TEST_CASE(UpdateCompletions) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 0, 0, 0.0, Opm::Phase::OIL, timeMap , 0);
const auto& completions = well.getConnections( 0 );
BOOST_CHECK_EQUAL( 0U , completions.size());
Opm::Connection comp1( 10 , 10 , 10 , 1, 10, Opm::WellCompletion::AUTO , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22), 0);
Opm::Connection comp2( 10 , 10 , 11 , 1, 11, Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22), 0);
Opm::Connection comp3( 10 , 10 , 12 , 1, 12, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22), 0);
Opm::Connection comp4( 10 , 10 , 12 , 1, 12, Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22), 0);
Opm::Connection comp5( 10 , 10 , 13 , 1, 13, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22), 0);
//std::vector<Opm::CompletionConstPtr> newCompletions2{ comp4 , comp5}; Newer c++
std::vector< Opm::Connection > newCompletions, newCompletions2;
newCompletions.push_back( comp1 );
newCompletions.push_back( comp2 );
newCompletions.push_back( comp3 );
newCompletions2.push_back( comp4 );
newCompletions2.push_back( comp5 );
BOOST_CHECK_EQUAL( 3U , newCompletions.size());
well.addConnections( 5 , newCompletions );
BOOST_CHECK_EQUAL( 3U , well.getConnections( 5 ).size());
BOOST_CHECK_EQUAL( comp3 , well.getConnections( 5 ).get(2));
well.addConnections( 6 , newCompletions2 );
BOOST_CHECK_EQUAL( 4U , well.getConnections( 6 ).size());
BOOST_CHECK_EQUAL( comp4 , well.getConnections( 6 ).get(2));
}
// Helper function for CompletionOrder test.
inline Opm::Connection connection( int i, int j, int k, int complnum = 1 ) {
return Opm::Connection { i, j, k,

View File

@@ -443,13 +443,8 @@ BOOST_AUTO_TEST_CASE( MULTREGT_ECLIPSE_STATE ) {
BOOST_AUTO_TEST_CASE( MULTISEGMENT_ABS ) {
const Parser parser;
const std::string deckFile(pathprefix() + "SCHEDULE/SCHEDULE_MULTISEGMENT_WELL");
const auto deck = parser.parseFile(deckFile, ParseContext());
const ParseContext parseContext;
const EclipseState state(deck, parseContext);
const auto& grid = state.getInputGrid();
const TableManager table ( deck );
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Schedule sched(deck, grid, eclipseProperties, Phases(true, true, true), parseContext );
const auto deck = parser.parseFile(deckFile, parseContext);
// for WELSEGS keyword
const auto& kw = deck.getKeyword("WELSEGS");
@@ -568,6 +563,11 @@ BOOST_AUTO_TEST_CASE( MULTISEGMENT_ABS ) {
BOOST_CHECK_EQUAL( 3237.5, distance_end );
}
const EclipseState state(deck, parseContext);
const auto& grid = state.getInputGrid();
const TableManager table ( deck );
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Schedule sched(deck, grid, eclipseProperties, Phases(true, true, true), parseContext );
// checking the relation between segments and completions
// and also the depth of completions
{