Compare commits

...

13 Commits

Author SHA1 Message Date
Arne Morten Kvarving
8fa165c0d7 bump version to 2019.04 2019-05-08 08:29:45 +02:00
Arne Morten Kvarving
8ff950227f bump version to 2019.04-rc3 2019-05-03 10:42:48 +02:00
Joakim Hove
bc5aeaf4bf Internalize a global WHISTCTL setting in the Schedule object 2019-05-03 10:40:26 +02:00
Atgeirr Flø Rasmussen
0108437201 Bugfix: do not keep old control modes.
They will be treated as limits, and cause wrong behaviour.
2019-05-03 08:59:01 +02:00
Arne Morten Kvarving
828fe797f0 bump version to 2019.04 rc2 2019-04-29 08:50:42 +02:00
Jostein Alvestad
8f24032612 Added a improvement to the handling of MSW data for writing to restart file
Improvement to handle more general MSW data  for writing to
Eclipse compatible restart file
2019-04-26 09:40:50 +02:00
Joakim Hove
ee6bfbd76f Add configuration for keyword FLUXTYPE 2019-04-25 12:33:57 +02:00
Markus Blatt
54ee583112 Reintroduce overeagerly removed const qualifiers before function parameters.
Actually, the compiler does not complain about const in void func(const T type).
It just complains about const qualifiers before by-value return types.
2019-04-25 11:38:51 +02:00
Markus Blatt
b69010cfc9 reintroduce some const with elegance 2019-04-25 11:38:51 +02:00
Markus Blatt
2859980cb4 Removes nearly all warnings experienced with g++-8.3
Namely:
- unused parameter
- type qualifiers ignored ...
- catchinhg polymorphic type ... by value
2019-04-25 11:38:51 +02:00
Joakim Hove
3ffefd8098 Fix bug in WellSegments== 2019-04-25 08:31:32 +02:00
Joakim Hove
852fdd7ac4 Add "size" : 1 attribute to CARFIN keyword 2019-04-25 08:31:32 +02:00
Arne Morten Kvarving
47a43daeac bump versions to 2019.04-rc1 2019-04-12 10:29:12 +02:00
28 changed files with 201 additions and 86 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
opm-common (2019.04-pre~xenial) xenial; urgency=medium
opm-common (2019.04-rfinal-1~xenial) xenial; urgency=medium
* New release

View File

@ -5,8 +5,8 @@
Module: opm-common
Description: Open Porous Media Initiative shared infrastructure
Version: 2019.04-pre
Label: 2019.04-pre
Version: 2019.04
Label: 2019.04
Maintainer: opm@opm-project.org
MaintainerName: OPM community
Url: http://opm-project.org

View File

@ -30,7 +30,7 @@
#include <opm/msim/msim.hpp>
int main(int argc, char** argv) {
int main(int /* argc */, char** argv) {
std::string deck_file = argv[1];
Opm::Parser parser;
Opm::ParseContext parse_context;

View File

@ -51,7 +51,7 @@ void msim::run(Schedule& schedule, EclipseIO& io) {
}
void msim::post_step(Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const {
void msim::post_step(Schedule& schedule, data::Solution& /* sol */, data::Wells& /* well_data */, size_t report_step, EclipseIO& io) const {
const auto& actions = schedule.actions();
if (actions.empty())
return;
@ -98,7 +98,7 @@ void msim::run_step(const Schedule& schedule, data::Solution& sol, data::Wells&
void msim::output(size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const {
void msim::output(size_t report_step, bool /* substep */, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const {
RestartValue value(sol, well_data);
io.writeTimeStep(report_step,
false,

View File

@ -192,6 +192,7 @@ namespace Opm
DynamicState<std::shared_ptr<WellTestConfig>> wtest_config;
DynamicState<std::shared_ptr<WListManager>> wlist_manager;
DynamicState<std::shared_ptr<UDQInput>> udq_config;
DynamicState<WellProducer::ControlModeEnum> global_whistctl_mode;
RFTConfig rft_config;
Actions m_actions;

View File

@ -52,6 +52,7 @@ namespace Opm {
public:
Well(const std::string& name, const size_t& seqIndex, int headI,
int headJ, double refDepth, double drainageRadius, Phase preferredPhase,
WellProducer::ControlModeEnum whist_ctl,
const TimeMap& timeMap, size_t creationTimeStep,
WellCompletion::CompletionOrderEnum completionOrdering = WellCompletion::TRACK,
bool allowCrossFlow = true, bool automaticShutIn = true);

View File

@ -5,7 +5,7 @@
%define tag final
Name: opm-common
Version: 2018.10
Version: 2019.04
Release: 0
Summary: Open Porous Media - common helpers and buildsystem
License: GPL-3.0

View File

@ -53,9 +53,9 @@ namespace {
return inteHead[19];
}
const int groupType(const Opm::Schedule& sched,
int groupType(const Opm::Schedule& sched,
const Opm::Group& group,
const std::size_t simStep)
const std::size_t simStep)
{
const std::string& groupName = group.name();
if (!sched.hasGroup(groupName))
@ -118,7 +118,7 @@ namespace {
return groupIndexMap;
}
const int currentGroupLevel(const Opm::Schedule& sched, const Opm::Group& group, const size_t simStep)
int currentGroupLevel(const Opm::Schedule& sched, const Opm::Group& group, const size_t simStep)
{
int level = 0;
const std::vector< const Opm::Group* > groups = sched.getGroups(simStep);
@ -462,8 +462,8 @@ namespace {
void
Opm::RestartIO::Helpers::groupMaps::
currentGrpTreeNameSeqIndMap(const Opm::Schedule& sched,
const size_t simStep,
const std::map<const std::string , size_t>& GnIMap,
const size_t simStep,
const std::map<const std::string , size_t>& /* GnIMap */,
const std::map<size_t, const Opm::Group*>& IGMap)
{
const auto& grpTreeNSIMap = (sched.getGroupTree(simStep)).nameSeqIndMap();
@ -545,7 +545,7 @@ captureDeclaredGroupData(const Opm::Schedule& sched,
// Define Static Contributions to SGrp Array.
groupLoop(curGroups,
[this](const Group& group, const std::size_t groupID) -> void
[this](const Group& /* group */, const std::size_t groupID) -> void
{
auto sw = this->sGroup_[groupID];
SGrp::staticContrib(sw);

View File

@ -207,10 +207,18 @@ namespace {
const auto& segNo = openConnections[connID]->segment();
const auto& segInd = segSet.segmentNumberToIndex(segNo);
const auto& Q = rateConns[connID].rates;
qosc[segInd] += -units.from_si(M::liquid_surface_rate, Q.get(R::oil));
qwsc[segInd] += -units.from_si(M::liquid_surface_rate, Q.get(R::wat));
qgsc[segInd] += -units.from_si(M::gas_surface_rate, Q.get(R::gas));
auto get = [&units, &Q](const M u, const R q) -> double
{
const auto val = Q.has(q) ? Q.get(q) : 0.0;
return - units.from_si(u, val);
};
qosc[segInd] += get(M::liquid_surface_rate, R::oil);
qwsc[segInd] += get(M::liquid_surface_rate, R::wat);
qgsc[segInd] += get(M::gas_surface_rate, R::gas);
}
return {
@ -416,7 +424,7 @@ namespace {
void staticContrib(const Opm::Well& well,
const std::size_t rptStep,
const std::vector<int>& inteHead,
const Opm::EclipseGrid& grid,
const Opm::EclipseGrid& /* grid */,
ISegArray& iSeg
)
{

View File

@ -265,7 +265,7 @@ namespace {
const std::size_t msWellID,
const std::map <const std::string, size_t>& GroupMapNameInd,
/*const std::vector<std::string>& groupNames,*/
const int maxGroups,
const int /* maxGroups */,
const std::size_t sim_step,
IWellArray& iWell)
{

View File

@ -43,7 +43,7 @@ namespace {
{
const auto nWells = sched.numWells();
if (nWells > static_cast<decltype(nWells)>(wdims.maxWellsInField()))
if (nWells > std::size_t(wdims.maxWellsInField()))
{
std::ostringstream os;
os << "Run uses " << nWells << " wells, but allocates at "
@ -87,7 +87,7 @@ namespace {
// Note: "1 +" to account for FIELD group being in 'sched.numGroups()'
// but excluded from WELLDIMS(3).
if (nGroups > 1 + static_cast<decltype(nGroups)>(wdims.maxGroupsInField()))
if (nGroups > 1U + wdims.maxGroupsInField())
{
std::ostringstream os;
os << "Run uses " << (nGroups - 1) << " non-FIELD groups, but "

View File

@ -400,7 +400,7 @@ namespace Opm {
&& this->m_number_branch == rhs.m_number_branch
&& this->m_depth_top == rhs.m_depth_top
&& this->m_length_top == rhs.m_length_top
&& this->m_volume_top == rhs.m_length_top
&& this->m_volume_top == rhs.m_volume_top
&& this->m_length_depth_type == rhs.m_length_depth_type
&& this->m_comp_pressure_drop == rhs.m_comp_pressure_drop
&& this->m_multiphase_model == rhs.m_multiphase_model

View File

@ -150,7 +150,7 @@ std::size_t RFTConfig::firstRFTOutput() const {
for (const auto& rft_pair : this->plt_config) {
const auto& dynamic_state = rft_pair.second;
auto pred = [] (const std::pair<PLTConnections::PLTEnum, std::size_t>& elm) { return false; };
auto pred = [] (const std::pair<PLTConnections::PLTEnum, std::size_t>& ) { return false; };
int this_first_rft = dynamic_state.find_if(pred);
if (this_first_rft >= 0)
first_rft = std::min(first_rft, static_cast<std::size_t>(this_first_rft));

View File

@ -87,6 +87,7 @@ namespace Opm {
wtest_config(this->m_timeMap, std::make_shared<WellTestConfig>() ),
wlist_manager( this->m_timeMap, std::make_shared<WListManager>()),
udq_config(this->m_timeMap, std::make_shared<UDQInput>(deck)),
global_whistctl_mode(this->m_timeMap, WellProducer::CMODE_UNDEFINED),
rft_config(this->m_timeMap)
{
addGroup( "FIELD", 0 );
@ -436,7 +437,8 @@ namespace Opm {
std::string msg = "The WHISTCTL keyword specifies an un-supported control mode " + cmodeString
+ ", which makes WHISTCTL keyword not affect the simulation at all";
OpmLog::warning(msg);
}
} else
this->global_whistctl_mode.update(currentStep, controlMode);
}
const std::string bhp_terminate = record.getItem("BPH_TERMINATE").getTrimmedString(0);
@ -1628,10 +1630,9 @@ namespace Opm {
}
const size_t wseqIndex = m_wells.size();
Well well(wellName, wseqIndex,
headI, headJ, refDepth, drainageRadius,
preferredPhase, m_timeMap,
preferredPhase, this->global_whistctl_mode[timeStep], m_timeMap,
timeStep,
wellConnectionOrder, allowCrossFlow, automaticShutIn);

View File

@ -35,6 +35,7 @@ namespace Opm {
Well::Well(const std::string& name_, const size_t& seqIndex_, int headI,
int headJ, double refDepth , double drainageRadius, Phase preferredPhase,
WellProducer::ControlModeEnum whist_ctl,
const TimeMap& timeMap, size_t creationTimeStep,
WellCompletion::CompletionOrderEnum completionOrdering,
bool allowCrossFlow, bool automaticShutIn)
@ -67,6 +68,9 @@ namespace Opm {
m_segmentset( timeMap, WellSegments{} ),
timesteps( timeMap.numTimesteps() )
{
WellProductionProperties p;
p.whistctl_cmode = whist_ctl;
this->m_productionProperties = DynamicState<WellProductionProperties>(timeMap, p);
}
const std::string& Well::name() const {

View File

@ -67,6 +67,7 @@ namespace Opm {
else
cmode = wp::ControlModeFromString( cmodeItem.getTrimmedString( 0 ) );
m_productionControls = 0;
if (effectiveHistoryProductionControl(cmode)) {
this->addProductionControl( cmode );
this->controlMode = cmode;

View File

@ -29,7 +29,7 @@ namespace Opm {
{
}
void Rock2dTable::init(const DeckRecord& record, size_t tableIdx)
void Rock2dTable::init(const DeckRecord& record, size_t /* tableIdx */)
{
m_pressureValues.push_back(record.getItem("PRESSURE").getSIDoubleData()[0]);
m_pvmultValues.push_back(record.getItem("PVMULT").getSIDoubleData());

View File

@ -29,7 +29,7 @@ namespace Opm {
{
}
void Rock2dtrTable::init(const DeckRecord& record, size_t tableIdx)
void Rock2dtrTable::init(const DeckRecord& record, size_t /* tableIdx */)
{
m_pressureValues.push_back(record.getItem("PRESSURE").getSIDoubleData()[0]);
m_transMultValues.push_back(record.getItem("TRANSMULT").getSIDoubleData());

View File

@ -322,7 +322,7 @@ void ParserState::loadFile(const boost::filesystem::path& inputFile) {
boost::filesystem::path inputFileCanonical;
try {
inputFileCanonical = boost::filesystem::canonical(inputFile);
} catch (boost::filesystem::filesystem_error fs_error) {
} catch (const boost::filesystem::filesystem_error& fs_error) {
std::string msg = "Could not open file: " + inputFile.string();
parseContext.handleError( ParseContext::PARSE_MISSING_INCLUDE , msg, errors);
return;

View File

@ -1,4 +1,6 @@
{"name" : "CARFIN" , "sections" : ["GRID"], "items" : [
{"name" : "CARFIN" , "sections" : ["GRID"],
"size" : 1,
"items" : [
{"name" : "NAME", "value_type": "STRING"},
{"name" : "I1", "value_type" : "INT"},
{"name" : "I2", "value_type" : "INT"},

View File

@ -0,0 +1,5 @@
{"name" : "FLUXTYPE",
"sections" : ["GRID"],
"size" : 1}

View File

@ -103,6 +103,7 @@ set( keywords
000_Eclipse100/F/FIPOWG
000_Eclipse100/F/FIP_PROBE
000_Eclipse100/F/FLUXNUM
000_Eclipse100/F/FLUXTYPE
000_Eclipse100/F/FMTIN
000_Eclipse100/F/FMTOUT
000_Eclipse100/F/FMWSET

View File

@ -44,12 +44,12 @@
using namespace Opm;
double prod_opr(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) {
double prod_opr(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double seconds_elapsed) {
const auto& units = es.getUnits();
return -units.to_si(UnitSystem::measure::rate, seconds_elapsed);
}
void pressure(const EclipseState& es, const Schedule& sched, data::Solution& sol, size_t report_step, double seconds_elapsed) {
void pressure(const EclipseState& es, const Schedule& /* sched */, data::Solution& sol, size_t /* report_step */, double seconds_elapsed) {
const auto& grid = es.getInputGrid();
const auto& units = es.getUnits();
if (!sol.has("PRESSURE"))

View File

@ -66,25 +66,25 @@ struct test_data {
};
double prod_opr(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) {
double prod_opr(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) {
const auto& units = es.getUnits();
double oil_rate = 1.0;
return -units.to_si(UnitSystem::measure::rate, oil_rate);
}
double prod_opr_low(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) {
double prod_opr_low(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) {
const auto& units = es.getUnits();
double oil_rate = 0.5;
return -units.to_si(UnitSystem::measure::rate, oil_rate);
}
double prod_wpr_P1(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) {
double prod_wpr_P1(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) {
const auto& units = es.getUnits();
double water_rate = 0.0;
return -units.to_si(UnitSystem::measure::rate, water_rate);
}
double prod_wpr_P2(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) {
double prod_wpr_P2(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t report_step, double /* seconds_elapsed */) {
const auto& units = es.getUnits();
double water_rate = 0.0;
if (report_step > 5)
@ -93,13 +93,13 @@ double prod_wpr_P2(const EclipseState& es, const Schedule& sched, const data::S
return -units.to_si(UnitSystem::measure::rate, water_rate);
}
double prod_wpr_P3(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) {
double prod_wpr_P3(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) {
const auto& units = es.getUnits();
double water_rate = 0.0;
return -units.to_si(UnitSystem::measure::rate, water_rate);
}
double prod_wpr_P4(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) {
double prod_wpr_P4(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t report_step, double /* seconds_elapsed */) {
const auto& units = es.getUnits();
double water_rate = 0.0;
if (report_step > 10)

View File

@ -156,8 +156,8 @@ BOOST_AUTO_TEST_CASE(GroupAddWell) {
auto timeMap = createXDaysTimeMap( 10 );
Opm::Group group("G1" , 1, timeMap , 0);
auto well1 = std::make_shared< Well >("WELL1", 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap, 0);
auto well2 = std::make_shared< Well >("WELL2", 2, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap, 0);
auto well1 = std::make_shared< Well >("WELL1", 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
auto well2 = std::make_shared< Well >("WELL2", 2, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK_EQUAL(0U , group.numWells(2));
group.addWell( 3 , well1.get() );
@ -193,8 +193,8 @@ BOOST_AUTO_TEST_CASE(GroupAddAndDelWell) {
auto timeMap = createXDaysTimeMap( 10 );
Opm::Group group("G1" , 1, timeMap , 0);
auto well1 = std::make_shared< Well >("WELL1", 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap, 0);
auto well2 = std::make_shared< Well >("WELL2", 2, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap, 0);
auto well1 = std::make_shared< Well >("WELL1", 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
auto well2 = std::make_shared< Well >("WELL2", 2, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK_EQUAL(0U , group.numWells(2));
group.addWell( 3 , well1.get() );
@ -226,8 +226,8 @@ BOOST_AUTO_TEST_CASE(GroupAddAndDelWell) {
BOOST_AUTO_TEST_CASE(getWells) {
auto timeMap = createXDaysTimeMap( 10 );
Opm::Group group("G1" , 1, timeMap , 0);
auto well1 = std::make_shared< Well >("WELL1", 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap, 0);
auto well2 = std::make_shared< Well >("WELL2", 2, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap, 0);
auto well1 = std::make_shared< Well >("WELL1", 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
auto well2 = std::make_shared< Well >("WELL2", 2, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
group.addWell( 2 , well1.get() );
group.addWell( 3 , well1.get() );

View File

@ -1516,6 +1516,113 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
BOOST_CHECK_EQUAL(well_p2->getProductionProperties(5).controlMode, Opm::WellProducer::ORAT);
}
BOOST_AUTO_TEST_CASE(WHISTCTL_NEW_WELL) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
"SCHEDULE\n"
"WHISTCTL\n"
" GRAT/ \n"
"DATES -- 1\n"
" 10 OKT 2008 / \n"
"/\n"
"WELSPECS\n"
" 'P1' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
" 'P2' 'OP' 5 5 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
" 'I' 'OP' 1 1 1* 'WATER' 1* 1* 1* 1* 1* 1* 1* / \n"
"/\n"
"COMPDAT\n"
" 'P1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
" 'P1' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
" 'P2' 5 5 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
" 'P2' 5 5 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
" 'I' 1 1 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
"/\n"
"WCONHIST\n"
" 'P1' 'OPEN' 'ORAT' 5*/ \n"
" 'P2' 'OPEN' 'ORAT' 5*/ \n"
"/\n"
"DATES -- 2\n"
" 15 OKT 2008 / \n"
"/\n"
"WHISTCTL\n"
" RESV / \n"
"WCONHIST\n"
" 'P1' 'OPEN' 'ORAT' 5*/ \n"
" 'P2' 'OPEN' 'ORAT' 5*/ \n"
"/\n"
"DATES -- 3\n"
" 18 OKT 2008 / \n"
"/\n"
"WCONHIST\n"
" 'P1' 'OPEN' 'ORAT' 5*/ \n"
" 'P2' 'OPEN' 'ORAT' 5*/ \n"
"/\n"
"DATES -- 4\n"
" 20 OKT 2008 / \n"
"/\n"
"WHISTCTL\n"
" LRAT / \n"
"WCONHIST\n"
" 'P1' 'OPEN' 'ORAT' 5*/ \n"
" 'P2' 'OPEN' 'ORAT' 5*/ \n"
"/\n"
"DATES -- 5\n"
" 25 OKT 2008 / \n"
"/\n"
"WHISTCTL\n"
" NONE / \n"
"WCONHIST\n"
" 'P1' 'OPEN' 'ORAT' 5*/ \n"
" 'P2' 'OPEN' 'ORAT' 5*/ \n"
"/\n"
;
auto deck = parser.parseString(input);
EclipseGrid grid(10,10,10);
TableManager table ( deck );
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Runspec runspec (deck);
Schedule schedule(deck, grid , eclipseProperties, runspec);
auto* well_p1 = schedule.getWell("P1");
auto* well_p2 = schedule.getWell("P2");
//10 OKT 2008
BOOST_CHECK_EQUAL(well_p1->getProductionProperties(1).controlMode, Opm::WellProducer::GRAT);
BOOST_CHECK_EQUAL(well_p2->getProductionProperties(1).controlMode, Opm::WellProducer::GRAT);
//15 OKT 2008
BOOST_CHECK_EQUAL(well_p1->getProductionProperties(2).controlMode, Opm::WellProducer::RESV);
BOOST_CHECK_EQUAL(well_p2->getProductionProperties(2).controlMode, Opm::WellProducer::RESV);
// under history mode, a producing well should have only one rate target/limit or have no rate target/limit.
// the rate target/limit from previous report step should not be kept.
BOOST_CHECK( !well_p1->getProductionProperties(2).hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !well_p2->getProductionProperties(2).hasProductionControl(Opm::WellProducer::ORAT) );
//18 OKT 2008
BOOST_CHECK_EQUAL(well_p1->getProductionProperties(3).controlMode, Opm::WellProducer::RESV);
BOOST_CHECK_EQUAL(well_p2->getProductionProperties(3).controlMode, Opm::WellProducer::RESV);
BOOST_CHECK( !well_p1->getProductionProperties(3).hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !well_p2->getProductionProperties(3).hasProductionControl(Opm::WellProducer::ORAT) );
// 20 OKT 2008
BOOST_CHECK_EQUAL(well_p1->getProductionProperties(4).controlMode, Opm::WellProducer::LRAT);
BOOST_CHECK_EQUAL(well_p2->getProductionProperties(4).controlMode, Opm::WellProducer::LRAT);
BOOST_CHECK( !well_p1->getProductionProperties(4).hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !well_p2->getProductionProperties(4).hasProductionControl(Opm::WellProducer::ORAT) );
BOOST_CHECK( !well_p1->getProductionProperties(4).hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !well_p2->getProductionProperties(4).hasProductionControl(Opm::WellProducer::RESV) );
// 25 OKT 2008
BOOST_CHECK_EQUAL(well_p1->getProductionProperties(5).controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK_EQUAL(well_p2->getProductionProperties(5).controlMode, Opm::WellProducer::ORAT);
BOOST_CHECK( !well_p1->getProductionProperties(5).hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !well_p2->getProductionProperties(5).hasProductionControl(Opm::WellProducer::RESV) );
BOOST_CHECK( !well_p1->getProductionProperties(5).hasProductionControl(Opm::WellProducer::LRAT) );
BOOST_CHECK( !well_p2->getProductionProperties(5).hasProductionControl(Opm::WellProducer::LRAT) );
}
BOOST_AUTO_TEST_CASE(unsupportedOptionWHISTCTL) {
Opm::Parser parser;
std::string input =

View File

@ -63,31 +63,15 @@ inline std::ostream& operator<<( std::ostream& stream, const Well& well ) {
BOOST_AUTO_TEST_CASE(CreateWell_CorrectNameAndDefaultValues) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL( "WELL1" , well.name() );
BOOST_CHECK_EQUAL(0.0 , well.getProductionPropertiesCopy(5).OilRate);
}
BOOST_AUTO_TEST_CASE(CreateWell_Equals) {
auto timeMap = createXDaysTimeMap(10);
auto timeMap2 = createXDaysTimeMap(11);
Opm::Well well1("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well2("WELL1" , 2, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well3("WELL3" , 3, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well4("WELL3" , 4, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap2 , 0);
BOOST_CHECK_EQUAL( well1, well1 );
BOOST_CHECK_EQUAL( well2, well1 );
BOOST_CHECK( well1 == well2 );
BOOST_CHECK( well1 != well3 );
BOOST_CHECK( well3 != well2 );
BOOST_CHECK( well3 == well3 );
BOOST_CHECK( well4 != well3 );
}
BOOST_AUTO_TEST_CASE(CreateWell_GetProductionPropertiesShouldReturnSameObject) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(&(well.getProductionProperties(5)), &(well.getProductionProperties(5)));
BOOST_CHECK_EQUAL(&(well.getProductionProperties(8)), &(well.getProductionProperties(8)));
@ -96,7 +80,7 @@ BOOST_AUTO_TEST_CASE(CreateWell_GetProductionPropertiesShouldReturnSameObject) {
BOOST_AUTO_TEST_CASE(CreateWell_GetInjectionPropertiesShouldReturnSameObject) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(&(well.getInjectionProperties(5)), &(well.getInjectionProperties(5)));
BOOST_CHECK_EQUAL(&(well.getInjectionProperties(8)), &(well.getInjectionProperties(8)));
@ -105,7 +89,7 @@ BOOST_AUTO_TEST_CASE(CreateWell_GetInjectionPropertiesShouldReturnSameObject) {
BOOST_AUTO_TEST_CASE(CreateWellCreateTimeStepOK) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 5);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 5);
BOOST_CHECK_EQUAL( false , well.hasBeenDefined(0) );
BOOST_CHECK_EQUAL( false , well.hasBeenDefined(4) );
BOOST_CHECK_EQUAL( true , well.hasBeenDefined(5) );
@ -116,7 +100,7 @@ BOOST_AUTO_TEST_CASE(CreateWellCreateTimeStepOK) {
BOOST_AUTO_TEST_CASE(setWellProductionProperties_PropertiesSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(0.0 , well.getProductionPropertiesCopy( 5 ).OilRate);
Opm::WellProductionProperties props;
@ -149,7 +133,7 @@ BOOST_AUTO_TEST_CASE(setWellProductionProperties_PropertiesSetCorrect) {
BOOST_AUTO_TEST_CASE(setOilRate_RateSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(0.0 , well.getProductionPropertiesCopy(5).OilRate);
Opm::WellProductionProperties props;
@ -161,7 +145,7 @@ BOOST_AUTO_TEST_CASE(setOilRate_RateSetCorrect) {
BOOST_AUTO_TEST_CASE(seLiquidRate_RateSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(0.0 , well.getProductionPropertiesCopy(5).LiquidRate);
Opm::WellProductionProperties props;
@ -174,7 +158,7 @@ BOOST_AUTO_TEST_CASE(seLiquidRate_RateSetCorrect) {
BOOST_AUTO_TEST_CASE(setPredictionModeProduction_ModeSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL( true, well.getProductionPropertiesCopy(5).predictionMode);
Opm::WellProductionProperties props;
@ -187,7 +171,7 @@ BOOST_AUTO_TEST_CASE(setPredictionModeProduction_ModeSetCorrect) {
BOOST_AUTO_TEST_CASE(setpredictionModeInjection_ModeSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL( true, well.getInjectionPropertiesCopy(5).predictionMode);
Opm::WellInjectionProperties props;
@ -334,13 +318,13 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestINPUT) {
BOOST_AUTO_TEST_CASE(NewWellZeroCompletions) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL( 0U , well.getConnections( 0 ).size() );
}
BOOST_AUTO_TEST_CASE(setGasRate_RateSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::GAS, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::GAS, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(0.0 , well.getProductionPropertiesCopy(5).GasRate);
Opm::WellProductionProperties properties;
@ -354,7 +338,7 @@ BOOST_AUTO_TEST_CASE(setGasRate_RateSetCorrect) {
BOOST_AUTO_TEST_CASE(setWaterRate_RateSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(0.0 , well.getProductionPropertiesCopy(5).WaterRate);
Opm::WellProductionProperties properties;
@ -367,7 +351,7 @@ BOOST_AUTO_TEST_CASE(setWaterRate_RateSetCorrect) {
BOOST_AUTO_TEST_CASE(setSurfaceInjectionRate_RateSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(0.0 , well.getInjectionPropertiesCopy(5).surfaceInjectionRate);
Opm::WellInjectionProperties props(well.getInjectionPropertiesCopy(5));
@ -386,7 +370,7 @@ BOOST_AUTO_TEST_CASE(setSurfaceInjectionRate_RateSetCorrect) {
BOOST_AUTO_TEST_CASE(setReservoirInjectionRate_RateSetCorrect) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, timeMap , 0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap , 0);
BOOST_CHECK_EQUAL(0.0 , well.getInjectionPropertiesCopy(5).reservoirInjectionRate);
Opm::WellInjectionProperties properties(well.getInjectionPropertiesCopy(5));
@ -401,7 +385,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
// HACK: This test checks correctly setting of isProducer/isInjector. This property depends on which of
// WellProductionProperties/WellInjectionProperties is set last, independent of actual values.
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, timeMap ,0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap ,0);
/* 1: Well is created as producer */
BOOST_CHECK_EQUAL( false , well.isInjector(0));
@ -457,7 +441,7 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) {
BOOST_AUTO_TEST_CASE(GroupnameCorretlySet) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, timeMap ,0);
Opm::Well well("WELL1" , 1, 0, 0, 0.0, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap ,0);
BOOST_CHECK_EQUAL("" , well.getGroupName(2));
@ -471,7 +455,7 @@ BOOST_AUTO_TEST_CASE(GroupnameCorretlySet) {
BOOST_AUTO_TEST_CASE(addWELSPECS_setData_dataSet) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1", 1, 23, 42, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 3);
Opm::Well well("WELL1", 1, 23, 42, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 3);
BOOST_CHECK(!well.hasBeenDefined(2));
BOOST_CHECK(well.hasBeenDefined(3));
@ -484,7 +468,7 @@ BOOST_AUTO_TEST_CASE(addWELSPECS_setData_dataSet) {
BOOST_AUTO_TEST_CASE(XHPLimitDefault) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
Opm::WellProductionProperties productionProps(well.getProductionPropertiesCopy(1));
@ -505,7 +489,7 @@ BOOST_AUTO_TEST_CASE(XHPLimitDefault) {
BOOST_AUTO_TEST_CASE(InjectorType) {
auto timeMap = createXDaysTimeMap(10);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
Opm::WellInjectionProperties injectionProps(well.getInjectionPropertiesCopy(1));
injectionProps.injectorType = Opm::WellInjector::WATER;
@ -523,7 +507,7 @@ BOOST_AUTO_TEST_CASE(InjectorType) {
BOOST_AUTO_TEST_CASE(WellHaveProductionControlLimit) {
auto timeMap = createXDaysTimeMap(20);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::OIL, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK( !well.getProductionPropertiesCopy(1).hasProductionControl( Opm::WellProducer::ORAT ));
@ -573,7 +557,7 @@ BOOST_AUTO_TEST_CASE(WellHaveProductionControlLimit) {
BOOST_AUTO_TEST_CASE(WellHaveInjectionControlLimit) {
auto timeMap = createXDaysTimeMap(20);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK( !well.getInjectionPropertiesCopy(1).hasInjectionControl( Opm::WellInjector::RATE ));
BOOST_CHECK( !well.getInjectionPropertiesCopy(1).hasInjectionControl( Opm::WellInjector::RESV ));
@ -617,7 +601,7 @@ BOOST_AUTO_TEST_CASE(WellHaveInjectionControlLimit) {
BOOST_AUTO_TEST_CASE(WellSetAvailableForGroupControl_ControlSet) {
auto timeMap = createXDaysTimeMap(20);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK(well.isAvailableForGroupControl(10));
well.setAvailableForGroupControl(12, false);
@ -628,7 +612,7 @@ BOOST_AUTO_TEST_CASE(WellSetAvailableForGroupControl_ControlSet) {
BOOST_AUTO_TEST_CASE(WellSetGuideRate_GuideRateSet) {
auto timeMap = createXDaysTimeMap(20);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK_LT(well.getGuideRate(0), 0);
well.setGuideRate(1, 32.2);
@ -638,7 +622,7 @@ BOOST_AUTO_TEST_CASE(WellSetGuideRate_GuideRateSet) {
BOOST_AUTO_TEST_CASE(WellGuideRatePhase_GuideRatePhaseSet) {
auto timeMap = createXDaysTimeMap(20);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK_EQUAL(Opm::GuideRate::UNDEFINED, well.getGuideRatePhase(0));
well.setGuideRatePhase(3, Opm::GuideRate::RAT);
BOOST_CHECK_EQUAL(Opm::GuideRate::UNDEFINED, well.getGuideRatePhase(2));
@ -647,7 +631,7 @@ BOOST_AUTO_TEST_CASE(WellGuideRatePhase_GuideRatePhaseSet) {
BOOST_AUTO_TEST_CASE(WellEfficiencyFactorSet) {
auto timeMap = createXDaysTimeMap(20);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK_EQUAL(1.0, well.getEfficiencyFactor(0));
well.setEfficiencyFactor(3, 0.9);
BOOST_CHECK_EQUAL(1.0, well.getEfficiencyFactor(0));
@ -656,7 +640,7 @@ BOOST_AUTO_TEST_CASE(WellEfficiencyFactorSet) {
BOOST_AUTO_TEST_CASE(WellSetScalingFactor_ScalingFactorSetSet) {
auto timeMap = createXDaysTimeMap(20);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, timeMap, 0);
Opm::Well well("WELL1", 1, 1, 2, 2334.32, 0.0, Opm::Phase::WATER, Opm::WellProducer::CMODE_UNDEFINED, timeMap, 0);
BOOST_CHECK_EQUAL(1.0, well.getGuideRateScalingFactor(0));
well.setGuideRateScalingFactor(4, 0.6);
BOOST_CHECK_EQUAL(1.0, well.getGuideRateScalingFactor(3));

View File

@ -71,7 +71,7 @@ struct MockIH
MockIH::MockIH(const int numWells,
const int nsegWell,
const int ncwMax,
const int /* ncwMax */,
const int iConnPerConn,
const int sConnPerConn,
const int xConnPerConn)