Moved connection state enum to Connection class

This commit is contained in:
Joakim Hove 2019-08-27 23:14:32 +02:00
parent 82accba45b
commit dcf4347aee
18 changed files with 156 additions and 148 deletions

View File

@ -28,12 +28,6 @@ namespace Opm {
namespace WellCompletion {
enum StateEnum {
OPEN = 1,
SHUT = 2,
AUTO = 3
};
enum DirectionEnum {
X = 1,
@ -51,8 +45,6 @@ namespace Opm {
std::string DirectionEnum2String(const DirectionEnum enumValue);
DirectionEnum DirectionEnumFromString(const std::string& stringValue);
const std::string StateEnum2String( StateEnum enumValue );
StateEnum StateEnumFromString( const std::string& stringValue );
const std::string CompletionOrderEnum2String( CompletionOrderEnum enumValue );
CompletionOrderEnum CompletionOrderEnumFromString(const std::string& comporderStringValue);

View File

@ -39,10 +39,20 @@ namespace Opm {
class Connection {
public:
enum class State {
OPEN = 1,
SHUT = 2,
AUTO = 3
};
static const std::string State2String( State enumValue );
static State StateFromString( const std::string& stringValue );
Connection(int i, int j , int k ,
int complnum,
double depth,
WellCompletion::StateEnum state,
State state,
double CF,
double Kh,
double rw,
@ -61,7 +71,7 @@ namespace Opm {
int getI() const;
int getJ() const;
int getK() const;
WellCompletion::StateEnum state() const;
State state() const;
WellCompletion::DirectionEnum dir() const;
double depth() const;
int satTableId() const;
@ -74,7 +84,7 @@ namespace Opm {
double skinFactor() const;
double wellPi() const;
void setState(WellCompletion::StateEnum state);
void setState(State state);
void setComplnum(int compnum);
void scaleWellPi(double wellPi);
void updateSegment(int segment_number, double center_depth, std::size_t seqIndex);
@ -94,7 +104,7 @@ namespace Opm {
private:
WellCompletion::DirectionEnum direction;
double center_depth;
WellCompletion::StateEnum open_state;
State open_state;
int sat_tableId;
int m_complnum;
double m_CF;

View File

@ -271,7 +271,7 @@ public:
bool handleWELSEGS(const DeckKeyword& keyword);
bool handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors);
bool handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum status);
bool handleWELOPEN(const DeckRecord& record, Connection::State status);
bool handleCOMPLUMP(const DeckRecord& record);
bool handleWPIMULT(const DeckRecord& record);

View File

@ -33,7 +33,7 @@ namespace Opm {
WellConnections(const WellConnections& src, const EclipseGrid& grid);
void addConnection(int i, int j , int k ,
double depth,
WellCompletion::StateEnum state ,
Connection::State state ,
double CF,
double Kh,
double rw,
@ -82,7 +82,7 @@ namespace Opm {
void addConnection(int i, int j , int k ,
int complnum,
double depth,
WellCompletion::StateEnum state ,
Connection::State state ,
double CF,
double Kh,
double rw,

View File

@ -5,7 +5,7 @@
namespace {
std::string state( const Connection& c ) {
return WellCompletion::StateEnum2String( c.state() );
return Connection::State2String( c.state() );
}
std::string direction( const Connection& c ) {

View File

@ -116,7 +116,7 @@ namespace {
const std::size_t connID,
IConnArray& iConn)
{
using ConnState = ::Opm::WellCompletion::StateEnum;
using ConnState = ::Opm::Connection::State;
using Ix = ::Opm::RestartIO::Helpers::VectorItems::IConn::index;
iConn[Ix::SeqIndex] = connID + 1;
@ -298,12 +298,12 @@ captureDeclaredConnData(const Schedule& sched,
for (auto nConn = conns.size(), connID = 0*nConn; connID < nConn; connID++) {
//
// WellRates connections are only defined for OPEN connections
if ((conns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) &&
if ((conns[connID].state() == Opm::Connection::State::OPEN) &&
(rCInd < xr->second.connections.size())) {
it->second[connID] = &(xr->second.connections[rCInd]);
rCInd+= 1;
}
else if ((conns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) && (rCInd >= xr->second.connections.size())) {
else if ((conns[connID].state() == Opm::Connection::State::OPEN) && (rCInd >= xr->second.connections.size())) {
throw std::invalid_argument {
"Inconsistent number of open connections I in vector<Opm::data::Connection*> (" +
std::to_string(xr->second.connections.size()) + ") in Well " + wl.name()

View File

@ -195,7 +195,7 @@ namespace {
using M = ::Opm::UnitSystem::measure;
using R = ::Opm::data::Rates::opt;
for (auto nConn = welConns.size(), connID = 0*nConn; connID < nConn; connID++) {
if (welConns[connID].state() == Opm::WellCompletion::StateEnum::OPEN) openConnections.push_back(&welConns[connID]);
if (welConns[connID].state() == Opm::Connection::State::OPEN) openConnections.push_back(&welConns[connID]);
}
if (openConnections.size() != rateConns.size()) {
throw std::invalid_argument {

View File

@ -775,7 +775,7 @@ namespace {
for (const auto& sc : sched_well.getConnections()) {
const auto i = sc.getI(), j = sc.getJ(), k = sc.getK();
if (!grid.cellActive(i, j, k) || sc.state() == Opm::WellCompletion::SHUT) {
if (!grid.cellActive(i, j, k) || sc.state() == Opm::Connection::State::SHUT) {
opm_xwel_data += Opm::data::Connection::restart_size + phases.size();
continue;
}

View File

@ -137,7 +137,7 @@ namespace {
const auto i = sc.getI(), j = sc.getJ(), k = sc.getK();
const auto rs_size = phases.size() + data::Connection::restart_size;
if (!grid.cellActive(i, j, k) || sc.state() == WellCompletion::SHUT) {
if (!grid.cellActive(i, j, k) || sc.state() == Connection::State::SHUT) {
xwel.insert(xwel.end(), rs_size, 0.0);
continue;
}

View File

@ -1369,7 +1369,7 @@ namespace {
}
for (const auto& wname : well_names) {
const auto comp_status = WellCompletion::StateEnumFromString( status_str );
const auto comp_status = Connection::StateFromString( status_str );
{
auto& dynamic_state = this->wells_static.at(wname);
auto well_ptr = std::make_shared<Well2>( *dynamic_state[currentStep] );

View File

@ -65,34 +65,6 @@ namespace Opm {
}
const std::string StateEnum2String( StateEnum enumValue ) {
switch( enumValue ) {
case OPEN:
return "OPEN";
case AUTO:
return "AUTO";
case SHUT:
return "SHUT";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
StateEnum StateEnumFromString( const std::string& stringValue ) {
if (stringValue == "OPEN")
return OPEN;
else if (stringValue == "SHUT")
return SHUT;
else if (stringValue == "STOP")
return SHUT;
else if (stringValue == "AUTO")
return AUTO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
const std::string CompletionOrderEnum2String( CompletionOrderEnum enumValue ) {
switch( enumValue ) {
case DEPTH:

View File

@ -40,7 +40,7 @@ namespace Opm {
Connection::Connection(int i, int j , int k ,
int compnum,
double depth,
WellCompletion::StateEnum stateArg ,
State stateArg ,
double CF,
double Kh,
double rw,
@ -150,7 +150,7 @@ namespace Opm {
return this->center_depth;
}
WellCompletion::StateEnum Connection::state() const {
Connection::State Connection::state() const {
return this->open_state;
}
@ -186,7 +186,7 @@ namespace Opm {
return this->m_skin_factor;
}
void Connection::setState(WellCompletion::StateEnum state) {
void Connection::setState(State state) {
this->open_state = state;
}
@ -221,7 +221,7 @@ namespace Opm {
ss << "wPi " << this->wPi << std::endl;
ss << "kh " << this->m_Kh << std::endl;
ss << "sat_tableId " << this->sat_tableId << std::endl;
ss << "open_state " << this->open_state << std::endl;
ss << "open_state " << Connection::State2String(this->open_state) << std::endl;
ss << "direction " << this->direction << std::endl;
ss << "segment_nr " << this->segment_number << std::endl;
ss << "center_depth " << this->center_depth << std::endl;
@ -254,4 +254,38 @@ namespace Opm {
bool Connection::operator!=( const Connection& rhs ) const {
return !( *this == rhs );
}
const std::string Connection::State2String( State enumValue ) {
switch( enumValue ) {
case State::OPEN:
return "OPEN";
case State::AUTO:
return "AUTO";
case State::SHUT:
return "SHUT";
default:
throw std::invalid_argument("Unhandled enum value");
}
}
Connection::State Connection::StateFromString( const std::string& stringValue ) {
if (stringValue == "OPEN")
return State::OPEN;
else if (stringValue == "SHUT")
return State::SHUT;
else if (stringValue == "STOP")
return State::SHUT;
else if (stringValue == "AUTO")
return State::AUTO;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue );
}
}

View File

@ -526,7 +526,7 @@ Phase Well2::getPreferredPhase() const {
return this->phase;
}
bool Well2::handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum status_arg) {
bool Well2::handleWELOPEN(const DeckRecord& record, Connection::State state_arg) {
auto match = [=]( const Connection &c) -> bool {
if (!match_eq(c.getI(), record, "I" , -1)) return false;
@ -542,7 +542,7 @@ bool Well2::handleWELOPEN(const DeckRecord& record, WellCompletion::StateEnum st
for (auto c : *this->connections) {
if (match(c))
c.setState( status_arg );
c.setState( state_arg );
new_connections->add(c);
}

View File

@ -136,7 +136,7 @@ namespace {
void WellConnections::addConnection(int i, int j , int k ,
int complnum,
double depth,
WellCompletion::StateEnum state,
Connection::State state,
double CF,
double Kh,
double rw,
@ -159,7 +159,7 @@ namespace {
void WellConnections::addConnection(int i, int j , int k ,
double depth,
WellCompletion::StateEnum state ,
Connection::State state ,
double CF,
double Kh,
double rw,
@ -208,7 +208,7 @@ namespace {
int K1 = record.getItem("K1").get< int >(0) - 1;
int K2 = record.getItem("K2").get< int >(0) - 1;
WellCompletion::StateEnum state = WellCompletion::StateEnumFromString( record.getItem("STATE").getTrimmedString(0) );
Connection::State state = Connection::StateFromString( record.getItem("STATE").getTrimmedString(0) );
const auto& satnum = eclipseProperties.getIntGridProperty("SATNUM");
int satTableId = -1;
@ -388,7 +388,7 @@ namespace {
auto shut = []( const Connection& c ) {
return c.state() == WellCompletion::StateEnum::SHUT;
return c.state() == Connection::State::SHUT;
};
return std::all_of( this->m_connections.begin(),

View File

@ -69,8 +69,8 @@ BOOST_AUTO_TEST_CASE(CreateWellConnectionsOK) {
BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::WellConnections completionSet(1,1);
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true);
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true);
completionSet.add( completion1 );
BOOST_CHECK_EQUAL( 1U , completionSet.size() );
@ -83,8 +83,8 @@ BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) {
BOOST_AUTO_TEST_CASE(WellConnectionsGetOutOfRangeThrows) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::WellConnections completionSet(1,1);
completionSet.add( completion1 );
BOOST_CHECK_EQUAL( 1U , completionSet.size() );
@ -103,9 +103,9 @@ BOOST_AUTO_TEST_CASE(AddCompletionCopy) {
Opm::WellConnections completionSet(10,10);
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion3( 10,10,12, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion1( 10,10,10, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 10,10,11, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion3( 10,10,12, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
completionSet.add( completion1 );
completionSet.add( completion2 );
@ -125,9 +125,9 @@ BOOST_AUTO_TEST_CASE(ActiveCompletions) {
Opm::EclipseGrid grid(10,20,20);
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::WellConnections completions(10,10);
Opm::Connection completion1( 0,0,0, 1, 0.0, Opm::WellCompletion::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 0,0,1, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion3( 0,0,2, 1, 0.0, Opm::WellCompletion::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion1( 0,0,0, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion2( 0,0,1, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
Opm::Connection completion3( 0,0,2, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0, dir,0,0., 0., true);
completions.add( completion1 );
completions.add( completion2 );

View File

@ -44,14 +44,14 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::WellConnections connection_set(10,10);
Opm::EclipseGrid grid(20,20,20);
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
BOOST_CHECK_EQUAL( 7U , connection_set.size() );
@ -132,14 +132,14 @@ BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::WellConnections connection_set(10,10);
Opm::EclipseGrid grid(20,20,20);
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
BOOST_CHECK_EQUAL( 7U , connection_set.size() );
@ -189,14 +189,14 @@ BOOST_AUTO_TEST_CASE(NegativeDepthCOMPSEGS) {
Opm::WellCompletion::DirectionEnum dir = Opm::WellCompletion::DirectionEnum::Z;
Opm::WellConnections connection_set(10,10);
Opm::EclipseGrid grid(20,20,20);
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, dir,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0, Opm::WellCompletion::DirectionEnum::X,0, 0., 0., true) );
BOOST_CHECK_EQUAL( 7U , connection_set.size() );

View File

@ -662,35 +662,35 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndConnectionDataWithWELOPEN) {
BOOST_CHECK(well_shut == schedule.getWell2("OP_1", 5).getStatus( ));
}
{
constexpr auto comp_shut = WellCompletion::StateEnum::SHUT;
constexpr auto comp_open = WellCompletion::StateEnum::OPEN;
constexpr auto comp_shut = Connection::State::SHUT;
constexpr auto comp_open = Connection::State::OPEN;
{
const auto& well = schedule.getWell2("OP_2", 3);
const auto& cs = well.getConnections( );
BOOST_CHECK_EQUAL( 7U, cs.size() );
BOOST_CHECK_EQUAL(comp_shut, cs.getFromIJK( 7, 6, 2 ).state());
BOOST_CHECK_EQUAL(comp_shut, cs.getFromIJK( 7, 6, 3 ).state());
BOOST_CHECK_EQUAL(comp_shut, cs.getFromIJK( 7, 6, 4 ).state());
BOOST_CHECK_EQUAL(comp_open, cs.getFromIJK( 7, 7, 2 ).state());
BOOST_CHECK(comp_shut == cs.getFromIJK( 7, 6, 2 ).state());
BOOST_CHECK(comp_shut == cs.getFromIJK( 7, 6, 3 ).state());
BOOST_CHECK(comp_shut == cs.getFromIJK( 7, 6, 4 ).state());
BOOST_CHECK(comp_open == cs.getFromIJK( 7, 7, 2 ).state());
}
{
const auto& well = schedule.getWell2("OP_2", 4);
const auto& cs2 = well.getConnections( );
BOOST_CHECK_EQUAL(comp_open, cs2.getFromIJK( 7, 6, 2 ).state());
BOOST_CHECK_EQUAL(comp_open, cs2.getFromIJK( 7, 6, 3 ).state());
BOOST_CHECK_EQUAL(comp_open, cs2.getFromIJK( 7, 6, 4 ).state());
BOOST_CHECK_EQUAL(comp_open, cs2.getFromIJK( 7, 7, 2 ).state());
BOOST_CHECK(comp_open == cs2.getFromIJK( 7, 6, 2 ).state());
BOOST_CHECK(comp_open == cs2.getFromIJK( 7, 6, 3 ).state());
BOOST_CHECK(comp_open == cs2.getFromIJK( 7, 6, 4 ).state());
BOOST_CHECK(comp_open == cs2.getFromIJK( 7, 7, 2 ).state());
}
{
const auto& well = schedule.getWell2("OP_3", 3);
const auto& cs3 = well.getConnections( );
BOOST_CHECK_EQUAL(comp_shut, cs3.get( 0 ).state());
BOOST_CHECK(comp_shut == cs3.get( 0 ).state());
}
{
const auto& well = schedule.getWell2("OP_3", 4);
const auto& cs4 = well.getConnections( );
BOOST_CHECK_EQUAL(comp_open, cs4.get( 0 ).state());
BOOST_CHECK(comp_open == cs4.get( 0 ).state());
}
}
}
@ -2201,8 +2201,8 @@ BOOST_AUTO_TEST_CASE( complump ) {
/
)";
constexpr auto open = WellCompletion::StateEnum::OPEN;
constexpr auto shut = WellCompletion::StateEnum::SHUT;
constexpr auto open = Connection::State::OPEN;
constexpr auto shut = Connection::State::SHUT;
auto deck = Parser().parseString(input);
EclipseGrid grid(10,10,10);
@ -2217,15 +2217,15 @@ BOOST_AUTO_TEST_CASE( complump ) {
BOOST_CHECK_EQUAL( 1, sc0.getFromIJK( 2, 2, 1 ).complnum() );
BOOST_CHECK_EQUAL( 1, sc0.getFromIJK( 2, 2, 2 ).complnum() );
BOOST_CHECK_EQUAL( shut, sc0.getFromIJK( 2, 2, 0 ).state() );
BOOST_CHECK_EQUAL( shut, sc0.getFromIJK( 2, 2, 1 ).state() );
BOOST_CHECK_EQUAL( shut, sc0.getFromIJK( 2, 2, 2 ).state() );
BOOST_CHECK( shut == sc0.getFromIJK( 2, 2, 0 ).state() );
BOOST_CHECK( shut == sc0.getFromIJK( 2, 2, 1 ).state() );
BOOST_CHECK( shut == sc0.getFromIJK( 2, 2, 2 ).state() );
const auto& sc1 = schedule.getWell2("W1", 1).getConnections();
BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 0 ).state() );
BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 1 ).state() );
BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 2 ).state() );
BOOST_CHECK_EQUAL( shut, sc1.getFromIJK( 2, 2, 3 ).state() );
BOOST_CHECK( open == sc1.getFromIJK( 2, 2, 0 ).state() );
BOOST_CHECK( open == sc1.getFromIJK( 2, 2, 1 ).state() );
BOOST_CHECK( open == sc1.getFromIJK( 2, 2, 2 ).state() );
BOOST_CHECK( shut == sc1.getFromIJK( 2, 2, 3 ).state() );
const auto& completions = schedule.getWell2("W1", 1).getCompletions();
BOOST_CHECK_EQUAL(completions.size(), 4);
@ -2291,8 +2291,8 @@ BOOST_AUTO_TEST_CASE( COMPLUMP_specific_coordinates ) {
/
)";
constexpr auto open = WellCompletion::StateEnum::OPEN;
constexpr auto shut = WellCompletion::StateEnum::SHUT;
constexpr auto open = Connection::State::OPEN;
constexpr auto shut = Connection::State::SHUT;
auto deck = Parser().parseString( input);
EclipseGrid grid( 10, 10, 10 );
@ -2304,50 +2304,50 @@ BOOST_AUTO_TEST_CASE( COMPLUMP_specific_coordinates ) {
const auto& cs1 = schedule.getWell2("W1", 1).getConnections();
const auto& cs2 = schedule.getWell2("W1", 2).getConnections();
BOOST_CHECK_EQUAL( 9U, cs1.size() );
BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 0, 0, 1 ).state() );
BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 2, 2, 0 ).state() );
BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 2, 2, 1 ).state() );
BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 2, 2, 2 ).state() );
BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 1, 1, 0 ).state() );
BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 1, 1, 3 ).state() );
BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 1, 1, 4 ).state() );
BOOST_CHECK_EQUAL( shut, cs1.getFromIJK( 1, 1, 5 ).state() );
BOOST_CHECK( shut == cs1.getFromIJK( 0, 0, 1 ).state() );
BOOST_CHECK( shut == cs1.getFromIJK( 2, 2, 0 ).state() );
BOOST_CHECK( shut == cs1.getFromIJK( 2, 2, 1 ).state() );
BOOST_CHECK( shut == cs1.getFromIJK( 2, 2, 2 ).state() );
BOOST_CHECK( shut == cs1.getFromIJK( 1, 1, 0 ).state() );
BOOST_CHECK( shut == cs1.getFromIJK( 1, 1, 3 ).state() );
BOOST_CHECK( shut == cs1.getFromIJK( 1, 1, 4 ).state() );
BOOST_CHECK( shut == cs1.getFromIJK( 1, 1, 5 ).state() );
BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 0, 0, 1 ).state() );
BOOST_CHECK_EQUAL( shut, cs2.getFromIJK( 2, 2, 0 ).state() );
BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 2, 2, 1 ).state() );
BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 2, 2, 2 ).state() );
BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 1, 1, 0 ).state() );
BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 1, 1, 3 ).state() );
BOOST_CHECK_EQUAL( open, cs2.getFromIJK( 1, 1, 4 ).state() );
BOOST_CHECK_EQUAL( shut, cs2.getFromIJK( 1, 1, 5 ).state() );
BOOST_CHECK( open == cs2.getFromIJK( 0, 0, 1 ).state() );
BOOST_CHECK( shut == cs2.getFromIJK( 2, 2, 0 ).state() );
BOOST_CHECK( open == cs2.getFromIJK( 2, 2, 1 ).state() );
BOOST_CHECK( open == cs2.getFromIJK( 2, 2, 2 ).state() );
BOOST_CHECK( open == cs2.getFromIJK( 1, 1, 0 ).state() );
BOOST_CHECK( open == cs2.getFromIJK( 1, 1, 3 ).state() );
BOOST_CHECK( open == cs2.getFromIJK( 1, 1, 4 ).state() );
BOOST_CHECK( shut == cs2.getFromIJK( 1, 1, 5 ).state() );
}
BOOST_AUTO_TEST_CASE(TestCompletionStateEnum2String) {
BOOST_CHECK_EQUAL( "AUTO" , WellCompletion::StateEnum2String(WellCompletion::AUTO));
BOOST_CHECK_EQUAL( "OPEN" , WellCompletion::StateEnum2String(WellCompletion::OPEN));
BOOST_CHECK_EQUAL( "SHUT" , WellCompletion::StateEnum2String(WellCompletion::SHUT));
BOOST_CHECK( "AUTO" == Connection::State2String(Connection::State::AUTO));
BOOST_CHECK( "OPEN" == Connection::State2String(Connection::State::OPEN));
BOOST_CHECK( "SHUT" == Connection::State2String(Connection::State::SHUT));
}
BOOST_AUTO_TEST_CASE(TestCompletionStateEnumFromString) {
BOOST_CHECK_THROW( WellCompletion::StateEnumFromString("XXX") , std::invalid_argument );
BOOST_CHECK_EQUAL( WellCompletion::AUTO , WellCompletion::StateEnumFromString("AUTO"));
BOOST_CHECK_EQUAL( WellCompletion::SHUT , WellCompletion::StateEnumFromString("SHUT"));
BOOST_CHECK_EQUAL( WellCompletion::SHUT , WellCompletion::StateEnumFromString("STOP"));
BOOST_CHECK_EQUAL( WellCompletion::OPEN , WellCompletion::StateEnumFromString("OPEN"));
BOOST_CHECK_THROW( Connection::StateFromString("XXX") , std::invalid_argument );
BOOST_CHECK( Connection::State::AUTO == Connection::StateFromString("AUTO"));
BOOST_CHECK( Connection::State::SHUT == Connection::StateFromString("SHUT"));
BOOST_CHECK( Connection::State::SHUT == Connection::StateFromString("STOP"));
BOOST_CHECK( Connection::State::OPEN == Connection::StateFromString("OPEN"));
}
BOOST_AUTO_TEST_CASE(TestCompletionStateEnumLoop) {
BOOST_CHECK_EQUAL( WellCompletion::AUTO , WellCompletion::StateEnumFromString( WellCompletion::StateEnum2String( WellCompletion::AUTO ) ));
BOOST_CHECK_EQUAL( WellCompletion::SHUT , WellCompletion::StateEnumFromString( WellCompletion::StateEnum2String( WellCompletion::SHUT ) ));
BOOST_CHECK_EQUAL( WellCompletion::OPEN , WellCompletion::StateEnumFromString( WellCompletion::StateEnum2String( WellCompletion::OPEN ) ));
BOOST_CHECK( Connection::State::AUTO == Connection::StateFromString( Connection::State2String( Connection::State::AUTO ) ));
BOOST_CHECK( Connection::State::SHUT == Connection::StateFromString( Connection::State2String( Connection::State::SHUT ) ));
BOOST_CHECK( Connection::State::OPEN == Connection::StateFromString( Connection::State2String( Connection::State::OPEN ) ));
BOOST_CHECK_EQUAL( "AUTO" , WellCompletion::StateEnum2String(WellCompletion::StateEnumFromString( "AUTO" ) ));
BOOST_CHECK_EQUAL( "OPEN" , WellCompletion::StateEnum2String(WellCompletion::StateEnumFromString( "OPEN" ) ));
BOOST_CHECK_EQUAL( "SHUT" , WellCompletion::StateEnum2String(WellCompletion::StateEnumFromString( "SHUT" ) ));
BOOST_CHECK( "AUTO" == Connection::State2String(Connection::StateFromString( "AUTO" ) ));
BOOST_CHECK( "OPEN" == Connection::State2String(Connection::StateFromString( "OPEN" ) ));
BOOST_CHECK( "SHUT" == Connection::State2String(Connection::StateFromString( "SHUT" ) ));
}
@ -3199,7 +3199,7 @@ BOOST_AUTO_TEST_CASE(WELL_STATIC) {
auto c2 = std::make_shared<WellConnections>(1,1);
c2->addConnection(1,1,1,
100,
WellCompletion::StateEnum::OPEN,
Connection::State::OPEN,
10,
10,
10,

View File

@ -268,13 +268,13 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) {
const auto& connections = sched.getWell2("W_1", 3).getConnections();
BOOST_CHECK_EQUAL(4U, connections.size());
BOOST_CHECK(WellCompletion::OPEN == connections.get(3).state());
BOOST_CHECK(Connection::State::OPEN == connections.get(3).state());
BOOST_CHECK_EQUAL(2.2836805555555556e-12 , connections.get(3).CF());
}
{
const auto& connections = sched.getWell2("W_1", 7).getConnections();
BOOST_CHECK_EQUAL(4U, connections.size() );
BOOST_CHECK(WellCompletion::SHUT == connections.get( 3 ).state() );
BOOST_CHECK(Connection::State::SHUT == connections.get( 3 ).state() );
}
}
}