Rename CompletionSet -> ConnectionSet

This commit is contained in:
Joakim Hove 2018-06-10 20:54:34 +02:00
parent d39db2f0db
commit 3975db2ff3
35 changed files with 482 additions and 488 deletions

View File

@ -74,7 +74,7 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.cpp
src/opm/parser/eclipse/EclipseState/Runspec.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Connection.cpp
src/opm/parser/eclipse/EclipseState/Schedule/CompletionSet.cpp
src/opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Events.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group.cpp
src/opm/parser/eclipse/EclipseState/Schedule/GroupTree.cpp
@ -82,7 +82,7 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/SegmentSet.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingCompletionsWithSegments.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.cpp
src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp
src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp
@ -457,11 +457,11 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/SegmentSet.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/updatingCompletionsWithSegments.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp
opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/WellTestState.hpp
opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp
opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp
opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp
opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp
opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp

View File

@ -101,7 +101,7 @@ namespace Opm {
double reservoir_gas = 0.0;
};
struct Completion {
struct Connection {
using global_index = size_t;
static const constexpr int restart_size = 2;
@ -125,7 +125,7 @@ namespace Opm {
double thp;
double temperature;
int control;
std::vector< Completion > completions;
std::vector< Connection > connections;
inline bool flowing() const noexcept;
template <class MessageBufferType>
@ -146,20 +146,20 @@ namespace Opm {
}
double get(const std::string& well_name , Completion::global_index completion_grid_index, Rates::opt m) const {
double get(const std::string& well_name , Connection::global_index connection_grid_index, Rates::opt m) const {
const auto& witr = this->find( well_name );
if( witr == this->end() ) return 0.0;
const auto& well = witr->second;
const auto& completion = std::find_if( well.completions.begin() ,
well.completions.end() ,
[=]( const Completion& c ) {
return c.index == completion_grid_index; });
const auto& connection = std::find_if( well.connections.begin() ,
well.connections.end() ,
[=]( const Connection& c ) {
return c.index == connection_grid_index; });
if( completion == well.completions.end() )
if( connection == well.connections.end() )
return 0.0;
return completion->rates.get( m, 0.0 );
return connection->rates.get( m, 0.0 );
}
template <class MessageBufferType>
@ -288,7 +288,7 @@ namespace Opm {
}
template <class MessageBufferType>
void Completion::write(MessageBufferType& buffer) const {
void Connection::write(MessageBufferType& buffer) const {
buffer.write(this->index);
this->rates.write(buffer);
buffer.write(this->pressure);
@ -305,9 +305,9 @@ namespace Opm {
buffer.write(this->thp);
buffer.write(this->temperature);
buffer.write(this->control);
unsigned int size = this->completions.size();
unsigned int size = this->connections.size();
buffer.write(size);
for (const Completion& comp : this->completions)
for (const Connection& comp : this->connections)
comp.write(buffer);
}
@ -328,7 +328,7 @@ namespace Opm {
}
template <class MessageBufferType>
void Completion::read(MessageBufferType& buffer) {
void Connection::read(MessageBufferType& buffer) {
buffer.read(this->index);
this->rates.read(buffer);
buffer.read(this->pressure);
@ -345,12 +345,12 @@ namespace Opm {
buffer.read(this->thp);
buffer.read(this->temperature);
buffer.read(this->control);
unsigned int size = 0.0; //this->completions.size();
unsigned int size = 0.0; //this->connections.size();
buffer.read(size);
this->completions.resize(size);
this->connections.resize(size);
for (size_t i = 0; i < size; ++i)
{
auto& comp = this->completions[ i ];
auto& comp = this->connections[ i ];
comp.read(buffer);
}
}

View File

@ -32,12 +32,12 @@ namespace out {
public:
RegionCache() = default;
RegionCache(const Eclipse3DProperties& properties, const EclipseGrid& grid, const Schedule& schedule);
const std::vector<std::pair<std::string,size_t>>& completions( int region_id ) const;
const std::vector<std::pair<std::string,size_t>>& connections( int region_id ) const;
private:
std::vector<std::pair<std::string,size_t>> completions_empty;
std::vector<std::pair<std::string,size_t>> connections_empty;
std::map<int , std::vector<std::pair<std::string,size_t>>> completion_map;
std::map<int , std::vector<std::pair<std::string,size_t>>> connection_map;
};
}
}

View File

@ -18,20 +18,20 @@
*/
#ifndef COMPLETIONSET_HPP_
#define COMPLETIONSET_HPP_
#ifndef CONNECTIONSET_HPP_
#define CONNECTIONSET_HPP_
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
namespace Opm {
class EclipseGrid;
class CompletionSet {
class ConnectionSet {
public:
CompletionSet() = default;
ConnectionSet() = default;
// cppcheck-suppress noExplicitConstructor
CompletionSet( std::initializer_list< Connection > );
CompletionSet(const CompletionSet& src, const EclipseGrid& grid);
ConnectionSet( std::initializer_list< Connection > );
ConnectionSet(const ConnectionSet& src, const EclipseGrid& grid);
using const_iterator = std::vector< Connection >::const_iterator;
@ -43,27 +43,27 @@ namespace Opm {
const_iterator begin() const { return this->m_connections.begin(); }
const_iterator end() const { return this->m_connections.end(); }
void filter(const EclipseGrid& grid);
bool allCompletionsShut() const;
/// Order completions irrespective of input order.
bool allConnectionsShut() const;
/// Order connections irrespective of input order.
/// The algorithm used is the following:
/// 1. The completion nearest to the given (well_i, well_j)
/// coordinates in terms of the completion's (i, j) is chosen
/// to be the first completion. If non-unique, choose one with
/// 1. The connection nearest to the given (well_i, well_j)
/// coordinates in terms of the connection's (i, j) is chosen
/// to be the first connection. If non-unique, choose one with
/// lowest z-depth (shallowest).
/// 2. Choose next completion to be nearest to current in (i, j) sense.
/// 2. Choose next connection to be nearest to current in (i, j) sense.
/// If non-unique choose closest in z-depth (not logical cartesian k).
///
/// \param[in] well_i logical cartesian i-coordinate of well head
/// \param[in] well_j logical cartesian j-coordinate of well head
/// \param[in] grid EclipseGrid object, used for cell depths
void orderCompletions(size_t well_i, size_t well_j);
void orderConnections(size_t well_i, size_t well_j);
bool operator==( const CompletionSet& ) const;
bool operator!=( const CompletionSet& ) const;
bool operator==( const ConnectionSet& ) const;
bool operator!=( const ConnectionSet& ) const;
private:
std::vector< Connection > m_connections;
size_t findClosestCompletion(int oi, int oj, double oz, size_t start_pos);
size_t findClosestConnection(int oi, int oj, double oz, size_t start_pos);
};
}

View File

@ -17,16 +17,16 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UPDATING_COMPLETIONS_WITH_SEGMENTS
#define UPDATING_COMPLETIONS_WITH_SEGMENTS
#ifndef UPDATING_CONNECTIONS_WITH_SEGMENTS
#define UPDATING_CONNECTIONS_WITH_SEGMENTS
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SegmentSet.hpp>
namespace Opm {
CompletionSet updatingCompletionsWithSegments(const DeckKeyword& compsegs, const CompletionSet& input_completions, const SegmentSet& segments);
ConnectionSet updatingConnectionsWithSegments(const DeckKeyword& compsegs, const ConnectionSet& input_connections, const SegmentSet& segments);
}
#endif

View File

@ -79,7 +79,7 @@ namespace Opm
size_t numWells() const;
size_t numWells(size_t timestep) const;
size_t getMaxNumCompletionsForWells(size_t timestep) const;
size_t getMaxNumConnectionsForWells(size_t timestep) const;
bool hasWell(const std::string& wellName) const;
const Well* getWell(const std::string& wellName) const;
std::vector< const Well* > getOpenWells(size_t timeStep) const;
@ -121,7 +121,7 @@ namespace Opm
Will remove all completions which are connected to cell which is not
active. Will scan through all wells and all timesteps.
*/
void filterCompletions(const EclipseGrid& grid);
void filterConnections(const EclipseGrid& grid);
private:
TimeMap m_timeMap;

View File

@ -27,7 +27,7 @@
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/WellEconProductionLimits.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/WellInjectionProperties.hpp>
@ -41,7 +41,7 @@ namespace Opm {
template< typename > class DynamicState;
class COnnection;
class CompletionSet;
class ConnectionSet;
class Segment;
class SegmentSet;
class TimeMap;
@ -94,11 +94,11 @@ namespace Opm {
bool isInjector(size_t timeStep) const;
void addWELSPECS(const DeckRecord& deckRecord);
void addCompletions(size_t time_step, const std::vector< Connection >& );
void addCompletionSet(size_t time_step, CompletionSet );
const CompletionSet& getCompletions(size_t timeStep) const;
const CompletionSet& getCompletions() const;
CompletionSet getActiveCompletions(size_t timeStep, const EclipseGrid& grid) const;
void addConnections(size_t time_step, const std::vector< Connection >& );
void addConnectionSet(size_t time_step, ConnectionSet );
const ConnectionSet& getConnections(size_t timeStep) const;
const ConnectionSet& getConnections() const;
ConnectionSet getActiveConnections(size_t timeStep, const EclipseGrid& grid) const;
/* The rate of a given phase under the following assumptions:
* * Returns zero if production is requested for an injector (and vice
@ -148,7 +148,7 @@ namespace Opm {
static bool wellNameInWellNamePattern(const std::string& wellName, const std::string& wellNamePattern);
WellCompletion::CompletionOrderEnum getWellCompletionOrdering() const;
WellCompletion::CompletionOrderEnum getWellConnectionOrdering() const;
bool getAllowCrossFlow() const;
bool getAutomaticShutIn() const;
@ -169,7 +169,7 @@ namespace Opm {
Will remove all completions which are attached to inactive cells. Will
scan through all timesteps.
*/
void filterCompletions(const EclipseGrid& grid);
void filterConnections(const EclipseGrid& grid);
private:
size_t m_creationTimeStep;
std::string m_name;
@ -183,7 +183,7 @@ namespace Opm {
DynamicState< double > m_efficiencyFactors;
DynamicState< int > m_isProducer;
DynamicState< CompletionSet > m_completions;
DynamicState< ConnectionSet > m_completions;
DynamicState< WellProductionProperties > m_productionProperties;
DynamicState< WellInjectionProperties > m_injectionProperties;
DynamicState< WellPolymerProperties > m_polymerProperties;

View File

@ -33,7 +33,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
@ -153,30 +153,30 @@ void RFT::writeTimeStep( std::vector< const Well* > wells,
const auto& wellData = wellDatas.at(well->name());
if (wellData.completions.empty())
if (wellData.connections.empty())
continue;
for( const auto& completion : well->getCompletions( report_step ) ) {
for( const auto& connection : well->getConnections( report_step ) ) {
const size_t i = size_t( completion.getI() );
const size_t j = size_t( completion.getJ() );
const size_t k = size_t( completion.getK() );
const size_t i = size_t( connection.getI() );
const size_t j = size_t( connection.getJ() );
const size_t k = size_t( connection.getK() );
if( !grid.cellActive( i, j, k ) ) continue;
const auto index = grid.getGlobalIndex( i, j, k );
const double depth = grid.getCellDepth( i, j, k );
const auto& completionData = std::find_if( wellData.completions.begin(),
wellData.completions.end(),
[=]( const data::Completion& c ) {
const auto& connectionData = std::find_if( wellData.connections.begin(),
wellData.connections.end(),
[=]( const data::Connection& c ) {
return c.index == index;
} );
const double press = units.from_si(UnitSystem::measure::pressure,completionData->cell_pressure);
const double satwat = units.from_si(UnitSystem::measure::identity, completionData->cell_saturation_water);
const double satgas = units.from_si(UnitSystem::measure::identity, completionData->cell_saturation_gas);
const double press = units.from_si(UnitSystem::measure::pressure,connectionData->cell_pressure);
const double satwat = units.from_si(UnitSystem::measure::identity, connectionData->cell_saturation_water);
const double satgas = units.from_si(UnitSystem::measure::identity, connectionData->cell_saturation_gas);
auto* cell = ecl_rft_cell_alloc_RFT(
i, j, k, depth, press, satwat, satgas );

View File

@ -18,7 +18,7 @@
*/
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
@ -35,13 +35,13 @@ RegionCache::RegionCache(const Eclipse3DProperties& properties, const EclipseGri
const auto& wells = schedule.getWells();
for (const auto& well : wells) {
const auto& completions = well->getCompletions( );
for (const auto& c : completions) {
const auto& connections = well->getConnections( );
for (const auto& c : connections) {
size_t global_index = grid.getGlobalIndex( c.getI() , c.getJ() , c.getK());
if (grid.cellActive( global_index )) {
size_t active_index = grid.activeIndex( global_index );
int region_id =fipnum.iget( global_index );
auto& well_index_list = this->completion_map[ region_id ];
auto& well_index_list = this->connection_map[ region_id ];
well_index_list.push_back( { well->name() , active_index } );
}
}
@ -49,10 +49,10 @@ RegionCache::RegionCache(const Eclipse3DProperties& properties, const EclipseGri
}
const std::vector<std::pair<std::string,size_t>>& RegionCache::completions( int region_id ) const {
const auto iter = this->completion_map.find( region_id );
if (iter == this->completion_map.end())
return this->completions_empty;
const std::vector<std::pair<std::string,size_t>>& RegionCache::connections( int region_id ) const {
const auto iter = this->connection_map.find( region_id );
if (iter == this->connection_map.end())
return this->connections_empty;
else
return iter->second;
}

View File

@ -57,13 +57,13 @@ namespace {
static const int NIWELZ = 11; //Number of data elements per well in IWEL array in restart file
static const int NZWELZ = 3; //Number of 8-character words per well in ZWEL array restart file
static const int NICONZ = 15; //Number of data elements per completion in ICON array restart file
static const int NICONZ = 15; //Number of data elements per connection in ICON array restart file
/**
* The constants NIWELZ and NZWELZ referes to the number of
* elements per well that we write to the IWEL and ZWEL eclipse
* restart file data arrays. The constant NICONZ refers to the
* number of elements per completion in the eclipse restart file
* number of elements per connection in the eclipse restart file
* ICON data array.These numbers are written to the INTEHEAD
* header.
*
@ -157,8 +157,8 @@ data::Wells restore_wells( const ecl_kw_type * opm_xwel,
const auto well_size = [&]( size_t acc, const Well* w ) {
return acc
+ 2 + phases.size()
+ ( w->getCompletions( sim_step ).size()
* (phases.size() + data::Completion::restart_size) );
+ ( w->getConnections( sim_step ).size()
* (phases.size() + data::Connection::restart_size) );
};
const auto expected_xwel_size = std::accumulate( sched_wells.begin(),
@ -192,22 +192,22 @@ data::Wells restore_wells( const ecl_kw_type * opm_xwel,
for( auto phase : phases )
well.rates.set( phase, *opm_xwel_data++ );
for( const auto& sc : sched_well->getCompletions( sim_step ) ) {
for( const auto& sc : sched_well->getConnections( sim_step ) ) {
const auto i = sc.getI(), j = sc.getJ(), k = sc.getK();
if( !grid.cellActive( i, j, k ) || sc.getState() == WellCompletion::SHUT ) {
opm_xwel_data += data::Completion::restart_size + phases.size();
opm_xwel_data += data::Connection::restart_size + phases.size();
continue;
}
const auto active_index = grid.activeIndex( i, j, k );
well.completions.emplace_back();
auto& completion = well.completions.back();
completion.index = active_index;
completion.pressure = *opm_xwel_data++;
completion.reservoir_rate = *opm_xwel_data++;
well.connections.emplace_back();
auto& connection = well.connections.back();
connection.index = active_index;
connection.pressure = *opm_xwel_data++;
connection.reservoir_rate = *opm_xwel_data++;
for( auto phase : phases )
completion.rates.set( phase, *opm_xwel_data++ );
connection.rates.set( phase, *opm_xwel_data++ );
}
}
@ -289,24 +289,24 @@ std::vector<int> serialize_ICON( int sim_step,
size_t well_offset = 0;
std::vector<int> data( sched_wells.size() * ncwmax * NICONZ , 0 );
for (const Well* well : sched_wells) {
const auto& completions = well->getCompletions( sim_step );
size_t completion_offset = 0;
for( const auto& completion : completions) {
size_t offset = well_offset + completion_offset;
const auto& connections = well->getConnections( sim_step );
size_t connection_offset = 0;
for( const auto& connection : connections) {
size_t offset = well_offset + connection_offset;
data[ offset + ICON_IC_INDEX ] = 1;
data[ offset + ICON_I_INDEX ] = completion.getI() + 1;
data[ offset + ICON_J_INDEX ] = completion.getJ() + 1;
data[ offset + ICON_K_INDEX ] = completion.getK() + 1;
data[ offset + ICON_DIRECTION_INDEX ] = completion.getDirection();
data[ offset + ICON_I_INDEX ] = connection.getI() + 1;
data[ offset + ICON_J_INDEX ] = connection.getJ() + 1;
data[ offset + ICON_K_INDEX ] = connection.getK() + 1;
data[ offset + ICON_DIRECTION_INDEX ] = connection.getDirection();
{
const auto open = WellCompletion::StateEnum::OPEN;
data[ offset + ICON_STATUS_INDEX ] = completion.getState() == open
data[ offset + ICON_STATUS_INDEX ] = connection.getState() == open
? 1
: 0;
}
completion_offset += NICONZ;
connection_offset += NICONZ;
}
well_offset += ncwmax * NICONZ;
}
@ -320,11 +320,11 @@ std::vector<int> serialize_IWEL( size_t step,
std::vector<int> data( wells.size() * NIWELZ , 0 );
size_t offset = 0;
for (const auto well : wells) {
const auto& completions = well->getActiveCompletions( step, grid );
const auto& connections = well->getActiveConnections( step, grid );
data[ offset + IWEL_HEADI_INDEX ] = well->getHeadI( step ) + 1;
data[ offset + IWEL_HEADJ_INDEX ] = well->getHeadJ( step ) + 1;
data[ offset + IWEL_CONNECTIONS_INDEX ] = completions.size();
data[ offset + IWEL_CONNECTIONS_INDEX ] = connections.size();
data[ offset + IWEL_GROUP_INDEX ] = 1;
data[ offset + IWEL_TYPE_INDEX ] = to_ert_welltype( *well, step );
@ -375,8 +375,8 @@ std::vector< double > serialize_OPM_XWEL( const data::Wells& wells,
for( const auto* sched_well : sched_wells ) {
if( wells.count( sched_well->name() ) == 0 || sched_well->getStatus(sim_step) == Opm::WellCommon::SHUT) {
const auto elems = (sched_well->getCompletions( sim_step ).size()
* (phases.size() + data::Completion::restart_size))
const auto elems = (sched_well->getConnections( sim_step ).size()
* (phases.size() + data::Connection::restart_size))
+ 2 /* bhp, temperature */
+ phases.size();
@ -392,32 +392,32 @@ std::vector< double > serialize_OPM_XWEL( const data::Wells& wells,
for( auto phase : phases )
xwel.push_back( well.rates.get( phase ) );
for( const auto& sc : sched_well->getCompletions( sim_step ) ) {
for( const auto& sc : sched_well->getConnections( sim_step ) ) {
const auto i = sc.getI(), j = sc.getJ(), k = sc.getK();
const auto rs_size = phases.size() + data::Completion::restart_size;
const auto rs_size = phases.size() + data::Connection::restart_size;
if( !grid.cellActive( i, j, k ) || sc.getState() == WellCompletion::SHUT ) {
xwel.insert( xwel.end(), rs_size, 0.0 );
continue;
}
const auto active_index = grid.activeIndex( i, j, k );
const auto at_index = [=]( const data::Completion& c ) {
const auto at_index = [=]( const data::Connection& c ) {
return c.index == active_index;
};
const auto& completion = std::find_if( well.completions.begin(),
well.completions.end(),
const auto& connection = std::find_if( well.connections.begin(),
well.connections.end(),
at_index );
if( completion == well.completions.end() ) {
if( connection == well.connections.end() ) {
xwel.insert( xwel.end(), rs_size, 0.0 );
continue;
}
xwel.push_back( completion->pressure );
xwel.push_back( completion->reservoir_rate );
xwel.push_back( connection->pressure );
xwel.push_back( connection->reservoir_rate );
for( auto phase : phases )
xwel.push_back( completion->rates.get( phase ) );
xwel.push_back( connection->rates.get( phase ) );
}
}
@ -466,7 +466,7 @@ void writeHeader(ecl_rst_file_type * rst_file,
rsthead_data.niwelz = NIWELZ;
rsthead_data.nzwelz = NZWELZ;
rsthead_data.niconz = NICONZ;
rsthead_data.ncwmax = schedule.getMaxNumCompletionsForWells(sim_step);
rsthead_data.ncwmax = schedule.getMaxNumConnectionsForWells(sim_step);
rsthead_data.phase_sum = ert_phase_mask;
rsthead_data.sim_days = sim_days;
rsthead_data.unit_system = units.getEclType( );
@ -531,7 +531,7 @@ void writeHeader(ecl_rst_file_type * rst_file,
void writeWell(ecl_rst_file_type* rst_file, int sim_step, const EclipseState& es , const EclipseGrid& grid, const Schedule& schedule, const data::Wells& wells) {
const auto sched_wells = schedule.getWells(sim_step);
const auto& phases = es.runspec().phases();
const size_t ncwmax = schedule.getMaxNumCompletionsForWells(sim_step);
const size_t ncwmax = schedule.getMaxNumConnectionsForWells(sim_step);
const auto opm_xwel = serialize_OPM_XWEL( wells, sim_step, sched_wells, phases, grid );
const auto opm_iwel = serialize_OPM_IWEL( wells, sched_wells );

View File

@ -247,13 +247,13 @@ inline quantity crate( const fn_args& args ) {
if( args.wells.count( name ) == 0 ) return zero;
const auto& well = args.wells.at( name );
const auto& completion = std::find_if( well.completions.begin(),
well.completions.end(),
[=]( const data::Completion& c ) {
const auto& completion = std::find_if( well.connections.begin(),
well.connections.end(),
[=]( const data::Connection& c ) {
return c.index == global_index;
} );
if( completion == well.completions.end() ) return zero;
if( completion == well.connections.end() ) return zero;
double eff_fac = efac( args.eff_factors, name );
@ -381,9 +381,9 @@ inline quantity duration( const fn_args& args ) {
template<rt phase , bool injection>
quantity region_rate( const fn_args& args ) {
double sum = 0;
const auto& well_completions = args.regionCache.completions( args.num );
const auto& well_connections = args.regionCache.connections( args.num );
for (const auto& pair : well_completions) {
for (const auto& pair : well_connections) {
double eff_fac = efac( args.eff_factors, pair.first );
@ -776,8 +776,8 @@ inline std::vector< const Well* > find_wells( const Schedule& schedule,
const auto region = smspec_node_get_num( node );
for ( const auto& completion : regionCache.completions( region ) ){
const auto& w_name = completion.first;
for ( const auto& connection : regionCache.connections( region ) ){
const auto& w_name = connection.first;
const auto& well = schedule.getWell( w_name );
const auto& it = std::find_if( wells.begin(), wells.end(),

View File

@ -37,12 +37,12 @@ serialize_SCON(int lookup_step,
std::vector<double> data(sched_wells.size() * well_field_size, 0);
size_t well_offset = 0;
for (const Opm::Well* well : sched_wells) {
const auto& completions = well->getCompletions( lookup_step );
size_t completion_offset = 0;
const auto& connections = well->getConnections( lookup_step );
size_t connection_offset = 0;
bool explicit_ctf_not_found = false;
for (const auto& completion : completions) {
const size_t offset = well_offset + completion_offset;
const auto& ctf = completion.getConnectionTransmissibilityFactorAsValueObject();
for (const auto& connection : connections) {
const size_t offset = well_offset + connection_offset;
const auto& ctf = connection.getConnectionTransmissibilityFactorAsValueObject();
if (ctf.hasValue()) {
// CTF explicitly set in deck, overrides calculation
// from Peaceman model. We should also give the Kh
@ -65,10 +65,10 @@ serialize_SCON(int lookup_step,
data[ offset + SCON_KH_INDEX ] = UNIMPLEMENTED_VALUE;
explicit_ctf_not_found = true;
}
completion_offset += nsconz;
connection_offset += nsconz;
}
if (explicit_ctf_not_found) {
OpmLog::warning("restart output completion data missing",
OpmLog::warning("restart output connection data missing",
"Explicit connection transmissibility factors for well " + well->name() + " missing, writing dummy values to restart file.");
}
well_offset += well_field_size;
@ -89,25 +89,25 @@ serialize_ICON(int lookup_step,
std::vector<int> data(sched_wells.size() * well_field_size, 0);
size_t well_offset = 0;
for (const Opm::Well* well : sched_wells) {
const auto& completions = well->getCompletions( lookup_step );
size_t completion_offset = 0;
for (const auto& completion : completions) {
const size_t offset = well_offset + completion_offset;
const auto& connections = well->getConnections( lookup_step );
size_t connection_offset = 0;
for (const auto& connection : connections) {
const size_t offset = well_offset + connection_offset;
data[ offset + ICON_IC_INDEX ] = completion.complnum();
data[ offset + ICON_I_INDEX ] = completion.getI() + 1;
data[ offset + ICON_J_INDEX ] = completion.getJ() + 1;
data[ offset + ICON_K_INDEX ] = completion.getK() + 1;
data[ offset + ICON_DIRECTION_INDEX ] = completion.getDirection();
data[ offset + ICON_IC_INDEX ] = connection.complnum();
data[ offset + ICON_I_INDEX ] = connection.getI() + 1;
data[ offset + ICON_J_INDEX ] = connection.getJ() + 1;
data[ offset + ICON_K_INDEX ] = connection.getK() + 1;
data[ offset + ICON_DIRECTION_INDEX ] = connection.getDirection();
data[ offset + ICON_STATUS_INDEX ] =
(completion.getState() == WellCompletion::StateEnum::OPEN) ?
(connection.getState() == WellCompletion::StateEnum::OPEN) ?
1 : -1000;
data[ offset + ICON_SEGMENT_INDEX ] =
completion.attachedToSegment() ?
completion.getSegmentNumber() : 0;
completion_offset += niconz;
connection.attachedToSegment() ?
connection.getSegmentNumber() : 0;
connection_offset += niconz;
}
well_offset += well_field_size;
}

View File

@ -24,43 +24,43 @@
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
namespace Opm {
CompletionSet::CompletionSet( std::initializer_list< Connection > cs ) {
ConnectionSet::ConnectionSet( std::initializer_list< Connection > cs ) {
for( auto&& c : cs ) this->add( c );
}
CompletionSet::CompletionSet(const CompletionSet& src, const EclipseGrid& grid) {
ConnectionSet::ConnectionSet(const ConnectionSet& src, const EclipseGrid& grid) {
for (const auto& c : src) {
if (grid.cellActive(c.getI(), c.getJ(), c.getK()))
this->add(c);
}
}
size_t CompletionSet::size() const {
size_t ConnectionSet::size() const {
return m_connections.size();
}
const Connection& CompletionSet::get(size_t index) const {
const Connection& ConnectionSet::get(size_t index) const {
return this->m_connections.at( index );
}
const Connection& CompletionSet::getFromIJK(const int i, const int j, const int k) const {
const Connection& ConnectionSet::getFromIJK(const int i, const int j, const int k) const {
for (size_t ic = 0; ic < size(); ++ic) {
if (get(ic).sameCoordinate(i, j, k)) {
return get(ic);
}
}
throw std::runtime_error(" the completion is not found! \n ");
throw std::runtime_error(" the connection is not found! \n ");
}
void CompletionSet::add( Connection completion ) {
void ConnectionSet::add( Connection connection ) {
auto same = [&]( const Connection& c ) {
return c.sameCoordinate( completion );
return c.sameCoordinate( connection );
};
auto prev = std::find_if( this->m_connections.begin(),
@ -69,14 +69,14 @@ namespace Opm {
if( prev != this->m_connections.end() ) {
// update the completion, but preserve it's number
*prev = Connection( completion, prev->complnum() );
*prev = Connection( connection, prev->complnum() );
return;
}
m_connections.emplace_back( completion );
m_connections.emplace_back( connection );
}
bool CompletionSet::allCompletionsShut( ) const {
bool ConnectionSet::allConnectionsShut( ) const {
auto shut = []( const Connection& c ) {
return c.getState() == WellCompletion::StateEnum::SHUT;
};
@ -88,46 +88,46 @@ namespace Opm {
void CompletionSet::orderCompletions(size_t well_i, size_t well_j)
void ConnectionSet::orderConnections(size_t well_i, size_t well_j)
{
if (m_connections.empty()) {
return;
}
// Find the first completion and swap it into the 0-position.
// Find the first connection and swap it into the 0-position.
const double surface_z = 0.0;
size_t first_index = findClosestCompletion(well_i, well_j, surface_z, 0);
size_t first_index = findClosestConnection(well_i, well_j, surface_z, 0);
std::swap(m_connections[first_index], m_connections[0]);
// Repeat for remaining completions.
// Repeat for remaining connections.
//
// Note that since findClosestCompletion() is O(n), this is an
// Note that since findClosestConnection() is O(n), this is an
// O(n^2) algorithm. However, it should be acceptable since
// the expected number of completions is fairly low (< 100).
// the expected number of connections is fairly low (< 100).
if( this->m_connections.empty() ) return;
for (size_t pos = 1; pos < m_connections.size() - 1; ++pos) {
const auto& prev = m_connections[pos - 1];
const double prevz = prev.getCenterDepth();
size_t next_index = findClosestCompletion(prev.getI(), prev.getJ(), prevz, pos);
size_t next_index = findClosestConnection(prev.getI(), prev.getJ(), prevz, pos);
std::swap(m_connections[next_index], m_connections[pos]);
}
}
size_t CompletionSet::findClosestCompletion(int oi, int oj, double oz, size_t start_pos)
size_t ConnectionSet::findClosestConnection(int oi, int oj, double oz, size_t start_pos)
{
size_t closest = std::numeric_limits<size_t>::max();
int min_ijdist2 = std::numeric_limits<int>::max();
double min_zdiff = std::numeric_limits<double>::max();
for (size_t pos = start_pos; pos < m_connections.size(); ++pos) {
const auto& completion = m_connections[ pos ];
const auto& connection = m_connections[ pos ];
const double depth = completion.getCenterDepth();
const int ci = completion.getI();
const int cj = completion.getJ();
const double depth = connection.getCenterDepth();
const int ci = connection.getI();
const int cj = connection.getJ();
// Using square of distance to avoid non-integer arithmetics.
const int ijdist2 = (ci - oi) * (ci - oi) + (cj - oj) * (cj - oj);
if (ijdist2 < min_ijdist2) {
@ -146,25 +146,19 @@ namespace Opm {
return closest;
}
bool CompletionSet::operator==( const CompletionSet& rhs ) const {
bool ConnectionSet::operator==( const ConnectionSet& rhs ) const {
return this->size() == rhs.size()
&& std::equal( this->begin(), this->end(), rhs.begin() );
}
bool CompletionSet::operator!=( const CompletionSet& rhs ) const {
bool ConnectionSet::operator!=( const ConnectionSet& rhs ) const {
return !( *this == rhs );
}
<<<<<<< HEAD:src/opm/parser/eclipse/EclipseState/Schedule/CompletionSet.cpp
void CompletionSet::filter(const EclipseGrid& grid) {
auto new_end = std::remove_if(m_completions.begin(),
m_completions.end(),
=======
void ConnectionSet::filter(const EclipseGrid& grid) {
auto new_end = std::remove_if(m_connections.begin(),
m_connections.end(),
>>>>>>> e36a653... fixup! Rename Completion -> Connection:src/opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.cpp
[&grid](const Connection& c) { return !grid.cellActive(c.getI(), c.getJ(), c.getK()); });
m_connections.erase(new_end, m_connections.end());
}

View File

@ -22,7 +22,7 @@
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SegmentSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/C.hpp>
@ -54,7 +54,7 @@ namespace Opm {
for (size_t recordIndex = 1; recordIndex < compsegsKeyword.size(); ++recordIndex) {
const auto& record = compsegsKeyword.getRecord(recordIndex);
// following the coordinate rule for completions
// following the coordinate rule for connections
const int I = record.getItem<ParserKeywords::COMPSEGS::I>().get< int >(0) - 1;
const int J = record.getItem<ParserKeywords::COMPSEGS::J>().get< int >(0) - 1;
const int K = record.getItem<ParserKeywords::COMPSEGS::K>().get< int >(0) - 1;
@ -69,7 +69,7 @@ namespace Opm {
} else {
// TODO: the end of the previous connection or range
// 'previous' should be in term of the input order
// since basically no specific order for the completions
// since basically no specific order for the connections
throw std::runtime_error("this way to obtain DISTANCE_START not implemented yet!");
}
if (record.getItem<ParserKeywords::COMPSEGS::DISTANCE_END>().hasValue(0)) {
@ -90,7 +90,7 @@ namespace Opm {
}
/*
* Defaulted well completion. Must be non-defaulted if DISTANCE_END
* Defaulted well connection. Must be non-defaulted if DISTANCE_END
* is set or a range is specified. If not this is effectively ignored.
*/
WellCompletion::DirectionEnum direction = WellCompletion::X;
@ -170,7 +170,7 @@ namespace Opm {
compseg.m_segment_number = segment_number;
// when depth is default or zero, we obtain the depth of the completion based on the information
// when depth is default or zero, we obtain the depth of the connection based on the information
// of the related segments
if (compseg.m_center_depth == 0.) {
compseg.calculateCenterDepthWithSegments(segment_set);
@ -230,21 +230,21 @@ namespace Opm {
m_center_depth = segment_depth + (center_distance - segment_distance) / segment_length * depth_change_segment;
}
void Compsegs::updateCompletionsWithSegment(const std::vector< Compsegs >& compsegs,
CompletionSet& completion_set) {
void Compsegs::updateConnectionsWithSegment(const std::vector< Compsegs >& compsegs,
ConnectionSet& connection_set) {
for( const auto& compseg : compsegs ) {
const int i = compseg.m_i;
const int j = compseg.m_j;
const int k = compseg.m_k;
const Connection& connection = completion_set.getFromIJK( i, j, k );
completion_set.add(Connection(connection, compseg.m_segment_number, compseg.m_center_depth) );
const Connection& connection = connection_set.getFromIJK( i, j, k );
connection_set.add(Connection(connection, compseg.m_segment_number, compseg.m_center_depth) );
}
for (size_t ic = 0; ic < completion_set.size(); ++ic) {
if ( !(completion_set.get(ic).attachedToSegment()) ) {
throw std::runtime_error("Not all the completions are attached with a segment. "
for (size_t ic = 0; ic < connection_set.size(); ++ic) {
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

@ -28,7 +28,7 @@
namespace Opm {
class CompletionSet;
class ConnectionSet;
class DeckKeyword;
class SegmentSet;
@ -59,9 +59,9 @@ namespace Opm {
// get the segment number information and depth information based on the information from SegmentSet
static void processCOMPSEGS(std::vector< Compsegs >& compsegs, const SegmentSet& segment_set );
// update the segment related information for Completions
static void updateCompletionsWithSegment(const std::vector< Compsegs >& compsegs,
CompletionSet& completion_set);
// update the segment related information for Connections
static void updateConnectionsWithSegment(const std::vector< Compsegs >& compsegs,
ConnectionSet& connection_set);
};
}

View File

@ -17,21 +17,21 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingCompletionsWithSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp>
#include "Compsegs.hpp"
namespace Opm {
CompletionSet updatingCompletionsWithSegments(const DeckKeyword& compsegs,
const CompletionSet& input_completions,
ConnectionSet updatingConnectionsWithSegments(const DeckKeyword& compsegs,
const ConnectionSet& input_connections,
const SegmentSet& segment_set)
{
CompletionSet new_completion_set(input_completions);
ConnectionSet new_connection_set(input_connections);
std::vector<Compsegs> compsegs_vector = Compsegs::compsegsFromCOMPSEGSKeyword( compsegs );
Compsegs::processCOMPSEGS(compsegs_vector, segment_set);
Compsegs::updateCompletionsWithSegment(compsegs_vector, new_completion_set);
return new_completion_set;
Compsegs::updateConnectionsWithSegment(compsegs_vector, new_connection_set);
return new_connection_set;
}
}

View File

@ -36,14 +36,14 @@
#include <opm/parser/eclipse/Parser/ParserKeywords/W.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SegmentSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingCompletionsWithSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
@ -394,7 +394,7 @@ namespace Opm {
addGroup(groupName , currentStep);
if (!hasWell(wellName)) {
WellCompletion::CompletionOrderEnum wellCompletionOrder = WellCompletion::TRACK;
WellCompletion::CompletionOrderEnum wellConnectionOrder = WellCompletion::TRACK;
if( const auto* compordp = COMPORD_in_timestep() ) {
const auto& compord = *compordp;
@ -405,11 +405,11 @@ namespace Opm {
const std::string& wellNamePattern = compordRecord.getItem(0).getTrimmedString(0);
if (Well::wellNameInWellNamePattern(wellName, wellNamePattern)) {
const std::string& compordString = compordRecord.getItem(1).getTrimmedString(0);
wellCompletionOrder = WellCompletion::CompletionOrderEnumFromString(compordString);
wellConnectionOrder = WellCompletion::CompletionOrderEnumFromString(compordString);
}
}
}
addWell(wellName, record, currentStep, wellCompletionOrder);
addWell(wellName, record, currentStep, wellConnectionOrder);
new_well = true;
}
@ -559,9 +559,9 @@ namespace Opm {
double wellPi = record.getItem("WELLPI").get< double >(0);
for( auto* well : getWells( wellNamePattern ) ) {
const auto& currentCompletionSet = well->getCompletions(currentStep);
const auto& currentConnectionSet = well->getConnections(currentStep);
CompletionSet newCompletionSet;
ConnectionSet newConnectionSet;
Opm::Value<int> I = getValueItem(record.getItem("I"));
Opm::Value<int> J = getValueItem(record.getItem("J"));
@ -569,47 +569,47 @@ namespace Opm {
Opm::Value<int> FIRST = getValueItem(record.getItem("FIRST"));
Opm::Value<int> LAST = getValueItem(record.getItem("LAST"));
size_t completionSize = currentCompletionSet.size();
size_t completionSize = currentConnectionSet.size();
for(size_t i = 0; i < completionSize;i++) {
const auto& currentCompletion = currentCompletionSet.get(i);
const auto& currentConnection = currentConnectionSet.get(i);
if (FIRST.hasValue()) {
if (i < (size_t) FIRST.getValue()) {
newCompletionSet.add(currentCompletion);
newConnectionSet.add(currentConnection);
continue;
}
}
if (LAST.hasValue()) {
if (i > (size_t) LAST.getValue()) {
newCompletionSet.add(currentCompletion);
newConnectionSet.add(currentConnection);
continue;
}
}
int ci = currentCompletion.getI();
int cj = currentCompletion.getJ();
int ck = currentCompletion.getK();
int ci = currentConnection.getI();
int cj = currentConnection.getJ();
int ck = currentConnection.getK();
if (I.hasValue() && (!(I.getValue() == ci) )) {
newCompletionSet.add(currentCompletion);
newConnectionSet.add(currentConnection);
continue;
}
if (J.hasValue() && (!(J.getValue() == cj) )) {
newCompletionSet.add(currentCompletion);
newConnectionSet.add(currentConnection);
continue;
}
if (K.hasValue() && (!(K.getValue() == ck) )) {
newCompletionSet.add(currentCompletion);
newConnectionSet.add(currentConnection);
continue;
}
newCompletionSet.add( Connection{ currentCompletion, wellPi } );
newConnectionSet.add( Connection{ currentConnection, wellPi } );
}
well->addCompletionSet(currentStep, newCompletionSet);
well->addConnectionSet(currentStep, newConnectionSet);
}
}
}
@ -945,11 +945,11 @@ namespace Opm {
};
for( auto& well : this->getWells( wellname ) ) {
CompletionSet new_completions;
for( const auto& completion : well->getCompletions( timestep ) )
ConnectionSet new_completions;
for( const auto& completion : well->getConnections( timestep ) )
new_completions.add( new_completion( completion ) );
well->addCompletionSet( timestep, new_completions );
well->addConnectionSet( timestep, new_completions );
}
}
}
@ -1032,11 +1032,11 @@ namespace Opm {
};
for( auto* well : wells ) {
CompletionSet new_completions;
for( const auto& c : well->getCompletions( currentStep ) )
ConnectionSet new_completions;
for( const auto& c : well->getConnections( currentStep ) )
new_completions.add( new_completion( c ) );
well->addCompletionSet( currentStep, new_completions );
well->addConnectionSet( currentStep, new_completions );
m_events.addEvent( ScheduleEvents::COMPLETION_CHANGE, currentStep );
}
}
@ -1422,8 +1422,8 @@ namespace Opm {
for( const auto pair : completions ) {
auto& well = this->m_wells.get( pair.first );
well.addCompletions( currentStep, pair.second );
if (well.getCompletions( currentStep ).allCompletionsShut()) {
well.addConnections( currentStep, pair.second );
if (well.getConnections( currentStep ).allConnectionsShut()) {
std::string msg =
"All completions in well " + well.name() + " is shut at " + std::to_string ( m_timeMap.getTimePassedUntil(currentStep) / (60*60*24) ) + " days. \n" +
"The well is therefore also shut.";
@ -1451,10 +1451,10 @@ namespace Opm {
auto& well = this->m_wells.get( well_name );
const auto& segment_set = well.getSegmentSet(currentStep);
const auto& completion_set = well.getCompletions( currentStep );
const CompletionSet new_completion_set = updatingCompletionsWithSegments(keyword, completion_set, segment_set);
const auto& completion_set = well.getConnections( currentStep );
const ConnectionSet new_completion_set = updatingConnectionsWithSegments(keyword, completion_set, segment_set);
well.addCompletionSet(currentStep, new_completion_set);
well.addConnectionSet(currentStep, new_completion_set);
}
void Schedule::handleWGRUPCON( const DeckKeyword& keyword, size_t currentStep) {
@ -1554,7 +1554,7 @@ namespace Opm {
return m_rootGroupTree.get(timeStep);
}
void Schedule::addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, WellCompletion::CompletionOrderEnum wellCompletionOrder) {
void Schedule::addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, WellCompletion::CompletionOrderEnum wellConnectionOrder) {
// We change from eclipse's 1 - n, to a 0 - n-1 solution
int headI = record.getItem("HEAD_I").get< int >(0) - 1;
int headJ = record.getItem("HEAD_J").get< int >(0) - 1;
@ -1580,7 +1580,7 @@ namespace Opm {
headI, headJ, refDepth,
preferredPhase, m_timeMap,
timeStep,
wellCompletionOrder, allowCrossFlow, automaticShutIn);
wellConnectionOrder, allowCrossFlow, automaticShutIn);
m_wells.insert( wellName, well );
m_events.addEvent( ScheduleEvents::NEW_WELL , timeStep );
@ -1805,10 +1805,10 @@ namespace Opm {
else throw std::invalid_argument("String " + eclipseString + " not recognized as a boolean-convertible string.");
}
size_t Schedule::getMaxNumCompletionsForWells(size_t timestep) const {
size_t Schedule::getMaxNumConnectionsForWells(size_t timestep) const {
size_t ncwmax = 0;
for( const auto* wellPtr : getWells() ) {
const auto& completions = wellPtr->getCompletions(timestep);
const auto& completions = wellPtr->getConnections(timestep);
if( completions.size() > ncwmax )
ncwmax = completions.size();
@ -1849,16 +1849,16 @@ namespace Opm {
void Schedule::checkIfAllConnectionsIsShut(size_t timestep) {
for( auto& well : this->m_wells ) {
const auto& completions = well.getCompletions(timestep);
if( completions.allCompletionsShut() )
const auto& completions = well.getConnections(timestep);
if( completions.allConnectionsShut() )
this->updateWellStatus( well, timestep, WellCommon::StatusEnum::SHUT);
}
}
void Schedule::filterCompletions(const EclipseGrid& grid) {
void Schedule::filterConnections(const EclipseGrid& grid) {
for (auto& well : this->m_wells)
well.filterCompletions(grid);
well.filterConnections(grid);
}
const VFPProdTable& Schedule::getVFPProdTable(int table_id, size_t timeStep) const {

View File

@ -23,7 +23,7 @@
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SegmentSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
@ -48,7 +48,7 @@ namespace Opm {
m_guideRateScalingFactor( timeMap, 1.0 ),
m_efficiencyFactors (timeMap, 1.0 ),
m_isProducer( timeMap, true ) ,
m_completions( timeMap, CompletionSet{} ),
m_completions( timeMap, ConnectionSet{} ),
m_productionProperties( timeMap, WellProductionProperties() ),
m_injectionProperties( timeMap, WellInjectionProperties() ),
m_polymerProperties( timeMap, WellPolymerProperties() ),
@ -231,7 +231,7 @@ namespace Opm {
}
bool Well::setStatus(size_t timeStep, WellCommon::StatusEnum status) {
if ((WellCommon::StatusEnum::OPEN == status) && getCompletions(timeStep).allCompletionsShut()) {
if ((WellCommon::StatusEnum::OPEN == status) && getConnections(timeStep).allConnectionsShut()) {
OpmLog::note("When handling keyword for well " + name() + ": Cannot open a well where all completions are shut" );
return false;
} else {
@ -329,7 +329,7 @@ namespace Opm {
if( depth >= 0.0 ) return depth;
// ref depth was defaulted and we get the depth of the first completion
const auto& completions = this->getCompletions( timestep );
const auto& completions = this->getConnections( timestep );
if( completions.size() == 0 ) {
throw std::invalid_argument( "No completions defined for well: "
+ name()
@ -347,34 +347,34 @@ namespace Opm {
return m_preferredPhase;
}
const CompletionSet& Well::getCompletions(size_t timeStep) const {
const ConnectionSet& Well::getConnections(size_t timeStep) const {
return m_completions.get( timeStep );
}
CompletionSet Well::getActiveCompletions(size_t timeStep, const EclipseGrid& grid) const {
return CompletionSet(this->getCompletions(timeStep), grid);
ConnectionSet Well::getActiveConnections(size_t timeStep, const EclipseGrid& grid) const {
return ConnectionSet(this->getConnections(timeStep), grid);
}
const CompletionSet& Well::getCompletions() const {
const ConnectionSet& Well::getConnections() const {
return m_completions.back();
}
void Well::addCompletions(size_t time_step, const std::vector< Connection >& newCompletions ) {
auto new_set = this->getCompletions( time_step );
void Well::addConnections(size_t time_step, const std::vector< Connection >& newConnections ) {
auto new_set = this->getConnections( time_step );
int complnum_shift = new_set.size();
const auto headI = this->m_headI[ time_step ];
const auto headJ = this->m_headJ[ time_step ];
auto prev_size = new_set.size();
for( auto completion : newCompletions ) {
for( auto completion : newConnections ) {
completion.fixDefaultIJ( headI , headJ );
completion.shift_complnum( complnum_shift );
new_set.add( completion );
const auto new_size = new_set.size();
/* Completions can be "re-added", i.e. same coordinates but with a
/* Connections can be "re-added", i.e. same coordinates but with a
* different set of properties. In this case they also inherit the
* completion number (which must otherwise be shifted because
* every COMPDAT keyword thinks it's the only one.
@ -383,14 +383,14 @@ namespace Opm {
else ++prev_size;
}
this->addCompletionSet( time_step, new_set );
this->addConnectionSet( time_step, new_set );
}
void Well::addCompletionSet(size_t time_step, CompletionSet new_set ){
if( getWellCompletionOrdering() == WellCompletion::TRACK) {
void Well::addConnectionSet(size_t time_step, ConnectionSet new_set ){
if( getWellConnectionOrdering() == WellCompletion::TRACK) {
const auto headI = this->m_headI[ time_step ];
const auto headJ = this->m_headJ[ time_step ];
new_set.orderCompletions( headI, headJ );
new_set.orderConnections( headI, headJ );
}
m_completions.update( time_step, std::move( new_set ) );
@ -500,7 +500,7 @@ namespace Opm {
updateRFTActive(time, RFTConnections::RFTEnum::YES);
}
WellCompletion::CompletionOrderEnum Well::getWellCompletionOrdering() const {
WellCompletion::CompletionOrderEnum Well::getWellConnectionOrdering() const {
return m_comporder;
}
@ -580,9 +580,9 @@ namespace Opm {
}
void Well::filterCompletions(const EclipseGrid& grid) {
void Well::filterConnections(const EclipseGrid& grid) {
/*
The m_completions member variable is DynamicState<CompletionSet>
The m_completions member variable is DynamicState<ConnectionSet>
instance, hence this for loop is over all timesteps.
*/
for (auto& completions : m_completions)

View File

@ -29,7 +29,7 @@
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
@ -292,9 +292,9 @@ inline void keywordC( std::vector< ERT::smspec_node >& list,
* over a well's completions regardless of the desired block is
* defaulted or not
*/
for( const auto& completion : well->getCompletions( last_timestep ) ) {
for( const auto& connection : well->getConnections( last_timestep ) ) {
/* block coordinates defaulted */
auto cijk = getijk( completion );
auto cijk = getijk( connection );
if( record.getItem( 1 ).defaultApplied( 0 ) ) {
list.emplace_back( keywordstring, name, dims.getNXYZ().data(), cijk.data() );

View File

@ -11,8 +11,8 @@
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
@ -33,7 +33,7 @@
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
@ -43,7 +43,7 @@ inline std::ostream& operator<<( std::ostream& stream, const Connection& c ) {
return stream << "(" << c.getI() << "," << c.getJ() << "," << c.getK() << ")";
}
inline std::ostream& operator<<( std::ostream& stream, const CompletionSet& cs ) {
inline std::ostream& operator<<( std::ostream& stream, const ConnectionSet& cs ) {
stream << "{ ";
for( const auto& c : cs ) stream << c << " ";
return stream << "}";
@ -85,15 +85,15 @@ BOOST_AUTO_TEST_CASE(CompletionTestssameCoordinate) {
BOOST_CHECK_EQUAL( false , completion1.sameCoordinate( completion5 ));
}
BOOST_AUTO_TEST_CASE(CreateCompletionSetOK) {
Opm::CompletionSet completionSet;
BOOST_AUTO_TEST_CASE(CreateConnectionSetOK) {
Opm::ConnectionSet completionSet;
BOOST_CHECK_EQUAL( 0U , completionSet.size() );
}
BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) {
Opm::CompletionSet completionSet;
Opm::ConnectionSet 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( 11,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);
completionSet.add( completion1 );
@ -106,8 +106,8 @@ BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) {
}
BOOST_AUTO_TEST_CASE(CompletionSetGetOutOfRangeThrows) {
Opm::CompletionSet completionSet;
BOOST_AUTO_TEST_CASE(ConnectionSetGetOutOfRangeThrows) {
Opm::ConnectionSet 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( 11,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);
completionSet.add( completion1 );
@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(CompletionSetGetOutOfRangeThrows) {
BOOST_AUTO_TEST_CASE(AddCompletionSameCellUpdates) {
Opm::CompletionSet completionSet;
Opm::ConnectionSet 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);
@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE(AddCompletionSameCellUpdates) {
BOOST_AUTO_TEST_CASE(AddCompletionCopy) {
Opm::CompletionSet completionSet;
Opm::ConnectionSet 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,11, 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);
@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE(AddCompletionCopy) {
BOOST_AUTO_TEST_CASE(ActiveCompletions) {
Opm::EclipseGrid grid(10,10,10);
Opm::CompletionSet completions;
Opm::ConnectionSet completions;
Opm::Connection completion1( 0,0,0, 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( 0,0,1, 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);
Opm::Connection completion3( 0,0,2, 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);
@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(ActiveCompletions) {
actnum[0] = 0;
grid.resetACTNUM( actnum.data() );
Opm::CompletionSet active_completions(completions, grid);
Opm::ConnectionSet active_completions(completions, grid);
BOOST_CHECK_EQUAL( active_completions.size() , 2);
BOOST_CHECK_EQUAL( completion2, active_completions.get(0));
BOOST_CHECK_EQUAL( completion3, active_completions.get(1));

View File

@ -21,7 +21,7 @@
#include <iostream>
#include <boost/filesystem.hpp>
#define BOOST_TEST_MODULE CompletionSetTests
#define BOOST_TEST_MODULE ConnectionSetTests
#include <boost/test/unit_test.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
@ -33,25 +33,25 @@
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingCompletionsWithSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp>
BOOST_AUTO_TEST_CASE(MultisegmentWellTest) {
Opm::CompletionSet completion_set;
completion_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.5), Opm::Value<double>("SKIN", 0.), 0) );
completion_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.5), Opm::Value<double>("SKIN", 0.), 0) );
completion_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0) );
completion_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0, Opm::WellCompletion::DirectionEnum::X) );
completion_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0, Opm::WellCompletion::DirectionEnum::X) );
completion_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0, Opm::WellCompletion::DirectionEnum::X) );
completion_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0, Opm::WellCompletion::DirectionEnum::X) );
Opm::ConnectionSet connection_set;
connection_set.add(Opm::Connection( 19, 0, 0, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.5), Opm::Value<double>("SKIN", 0.), 0) );
connection_set.add(Opm::Connection( 19, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.5), Opm::Value<double>("SKIN", 0.), 0) );
connection_set.add(Opm::Connection( 19, 0, 2, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0) );
connection_set.add(Opm::Connection( 18, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0, Opm::WellCompletion::DirectionEnum::X) );
connection_set.add(Opm::Connection( 17, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0, Opm::WellCompletion::DirectionEnum::X) );
connection_set.add(Opm::Connection( 16, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0, Opm::WellCompletion::DirectionEnum::X) );
connection_set.add(Opm::Connection( 15, 0, 1, 1, 0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor", 200.), Opm::Value<double>("D", 0.4), Opm::Value<double>("SKIN", 0.), 0, Opm::WellCompletion::DirectionEnum::X) );
BOOST_CHECK_EQUAL( 7U , completion_set.size() );
BOOST_CHECK_EQUAL( 7U , connection_set.size() );
const std::string compsegs_string =
"WELSEGS \n"
@ -86,38 +86,38 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) {
BOOST_CHECK_EQUAL(6U, segment_set.numberSegment());
const Opm::CompletionSet new_completion_set = Opm::updatingCompletionsWithSegments(compsegs, completion_set, segment_set);
const Opm::ConnectionSet new_connection_set = Opm::updatingConnectionsWithSegments(compsegs, connection_set, segment_set);
BOOST_CHECK_EQUAL(7U, new_completion_set.size());
BOOST_CHECK_EQUAL(7U, new_connection_set.size());
const Opm::Connection& completion1 = new_completion_set.get(0);
const int segment_number_completion1 = completion1.getSegmentNumber();
const double center_depth_completion1 = completion1.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_completion1, 1);
BOOST_CHECK_EQUAL(center_depth_completion1, 2512.5);
const Opm::Connection& connection1 = new_connection_set.get(0);
const int segment_number_connection1 = connection1.getSegmentNumber();
const double center_depth_connection1 = connection1.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_connection1, 1);
BOOST_CHECK_EQUAL(center_depth_connection1, 2512.5);
const Opm::Connection& completion3 = new_completion_set.get(2);
const int segment_number_completion3 = completion3.getSegmentNumber();
const double center_depth_completion3 = completion3.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_completion3, 3);
BOOST_CHECK_EQUAL(center_depth_completion3, 2562.5);
const Opm::Connection& connection3 = new_connection_set.get(2);
const int segment_number_connection3 = connection3.getSegmentNumber();
const double center_depth_connection3 = connection3.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_connection3, 3);
BOOST_CHECK_EQUAL(center_depth_connection3, 2562.5);
const Opm::Connection& completion5 = new_completion_set.get(4);
const int segment_number_completion5 = completion5.getSegmentNumber();
const double center_depth_completion5 = completion5.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_completion5, 6);
BOOST_CHECK_CLOSE(center_depth_completion5, 2538.83, 0.001);
const Opm::Connection& connection5 = new_connection_set.get(4);
const int segment_number_connection5 = connection5.getSegmentNumber();
const double center_depth_connection5 = connection5.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_connection5, 6);
BOOST_CHECK_CLOSE(center_depth_connection5, 2538.83, 0.001);
const Opm::Connection& completion6 = new_completion_set.get(5);
const int segment_number_completion6 = completion6.getSegmentNumber();
const double center_depth_completion6 = completion6.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_completion6, 6);
BOOST_CHECK_CLOSE(center_depth_completion6, 2537.83, 0.001);
const Opm::Connection& connection6 = new_connection_set.get(5);
const int segment_number_connection6 = connection6.getSegmentNumber();
const double center_depth_connection6 = connection6.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_connection6, 6);
BOOST_CHECK_CLOSE(center_depth_connection6, 2537.83, 0.001);
const Opm::Connection& completion7 = new_completion_set.get(6);
const int segment_number_completion7 = completion7.getSegmentNumber();
const double center_depth_completion7 = completion7.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_completion7, 7);
BOOST_CHECK_EQUAL(center_depth_completion7, 2534.5);
const Opm::Connection& connection7 = new_connection_set.get(6);
const int segment_number_connection7 = connection7.getSegmentNumber();
const double center_depth_connection7 = connection7.getCenterDepth();
BOOST_CHECK_EQUAL(segment_number_connection7, 7);
BOOST_CHECK_EQUAL(center_depth_connection7, 2534.5);
}

View File

@ -31,7 +31,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
@ -551,8 +551,8 @@ BOOST_AUTO_TEST_CASE(ReturnMaxNumCompletionsForWellsInTimestep) {
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule schedule(deck, grid , eclipseProperties, Phases(true, true, true) , ParseContext() );
BOOST_CHECK_EQUAL(schedule.getMaxNumCompletionsForWells(1), 7);
BOOST_CHECK_EQUAL(schedule.getMaxNumCompletionsForWells(3), 9);
BOOST_CHECK_EQUAL(schedule.getMaxNumConnectionsForWells(1), 7);
BOOST_CHECK_EQUAL(schedule.getMaxNumConnectionsForWells(3), 9);
}
BOOST_AUTO_TEST_CASE(TestCrossFlowHandling) {
@ -583,7 +583,7 @@ BOOST_AUTO_TEST_CASE(TestCrossFlowHandling) {
}
}
static Deck createDeckWithWellsAndCompletionDataWithWELOPEN() {
static Deck createDeckWithWellsAndConnectionDataWithWELOPEN() {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
@ -647,9 +647,9 @@ static Deck createDeckWithWellsAndCompletionDataWithWELOPEN() {
return parser.parseString(input, ParseContext());
}
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndCompletionDataWithWELOPEN) {
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndConnectionDataWithWELOPEN) {
EclipseGrid grid(10,10,10);
auto deck = createDeckWithWellsAndCompletionDataWithWELOPEN();
auto deck = createDeckWithWellsAndConnectionDataWithWELOPEN();
TableManager table ( deck );
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule schedule(deck ,grid , eclipseProperties, Phases(true, true, true) , ParseContext());
@ -658,7 +658,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndCompletionDataWithWELOPEN) {
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus( 3 ));
well = schedule.getWell("OP_2");
const auto& cs = well->getCompletions( 3 );
const auto& cs = well->getConnections( 3 );
constexpr auto shut = WellCompletion::StateEnum::SHUT;
constexpr auto open = WellCompletion::StateEnum::OPEN;
@ -669,18 +669,18 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndCompletionDataWithWELOPEN) {
BOOST_CHECK_EQUAL(shut, cs.getFromIJK( 7, 6, 4 ).getState());
BOOST_CHECK_EQUAL(open, cs.getFromIJK( 7, 7, 2 ).getState());
const auto& cs2 = well->getCompletions( 4 );
const auto& cs2 = well->getConnections( 4 );
BOOST_CHECK_EQUAL(open, cs2.getFromIJK( 7, 6, 2 ).getState());
BOOST_CHECK_EQUAL(open, cs2.getFromIJK( 7, 6, 3 ).getState());
BOOST_CHECK_EQUAL(open, cs2.getFromIJK( 7, 6, 4 ).getState());
BOOST_CHECK_EQUAL(open, cs2.getFromIJK( 7, 7, 2 ).getState());
well = schedule.getWell("OP_3");
const auto& cs3 = well->getCompletions( 3 );
const auto& cs3 = well->getConnections( 3 );
BOOST_CHECK_EQUAL(shut, cs3.get( 0 ).getState());
const auto& cs4 = well->getCompletions( 4 );
const auto& cs4 = well->getConnections( 4 );
BOOST_CHECK_EQUAL(open, cs4.get( 0 ).getState());
@ -1080,17 +1080,17 @@ BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
Schedule schedule(deck, grid , eclipseProperties, Phases(true, true, true) , parseContext);
auto* well = schedule.getWell("OP_1");
const auto& cs2 = well->getCompletions( 2 );
const auto& cs2 = well->getConnections( 2 );
for(size_t i = 0; i < cs2.size(); i++) {
BOOST_CHECK_EQUAL(cs2.get( i ).getWellPi(), 1.3);
}
const auto& cs3 = well->getCompletions( 3 );
const auto& cs3 = well->getConnections( 3 );
for(size_t i = 0; i < cs3.size(); i++ ) {
BOOST_CHECK_EQUAL(cs3.get( i ).getWellPi(), (1.3*1.3));
}
const auto& cs4 = well->getCompletions( 4 );
const auto& cs4 = well->getConnections( 4 );
for(size_t i = 0; i < cs4.size(); i++ ) {
BOOST_CHECK_EQUAL(cs4.get( i ).getWellPi(), 1.0);
}
@ -1682,13 +1682,13 @@ BOOST_AUTO_TEST_CASE( COMPDAT_sets_automatic_complnum ) {
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule schedule( deck, grid, eclipseProperties, Phases( true, true, true ) ,ctx);
const auto& cs1 = schedule.getWell( "W1" )->getCompletions( 1 );
const auto& cs1 = schedule.getWell( "W1" )->getConnections( 1 );
BOOST_CHECK_EQUAL( 1, cs1.get( 0 ).complnum() );
BOOST_CHECK_EQUAL( 2, cs1.get( 1 ).complnum() );
BOOST_CHECK_EQUAL( 3, cs1.get( 2 ).complnum() );
BOOST_CHECK_EQUAL( 4, cs1.get( 3 ).complnum() );
const auto& cs2 = schedule.getWell( "W1" )->getCompletions( 2 );
const auto& cs2 = schedule.getWell( "W1" )->getConnections( 2 );
BOOST_CHECK_EQUAL( 1, cs2.get( 0 ).complnum() );
BOOST_CHECK_EQUAL( 2, cs2.get( 1 ).complnum() );
BOOST_CHECK_EQUAL( 3, cs2.get( 2 ).complnum() );
@ -1726,14 +1726,14 @@ BOOST_AUTO_TEST_CASE( COMPDAT_multiple_wells ) {
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule schedule( deck, grid, eclipseProperties, Phases( true, true, true ) ,ctx);
const auto& w1cs = schedule.getWell( "W1" )->getCompletions();
const auto& w1cs = schedule.getWell( "W1" )->getConnections();
BOOST_CHECK_EQUAL( 1, w1cs.get( 0 ).complnum() );
BOOST_CHECK_EQUAL( 2, w1cs.get( 1 ).complnum() );
BOOST_CHECK_EQUAL( 3, w1cs.get( 2 ).complnum() );
BOOST_CHECK_EQUAL( 4, w1cs.get( 3 ).complnum() );
BOOST_CHECK_EQUAL( 5, w1cs.get( 4 ).complnum() );
const auto& w2cs = schedule.getWell( "W2" )->getCompletions();
const auto& w2cs = schedule.getWell( "W2" )->getConnections();
BOOST_CHECK_EQUAL( 1, w2cs.getFromIJK( 4, 4, 2 ).complnum() );
BOOST_CHECK_EQUAL( 2, w2cs.getFromIJK( 4, 4, 0 ).complnum() );
BOOST_CHECK_EQUAL( 3, w2cs.getFromIJK( 4, 4, 1 ).complnum() );
@ -1770,7 +1770,7 @@ BOOST_AUTO_TEST_CASE( COMPDAT_multiple_records_same_completion ) {
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule schedule( deck, grid, eclipseProperties, Phases( true, true, true ) ,ctx);
const auto& cs = schedule.getWell( "W1" )->getCompletions();
const auto& cs = schedule.getWell( "W1" )->getConnections();
BOOST_CHECK_EQUAL( 3U, cs.size() );
BOOST_CHECK_EQUAL( 1, cs.get( 0 ).complnum() );
BOOST_CHECK_EQUAL( 2, cs.get( 1 ).complnum() );
@ -1850,7 +1850,7 @@ BOOST_AUTO_TEST_CASE( complump ) {
Schedule schedule( deck, grid, eclipseProperties, Phases( true, true, true ) ,ctx);
const auto& well = *schedule.getWell( "W1" );
const auto& sc0 = well.getCompletions( 0 );
const auto& sc0 = well.getConnections( 0 );
/* complnum should be modified by COMPLNUM */
BOOST_CHECK_EQUAL( 1, sc0.getFromIJK( 2, 2, 0 ).complnum() );
@ -1862,7 +1862,7 @@ BOOST_AUTO_TEST_CASE( complump ) {
BOOST_CHECK_EQUAL( shut, sc0.getFromIJK( 2, 2, 1 ).getState() );
BOOST_CHECK_EQUAL( shut, sc0.getFromIJK( 2, 2, 2 ).getState() );
const auto& sc1 = well.getCompletions( 1 );
const auto& sc1 = well.getConnections( 1 );
BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 0 ).getState() );
BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 1 ).getState() );
BOOST_CHECK_EQUAL( open, sc1.getFromIJK( 2, 2, 2 ).getState() );
@ -1924,8 +1924,8 @@ BOOST_AUTO_TEST_CASE( COMPLUMP_specific_coordinates ) {
Schedule schedule( deck, grid, eclipseProperties, Phases( true, true, true ) ,ctx);
const auto& well = *schedule.getWell( "W1" );
const auto& cs1 = well.getCompletions( 1 );
const auto& cs2 = well.getCompletions( 2 );
const auto& cs1 = well.getConnections( 1 );
const auto& cs2 = well.getConnections( 2 );
BOOST_CHECK_EQUAL( 9U, cs1.size() );
BOOST_CHECK_EQUAL( open, cs1.getFromIJK( 0, 0, 0 ).getState() );
@ -2486,14 +2486,14 @@ BOOST_AUTO_TEST_CASE(FilterCompletions) {
Eclipse3DProperties eclipseProperties ( deck , table, grid1);
Schedule schedule(deck, grid1 , eclipseProperties, Phases(true, true, true) , ParseContext() );
const auto& well = schedule.getWell("OP_1");
const auto& c1_1 = well->getCompletions(1);
const auto& c1_3 = well->getCompletions(3);
const auto& c1_1 = well->getConnections(1);
const auto& c1_3 = well->getConnections(3);
BOOST_CHECK_EQUAL(2, c1_1.size());
BOOST_CHECK_EQUAL(9, c1_3.size());
actnum[grid1.getGlobalIndex(8,8,1)] = 0;
{
EclipseGrid grid2(grid1, actnum);
schedule.filterCompletions(grid2);
schedule.filterConnections(grid2);
BOOST_CHECK_EQUAL(1, c1_1.size());
BOOST_CHECK_EQUAL(8, c1_3.size());
}

View File

@ -28,7 +28,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>

View File

@ -33,7 +33,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
@ -232,7 +232,7 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestTRACK) {
auto* op_1 = schedule.getWell("OP_1");
size_t timestep = 2;
const auto& completions = op_1->getCompletions( timestep );
const auto& completions = op_1->getConnections( timestep );
BOOST_CHECK_EQUAL(9U, completions.size());
//Verify TRACK completion ordering
@ -273,7 +273,7 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestDefaultTRACK) {
auto* op_1 = schedule.getWell("OP_1");
size_t timestep = 2;
const auto& completions = op_1->getCompletions( timestep );
const auto& completions = op_1->getConnections( timestep );
BOOST_CHECK_EQUAL(9U, completions.size());
//Verify TRACK completion ordering
@ -316,7 +316,7 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestINPUT) {
auto* op_1 = schedule.getWell("OP_1");
size_t timestep = 2;
const auto& completions = op_1->getCompletions( timestep );
const auto& completions = op_1->getConnections( timestep );
BOOST_CHECK_EQUAL(9U, completions.size());
//Verify INPUT completion ordering
@ -334,7 +334,7 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestINPUT) {
BOOST_AUTO_TEST_CASE(NewWellZeroCompletions) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 0, 0, 0.0, Opm::Phase::OIL, timeMap , 0);
BOOST_CHECK_EQUAL( 0U , well.getCompletions( 0 ).size() );
BOOST_CHECK_EQUAL( 0U , well.getConnections( 0 ).size() );
}
@ -342,7 +342,7 @@ 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.getCompletions( 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);
@ -362,14 +362,14 @@ BOOST_AUTO_TEST_CASE(UpdateCompletions) {
newCompletions2.push_back( comp5 );
BOOST_CHECK_EQUAL( 3U , newCompletions.size());
well.addCompletions( 5 , newCompletions );
BOOST_CHECK_EQUAL( 3U , well.getCompletions( 5 ).size());
BOOST_CHECK_EQUAL( comp3 , well.getCompletions( 5 ).get(2));
well.addConnections( 5 , newCompletions );
BOOST_CHECK_EQUAL( 3U , well.getConnections( 5 ).size());
BOOST_CHECK_EQUAL( comp3 , well.getConnections( 5 ).get(2));
well.addCompletions( 6 , newCompletions2 );
well.addConnections( 6 , newCompletions2 );
BOOST_CHECK_EQUAL( 4U , well.getCompletions( 6 ).size());
BOOST_CHECK_EQUAL( comp4 , well.getCompletions( 6 ).get(2));
BOOST_CHECK_EQUAL( 4U , well.getConnections( 6 ).size());
BOOST_CHECK_EQUAL( comp4 , well.getConnections( 6 ).get(2));
}
// Helper function for CompletionOrder test.
@ -395,13 +395,13 @@ BOOST_AUTO_TEST_CASE(CompletionOrder) {
auto c2 = connection(5, 5, 9);
auto c3 = connection(5, 5, 1);
auto c4 = connection(5, 5, 0);
Opm::CompletionSet cv1 = { c1, c2 };
well.addCompletionSet(1, cv1);
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), c1);
Opm::CompletionSet cv2 = { c3, c4 };
well.addCompletionSet(2, cv2);
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), c1);
BOOST_CHECK_EQUAL(well.getCompletions(2).get(0), c4);
Opm::ConnectionSet cv1 = { c1, c2 };
well.addConnectionSet(1, cv1);
BOOST_CHECK_EQUAL(well.getConnections(1).get(0), c1);
Opm::ConnectionSet cv2 = { c3, c4 };
well.addConnectionSet(2, cv2);
BOOST_CHECK_EQUAL(well.getConnections(1).get(0), c1);
BOOST_CHECK_EQUAL(well.getConnections(2).get(0), c4);
}
{
@ -415,8 +415,8 @@ BOOST_AUTO_TEST_CASE(CompletionOrder) {
auto c6 = connection(5, 5, 4, 1);
std::vector< Opm::Connection > cv1 = { c1, c2 };
well.addCompletions(1, cv1);
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), c2);
well.addConnections(1, cv1);
BOOST_CHECK_EQUAL(well.getConnections(1).get(0), c2);
/*
* adding completions in batches like this will under the hood modify
@ -425,28 +425,28 @@ BOOST_AUTO_TEST_CASE(CompletionOrder) {
* comparison to use the expected completion number
*/
std::vector< Opm::Connection > cv2 = { c3, c4, c5 };
well.addCompletions(2, cv2);
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(0), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(1), Connection( c1, 1 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(2), Connection( c3, 3 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(3), Connection( c5, 5 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(4), Connection( c4, 4 ) );
well.addConnections(2, cv2);
BOOST_CHECK_EQUAL(well.getConnections(1).get(0), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(0), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(1), Connection( c1, 1 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(2), Connection( c3, 3 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(3), Connection( c5, 5 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(4), Connection( c4, 4 ) );
std::vector< Opm::Connection > cv3 = { c6 };
well.addCompletions(3, cv3);
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(0), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(1), Connection( c1, 1 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(2), Connection( c3, 3 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(3), Connection( c5, 5 ) );
BOOST_CHECK_EQUAL(well.getCompletions(2).get(4), Connection( c4, 4 ) );
BOOST_CHECK_EQUAL(well.getCompletions(3).get(0), Connection( c6, 6 ) );
BOOST_CHECK_EQUAL(well.getCompletions(3).get(1), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getCompletions(3).get(2), Connection( c1, 1 ) );
BOOST_CHECK_EQUAL(well.getCompletions(3).get(3), Connection( c3, 3 ) );
BOOST_CHECK_EQUAL(well.getCompletions(3).get(4), Connection( c5, 5 ) );
BOOST_CHECK_EQUAL(well.getCompletions(3).get(5), Connection( c4, 4 ) );
well.addConnections(3, cv3);
BOOST_CHECK_EQUAL(well.getConnections(1).get(0), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(0), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(1), Connection( c1, 1 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(2), Connection( c3, 3 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(3), Connection( c5, 5 ) );
BOOST_CHECK_EQUAL(well.getConnections(2).get(4), Connection( c4, 4 ) );
BOOST_CHECK_EQUAL(well.getConnections(3).get(0), Connection( c6, 6 ) );
BOOST_CHECK_EQUAL(well.getConnections(3).get(1), Connection( c2, 2 ) );
BOOST_CHECK_EQUAL(well.getConnections(3).get(2), Connection( c1, 1 ) );
BOOST_CHECK_EQUAL(well.getConnections(3).get(3), Connection( c3, 3 ) );
BOOST_CHECK_EQUAL(well.getConnections(3).get(4), Connection( c5, 5 ) );
BOOST_CHECK_EQUAL(well.getConnections(3).get(5), Connection( c4, 4 ) );
}
}
@ -642,7 +642,7 @@ BOOST_AUTO_TEST_CASE(WellStatus) {
newCompletions.push_back( comp1 );
well.addCompletions( 2 , newCompletions );
well.addConnections( 2 , newCompletions );
well.setStatus( 3 , Opm::WellCommon::OPEN );
BOOST_CHECK_EQUAL( Opm::WellCommon::OPEN , well.getStatus( 5 ));

View File

@ -17,7 +17,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#define BOOST_TEST_MODULE CompletionIntegrationTests
#define BOOST_TEST_MODULE ConnectionIntegrationTests
#include <boost/test/unit_test.hpp>
@ -28,7 +28,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
using namespace Opm;
@ -36,7 +36,7 @@ inline std::string prefix() {
return boost::unit_test::framework::master_test_suite().argv[1];
}
BOOST_AUTO_TEST_CASE( CreateCompletionsFromKeyword ) {
BOOST_AUTO_TEST_CASE( CreateConnectionsFromKeyword ) {
Parser parser;
const auto scheduleFile = prefix() + "SCHEDULE/SCHEDULE_COMPDAT1";
@ -48,54 +48,54 @@ BOOST_AUTO_TEST_CASE( CreateCompletionsFromKeyword ) {
const auto& COMPDAT1 = deck.getKeyword("COMPDAT" , 1);
const auto wells = schedule.getWells( 0 );
auto completions = Connection::fromCOMPDAT( grid, eclipseProperties, COMPDAT1, wells, ParseContext(), schedule );
BOOST_CHECK_EQUAL( 3U , completions.size() );
auto connections = Connection::fromCOMPDAT( grid, eclipseProperties, COMPDAT1, wells, ParseContext(), schedule );
BOOST_CHECK_EQUAL( 3U , connections.size() );
BOOST_CHECK( completions.find("W_1") != completions.end() );
BOOST_CHECK( completions.find("W_2") != completions.end() );
BOOST_CHECK( completions.find("W_3") != completions.end() );
BOOST_CHECK( connections.find("W_1") != connections.end() );
BOOST_CHECK( connections.find("W_2") != connections.end() );
BOOST_CHECK( connections.find("W_3") != connections.end() );
BOOST_CHECK_EQUAL( 17U , completions.find("W_1")->second.size() );
BOOST_CHECK_EQUAL( 5U , completions.find("W_2")->second.size() );
BOOST_CHECK_EQUAL( 5U , completions.find("W_3")->second.size() );
BOOST_CHECK_EQUAL( 17U , connections.find("W_1")->second.size() );
BOOST_CHECK_EQUAL( 5U , connections.find("W_2")->second.size() );
BOOST_CHECK_EQUAL( 5U , connections.find("W_3")->second.size() );
std::vector<Connection> W_3Completions = completions.find("W_3")->second;
std::vector<Connection> W_3Connections = connections.find("W_3")->second;
const auto& completion0 = W_3Completions[0];
const auto& completion4 = W_3Completions[4];
const auto& connection0 = W_3Connections[0];
const auto& connection4 = W_3Connections[4];
BOOST_CHECK_EQUAL( 2 , completion0.getI() );
BOOST_CHECK_EQUAL( 7 , completion0.getJ() );
BOOST_CHECK_EQUAL( 0 , completion0.getK() );
BOOST_CHECK_EQUAL( WellCompletion::OPEN , completion0.getState() );
BOOST_CHECK_EQUAL( 3.1726851851851847e-12 , completion0.getConnectionTransmissibilityFactor() );
BOOST_CHECK_EQUAL( WellCompletion::DirectionEnum::Y, completion0.getDirection() );
BOOST_CHECK_EQUAL( 2 , connection0.getI() );
BOOST_CHECK_EQUAL( 7 , connection0.getJ() );
BOOST_CHECK_EQUAL( 0 , connection0.getK() );
BOOST_CHECK_EQUAL( WellCompletion::OPEN , connection0.getState() );
BOOST_CHECK_EQUAL( 3.1726851851851847e-12 , connection0.getConnectionTransmissibilityFactor() );
BOOST_CHECK_EQUAL( WellCompletion::DirectionEnum::Y, connection0.getDirection() );
BOOST_CHECK_EQUAL( 2 , completion4.getI() );
BOOST_CHECK_EQUAL( 6 , completion4.getJ() );
BOOST_CHECK_EQUAL( 3 , completion4.getK() );
BOOST_CHECK_EQUAL( WellCompletion::OPEN , completion4.getState() );
BOOST_CHECK_EQUAL( 5.4722222222222212e-13 , completion4.getConnectionTransmissibilityFactor() );
BOOST_CHECK_EQUAL( WellCompletion::DirectionEnum::Y, completion4.getDirection() );
BOOST_CHECK_EQUAL( 2 , connection4.getI() );
BOOST_CHECK_EQUAL( 6 , connection4.getJ() );
BOOST_CHECK_EQUAL( 3 , connection4.getK() );
BOOST_CHECK_EQUAL( WellCompletion::OPEN , connection4.getState() );
BOOST_CHECK_EQUAL( 5.4722222222222212e-13 , connection4.getConnectionTransmissibilityFactor() );
BOOST_CHECK_EQUAL( WellCompletion::DirectionEnum::Y, connection4.getDirection() );
// Check that wells with all completions shut is also itself shut
// Check that wells with all connections shut is also itself shut
const Well* well1 = schedule.getWell("W_1");
BOOST_CHECK (!well1->getCompletions(0).allCompletionsShut());
BOOST_CHECK (!well1->getConnections(0).allConnectionsShut());
BOOST_CHECK_EQUAL (well1->getStatus(0) , WellCommon::StatusEnum::OPEN);
const Well* well2 = schedule.getWell("W_2");
BOOST_CHECK (well2->getCompletions(0).allCompletionsShut());
BOOST_CHECK (well2->getConnections(0).allConnectionsShut());
BOOST_CHECK_EQUAL (well2->getStatus(0) , WellCommon::StatusEnum::SHUT);
// Check saturation table number for connection
std::vector<Connection> W_1Completions = completions.find("W_1")->second;
const auto& W1_completion0 = W_1Completions[0];
const auto& W1_completion3 = W_1Completions[3];
const auto& W1_completion4 = W_1Completions[4];
std::vector<Connection> W_1Connections = connections.find("W_1")->second;
const auto& W1_connection0 = W_1Connections[0];
const auto& W1_connection3 = W_1Connections[3];
const auto& W1_connection4 = W_1Connections[4];
BOOST_CHECK_EQUAL( 1 , W1_completion0.getSatTableId());
BOOST_CHECK_EQUAL( 2 , W1_completion3.getSatTableId());
BOOST_CHECK_EQUAL( 3 , W1_completion4.getSatTableId());
BOOST_CHECK_EQUAL( 1 , W1_connection0.getSatTableId());
BOOST_CHECK_EQUAL( 2 , W1_connection3.getSatTableId());
BOOST_CHECK_EQUAL( 3 , W1_connection4.getSatTableId());
}

View File

@ -573,32 +573,32 @@ BOOST_AUTO_TEST_CASE( MULTISEGMENT_ABS ) {
{
BOOST_CHECK(sched.hasWell("PROD01"));
const auto* well = sched.getWell("PROD01");
const auto& completions = well->getCompletions(0);
BOOST_CHECK_EQUAL(7U, completions.size());
const auto& connections = well->getConnections(0);
BOOST_CHECK_EQUAL(7U, connections.size());
const Connection& completion5 = completions.get(4);
const int seg_number_completion5 = completion5.getSegmentNumber();
const double completion5_depth = completion5.getCenterDepth();
BOOST_CHECK_EQUAL(seg_number_completion5, 6);
BOOST_CHECK_CLOSE(completion5_depth, 2538.83, 0.001);
const Connection& connection5 = connections.get(4);
const int seg_number_connection5 = connection5.getSegmentNumber();
const double connection5_depth = connection5.getCenterDepth();
BOOST_CHECK_EQUAL(seg_number_connection5, 6);
BOOST_CHECK_CLOSE(connection5_depth, 2538.83, 0.001);
const Connection& completion6 = completions.get(5);
const int seg_number_completion6 = completion6.getSegmentNumber();
const double completion6_depth = completion6.getCenterDepth();
BOOST_CHECK_EQUAL(seg_number_completion6, 6);
BOOST_CHECK_CLOSE(completion6_depth, 2537.83, 0.001);
const Connection& connection6 = connections.get(5);
const int seg_number_connection6 = connection6.getSegmentNumber();
const double connection6_depth = connection6.getCenterDepth();
BOOST_CHECK_EQUAL(seg_number_connection6, 6);
BOOST_CHECK_CLOSE(connection6_depth, 2537.83, 0.001);
const Connection& completion1 = completions.get(0);
const int seg_number_completion1 = completion1.getSegmentNumber();
const double completion1_depth = completion1.getCenterDepth();
BOOST_CHECK_EQUAL(seg_number_completion1, 1);
BOOST_CHECK_EQUAL(completion1_depth, 2512.5);
const Connection& connection1 = connections.get(0);
const int seg_number_connection1 = connection1.getSegmentNumber();
const double connection1_depth = connection1.getCenterDepth();
BOOST_CHECK_EQUAL(seg_number_connection1, 1);
BOOST_CHECK_EQUAL(connection1_depth, 2512.5);
const Connection& completion3 = completions.get(2);
const int seg_number_completion3 = completion3.getSegmentNumber();
const double completion3_depth = completion3.getCenterDepth();
BOOST_CHECK_EQUAL(seg_number_completion3, 3);
BOOST_CHECK_EQUAL(completion3_depth, 2562.5);
const Connection& connection3 = connections.get(2);
const int seg_number_connection3 = connection3.getSegmentNumber();
const double connection3_depth = connection3.getCenterDepth();
BOOST_CHECK_EQUAL(seg_number_connection3, 3);
BOOST_CHECK_EQUAL(connection3_depth, 2562.5);
}
}

View File

@ -34,7 +34,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@ -344,18 +344,18 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) {
{
auto* well1 = sched.getWell("W_1");
BOOST_CHECK_CLOSE(13000/Metric::Time , well1->getProductionPropertiesCopy(8).OilRate , 0.0001);
BOOST_CHECK_EQUAL(0U, well1->getCompletions( 0 ).size() );
BOOST_CHECK_EQUAL(0U, well1->getConnections( 0 ).size() );
const auto& completions = well1->getCompletions(3);
BOOST_CHECK_EQUAL(4U, completions.size());
const auto& connections = well1->getConnections(3);
BOOST_CHECK_EQUAL(4U, connections.size());
BOOST_CHECK_EQUAL(WellCompletion::OPEN, completions.get(3).getState());
BOOST_CHECK_EQUAL(2.2836805555555556e-12 , completions.get(3).getConnectionTransmissibilityFactor());
BOOST_CHECK_EQUAL(0.311/Metric::Length, completions.get(3).getDiameter());
BOOST_CHECK_EQUAL(3.3, completions.get(3).getSkinFactor());
BOOST_CHECK_EQUAL(WellCompletion::OPEN, connections.get(3).getState());
BOOST_CHECK_EQUAL(2.2836805555555556e-12 , connections.get(3).getConnectionTransmissibilityFactor());
BOOST_CHECK_EQUAL(0.311/Metric::Length, connections.get(3).getDiameter());
BOOST_CHECK_EQUAL(3.3, connections.get(3).getSkinFactor());
BOOST_CHECK_EQUAL(4U, well1->getCompletions( 7 ).size() );
BOOST_CHECK_EQUAL(WellCompletion::SHUT, well1->getCompletions( 7 ).get( 3 ).getState() );
BOOST_CHECK_EQUAL(4U, well1->getConnections( 7 ).size() );
BOOST_CHECK_EQUAL(WellCompletion::SHUT, well1->getConnections( 7 ).get( 3 ).getState() );
}
}
@ -665,9 +665,9 @@ COMPDAT \n\
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule sched(deck, grid , eclipseProperties, Phases(true, true, true) , parseContext);
const auto* well = sched.getWell("W1");
const auto& completions = well->getCompletions(0);
BOOST_CHECK_EQUAL( 10 , completions.get(0).getI() );
BOOST_CHECK_EQUAL( 20 , completions.get(0).getJ() );
const auto& connections = well->getConnections(0);
BOOST_CHECK_EQUAL( 10 , connections.get(0).getI() );
BOOST_CHECK_EQUAL( 20 , connections.get(0).getJ() );
}

View File

@ -133,14 +133,14 @@ BOOST_AUTO_TEST_CASE(test_RFT) {
r2.set( data::Rates::opt::oil, 4.22 );
r2.set( data::Rates::opt::gas, 4.23 );
std::vector<Opm::data::Completion> well1_comps(9);
std::vector<Opm::data::Connection> well1_comps(9);
for (size_t i = 0; i < 9; ++i) {
Opm::data::Completion well_comp { grid.getGlobalIndex(8,8,i) ,r1, 0.0 , 0.0, (double)i, 0.1*i,0.2*i};
Opm::data::Connection well_comp { grid.getGlobalIndex(8,8,i) ,r1, 0.0 , 0.0, (double)i, 0.1*i,0.2*i};
well1_comps[i] = well_comp;
}
std::vector<Opm::data::Completion> well2_comps(6);
std::vector<Opm::data::Connection> well2_comps(6);
for (size_t i = 0; i < 6; ++i) {
Opm::data::Completion well_comp { grid.getGlobalIndex(3,3,i+3) ,r2, 0.0 , 0.0, (double)i, i*0.1,i*0.2};
Opm::data::Connection well_comp { grid.getGlobalIndex(3,3,i+3) ,r2, 0.0 , 0.0, (double)i, i*0.1,i*0.2};
well2_comps[i] = well_comp;
}
@ -225,14 +225,14 @@ BOOST_AUTO_TEST_CASE(test_RFT2) {
r2.set( data::Rates::opt::oil, 4.22 );
r2.set( data::Rates::opt::gas, 4.23 );
std::vector<Opm::data::Completion> well1_comps(9);
std::vector<Opm::data::Connection> well1_comps(9);
for (size_t i = 0; i < 9; ++i) {
Opm::data::Completion well_comp { grid.getGlobalIndex(8,8,i) ,r1, 0.0 , 0.0, (double)i, 0.1*i,0.2*i};
Opm::data::Connection well_comp { grid.getGlobalIndex(8,8,i) ,r1, 0.0 , 0.0, (double)i, 0.1*i,0.2*i};
well1_comps[i] = well_comp;
}
std::vector<Opm::data::Completion> well2_comps(6);
std::vector<Opm::data::Connection> well2_comps(6);
for (size_t i = 0; i < 6; ++i) {
Opm::data::Completion well_comp { grid.getGlobalIndex(3,3,i+3) ,r2, 0.0 , 0.0, (double)i, i*0.1,i*0.2};
Opm::data::Connection well_comp { grid.getGlobalIndex(3,3,i+3) ,r2, 0.0 , 0.0, (double)i, i*0.1,i*0.2};
well2_comps[i] = well_comp;
}

View File

@ -197,7 +197,7 @@ std::ostream& operator<<( std::ostream& stream, const Rates& r ) {
<< "}";
}
std::ostream& operator<<( std::ostream& stream, const Completion& c ) {
std::ostream& operator<<( std::ostream& stream, const Connection& c ) {
return stream << "{ index: "
<< c.index << ", "
<< c.rates << ", "
@ -213,9 +213,9 @@ std::ostream& operator<<( std::ostream& stream,
<< "\t" << "bhp: " << p.second.bhp << "\n"
<< "\t" << "temp: " << p.second.temperature << "\n"
<< "\t" << "rates: " << p.second.rates << "\n"
<< "\t" << "completions: [\n";
<< "\t" << "connections: [\n";
for( const auto& c : p.second.completions )
for( const auto& c : p.second.connections )
stream << c << " ";
stream << "]\n";
@ -239,7 +239,7 @@ bool operator==( const Rates& lhs, const Rates& rhs ) {
return true;
}
bool operator==( const Completion& lhs, const Completion& rhs ) {
bool operator==( const Connection& lhs, const Connection& rhs ) {
BOOST_CHECK_EQUAL( lhs.index, rhs.index );
BOOST_CHECK_EQUAL( lhs.rates, rhs.rates );
BOOST_CHECK_EQUAL( lhs.pressure, rhs.pressure );
@ -248,7 +248,7 @@ bool operator==( const Completion& lhs, const Completion& rhs ) {
return true;
}
bool operator!=( const Completion& lhs, const Completion& rhs ) {
bool operator!=( const Connection& lhs, const Connection& rhs ) {
return !( lhs == rhs );
}
@ -259,8 +259,8 @@ bool operator==( const Well& lhs, const Well& rhs ) {
BOOST_CHECK_EQUAL( lhs.control, rhs.control );
BOOST_CHECK_EQUAL_COLLECTIONS(
lhs.completions.begin(), lhs.completions.end(),
rhs.completions.begin(), rhs.completions.end() );
lhs.connections.begin(), lhs.connections.end(),
rhs.connections.begin(), rhs.connections.end() );
return true;
}
@ -300,14 +300,14 @@ data::Wells mkWells() {
* the completion keys (active indices) and well names correspond to the
* input deck. All other entries in the well structures are arbitrary.
*/
w1.completions.push_back( { 88, rc1, 30.45, 123.4 } );
w1.completions.push_back( { 288, rc2, 33.19, 123.4 } );
w1.connections.push_back( { 88, rc1, 30.45, 123.4 } );
w1.connections.push_back( { 288, rc2, 33.19, 123.4 } );
w2.rates = r2;
w2.bhp = 2.34;
w2.temperature = 4.56;
w2.control = 2;
w2.completions.push_back( { 188, rc3, 36.22, 123.4 } );
w2.connections.push_back( { 188, rc3, 36.22, 123.4 } );
{
data::Wells wellRates;

View File

@ -146,10 +146,10 @@ static data::Wells result_wells() {
syncronized with the global index in the COMPDAT keyword in the
input deck.
*/
data::Completion well1_comp1 { 0 , crates1, 1.9 , 123.4};
data::Completion well2_comp1 { 1 , crates2, 1.10 , 123.4};
data::Completion well2_comp2 { 101, crates3, 1.11 , 123.4};
data::Completion well3_comp1 { 2 , crates3, 1.11 , 123.4};
data::Connection well1_comp1 { 0 , crates1, 1.9 , 123.4};
data::Connection well2_comp1 { 1 , crates2, 1.10 , 123.4};
data::Connection well2_comp2 { 101, crates3, 1.11 , 123.4};
data::Connection well3_comp1 { 2 , crates3, 1.11 , 123.4};
/*
The completions

View File

@ -103,14 +103,14 @@ BOOST_AUTO_TEST_CASE(get_completions) {
* the completion keys (active indices) and well names correspond to the
* input deck. All other entries in the well structures are arbitrary.
*/
w1.completions.push_back( { 88, rc1, 30.45, 123.45 } );
w1.completions.push_back( { 288, rc2, 33.19, 67.89 } );
w1.connections.push_back( { 88, rc1, 30.45, 123.45 } );
w1.connections.push_back( { 288, rc2, 33.19, 67.89 } );
w2.rates = r2;
w2.bhp = 2.34;
w2.temperature = 4.56;
w2.control = 2;
w2.completions.push_back( { 188, rc3, 36.22, 19.28 } );
w2.connections.push_back( { 188, rc3, 36.22, 19.28 } );
data::Wells wellRates;

View File

@ -48,12 +48,12 @@ BOOST_AUTO_TEST_CASE(create) {
out::RegionCache rc(es.get3DProperties() , grid, schedule);
{
const auto& empty = rc.completions( 4 );
const auto& empty = rc.connections( 4 );
BOOST_CHECK_EQUAL( empty.size() , 0 );
}
{
const auto& top_layer = rc.completions( 1 );
const auto& top_layer = rc.connections( 1 );
BOOST_CHECK_EQUAL( top_layer.size() , 3 );
{
auto pair = top_layer[0];

View File

@ -34,14 +34,14 @@ BOOST_AUTO_TEST_CASE( serialize_icon_test )
const Opm::Schedule schedule(deck, state);
const Opm::TimeMap timemap(deck);
for (size_t tstep = 0; tstep != timemap.numTimesteps(); ++tstep) {
const size_t ncwmax = schedule.getMaxNumCompletionsForWells(tstep);
const size_t ncwmax = schedule.getMaxNumConnectionsForWells(tstep);
const int ICONZ = 25; // normally obtained from InteHead
const auto wells = schedule.getWells(tstep);
const std::vector<int> icondata =
Opm::RestartIO::Helpers::serialize_ICON(tstep,
ncwmax,
@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE( serialize_icon_test )
for (const auto w : wells) {
size_t c_offset = 0;
for (const auto c : w->getCompletions(tstep)) {
for (const auto c : w->getConnections(tstep)) {
const size_t offset = w_offset + c_offset;
@ -73,17 +73,17 @@ BOOST_AUTO_TEST_CASE( serialize_icon_test )
BOOST_CHECK_EQUAL(icondata[offset + ICON_STATUS_INDEX],
-1000);
if (c.attachedToSegment())
if (c.attachedToSegment())
BOOST_CHECK_EQUAL(icondata[offset + ICON_SEGMENT_INDEX],
c.getSegmentNumber());
else
BOOST_CHECK_EQUAL(icondata[offset + ICON_SEGMENT_INDEX],
0);
c_offset += ICONZ;
}
w_offset += (ICONZ * ncwmax);
}
}
};

View File

@ -38,11 +38,11 @@ BOOST_AUTO_TEST_CASE( serialize_scon_test )
for (size_t tstep = 0; tstep != timemap.numTimesteps(); ++tstep) {
const size_t ncwmax = schedule.getMaxNumCompletionsForWells(tstep);
const size_t ncwmax = schedule.getMaxNumConnectionsForWells(tstep);
const int SCONZ = 40; // normally obtained from InteHead
const auto wells = schedule.getWells(tstep);
const std::vector<double> scondata =
Opm::RestartIO::Helpers::serialize_SCON(tstep,
ncwmax,
@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE( serialize_scon_test )
for (const auto w : wells) {
size_t c_offset = 0;
for (const auto c : w->getCompletions(tstep)) {
for (const auto c : w->getConnections(tstep)) {
const size_t offset = w_offset + c_offset;
const auto ctf = c.getConnectionTransmissibilityFactorAsValueObject();
@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE( serialize_scon_test )
: Opm::RestartIO::Helpers::UNIMPLEMENTED_VALUE;
BOOST_CHECK_EQUAL(scondata[offset + SCON_CF_INDEX],
expected);
BOOST_CHECK_EQUAL(scondata[offset + SCON_KH_INDEX],
BOOST_CHECK_EQUAL(scondata[offset + SCON_KH_INDEX],
Opm::RestartIO::Helpers::UNIMPLEMENTED_VALUE);
c_offset += SCONZ;
@ -72,4 +72,4 @@ BOOST_AUTO_TEST_CASE( serialize_scon_test )
}
}
};

View File

@ -25,7 +25,7 @@
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ConnectionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
@ -108,15 +108,15 @@ void verifyWellState(const std::string& rst_filename,
size_t num_wellconnections = well_conn_collection_get_size(well_connections);
int report_nr = well_state_get_report_nr(well_state);
const auto& completions_set = well->getCompletions((size_t)report_nr);
const auto& connections_set = well->getConnections((size_t)report_nr);
BOOST_CHECK_EQUAL(num_wellconnections, completions_set.size());
BOOST_CHECK_EQUAL(num_wellconnections, connections_set.size());
//Verify coordinates for each completion connection
for (size_t k = 0; k < num_wellconnections; ++k) {
const well_conn_type * well_connection = well_conn_collection_iget_const(well_connections , k);
const auto& completion = completions_set.get(k);
const auto& completion = connections_set.get(k);
BOOST_CHECK_EQUAL(well_conn_get_i(well_connection), completion.getI());
BOOST_CHECK_EQUAL(well_conn_get_j(well_connection), completion.getJ());