Skip to content

Commit 3862533

Browse files
committed
Add WELL_THP_UPDATE schedule event
Raised when the well THP limit and/or VFP table is (re)specified: by WCONPROD or WCONHIST, by WELTARG with THP or VFP control, or by WTMULT with THP control. Unlike PRODUCTION_UPDATE it is raised also when the entered values are unchanged, since re-specifying either input cancels a THP limit imposed dynamically by the simulator (e.g. by network balancing).
1 parent 6932d27 commit 3862533

4 files changed

Lines changed: 128 additions & 1 deletion

File tree

opm/input/eclipse/Schedule/Events.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace Opm
4747
NEW_GROUP = (UINT64_C(1) << 3),
4848

4949
/// The PRODUCTION_UPDATE event is triggered by the WCONPROD,
50-
/// WCONHIST, WELTARG, WEFAC keywords. The event will be
50+
/// WCONHIST, WELTARG, WTMULT keywords. The event will be
5151
/// triggered if *any* of the elements in one of keywords is
5252
/// changed. Quite simlar for INJECTION_UPDATE and
5353
/// POLYMER_UPDATE.
@@ -113,6 +113,15 @@ namespace Opm
113113
/// request OPEN for an existing connection/completion (regardless of
114114
/// the recorded schedule state).
115115
REQUEST_OPEN_COMPLETION = (UINT64_C(1) << 24),
116+
117+
/// The well THP limit and/or VFP table has been (re)specified
118+
/// by WCONPROD or WCONHIST for the named wells, by WELTARG with
119+
/// THP or VFP control, or by WTMULT with THP control. Unlike
120+
/// PRODUCTION_UPDATE, the event is also triggered when the
121+
/// entered values are unchanged, since re-specifying either
122+
/// input cancels a THP limit imposed dynamically by the
123+
/// simulator (e.g. by network balancing).
124+
WELL_THP_UPDATE = (UINT64_C(1) << 25),
116125
};
117126
} // namespace ScheduleEvents
118127

opm/input/eclipse/Schedule/Well/WellKeywordHandlers.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ void handleWCONHIST(HandlerContext& handlerContext)
188188
update_well = true;
189189
}
190190

191+
// The VFP table (item 7) is re-specified by every WCONHIST,
192+
// whether or not any value changed.
193+
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
194+
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::WELL_THP_UPDATE);
195+
191196
if (update_well) {
192197
handlerContext.state().events().addEvent( ScheduleEvents::PRODUCTION_UPDATE );
193198
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::PRODUCTION_UPDATE);
@@ -437,6 +442,11 @@ void handleWCONPROD(HandlerContext& handlerContext)
437442
update_well = true;
438443
}
439444

445+
// The THP limit and VFP table (items 10 and 11) are re-specified
446+
// by every WCONPROD, whether or not any value changed.
447+
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
448+
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::WELL_THP_UPDATE);
449+
440450
if (update_well) {
441451
handlerContext.state().events().addEvent( ScheduleEvents::PRODUCTION_UPDATE );
442452
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::PRODUCTION_UPDATE);
@@ -834,6 +844,15 @@ void handleWELTARG(HandlerContext& handlerContext)
834844
}
835845
}
836846

847+
// The THP limit or VFP table is re-specified, whether or not
848+
// the value changed.
849+
if (well2.isProducer() &&
850+
(cmode == Well::WELTARGCMode::THP || cmode == Well::WELTARGCMode::VFP))
851+
{
852+
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
853+
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::WELL_THP_UPDATE);
854+
}
855+
837856
if (update) {
838857
if (well2.isProducer()) {
839858
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::PRODUCTION_UPDATE);

opm/input/eclipse/Schedule/Well/WellPropertiesKeywordHandlers.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,17 @@ void handleWTMULT(HandlerContext& handlerContext)
633633
properties->handleWTMULT(cmode, factor.get<double>());
634634

635635
well.updateProduction(properties);
636+
637+
// The THP limit is re-specified (multiplied).
638+
if (cmode == Well::WELTARGCMode::THP) {
639+
handlerContext.state().events()
640+
.addEvent(ScheduleEvents::WELL_THP_UPDATE);
641+
642+
handlerContext.state().wellgroup_events()
643+
.addEvent(well_name, ScheduleEvents::WELL_THP_UPDATE);
644+
645+
}
646+
636647
if (update_well) {
637648
handlerContext.state().events()
638649
.addEvent(ScheduleEvents::PRODUCTION_UPDATE);

tests/parser/ScheduleTests.cpp

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7232,3 +7232,91 @@ END
72327232
BOOST_CHECK_CLOSE(s->width(), 1819.202122, 1.0e-8);
72337233
}
72347234
}
7235+
7236+
BOOST_AUTO_TEST_CASE(WellTHPUpdateEvent) {
7237+
const auto schedule = make_schedule(R"(
7238+
RUNSPEC
7239+
OIL
7240+
WATER
7241+
GAS
7242+
7243+
START
7244+
8 MAR 1998 /
7245+
7246+
SCHEDULE
7247+
7248+
WELSPECS
7249+
'P1' 'G1' 1 1 2500 'OIL' /
7250+
/
7251+
WCONPROD
7252+
'P1' 'OPEN' 'ORAT' 1000 4* 50.0 /
7253+
/
7254+
7255+
DATES -- 1
7256+
10 JUN 1998 /
7257+
/
7258+
7259+
WCONPROD -- identical to the current well controls
7260+
'P1' 'OPEN' 'ORAT' 1000 4* 50.0 /
7261+
/
7262+
7263+
DATES -- 2
7264+
10 JUL 1998 /
7265+
/
7266+
7267+
WELTARG
7268+
'P1' 'ORAT' 500 /
7269+
/
7270+
7271+
DATES -- 3
7272+
10 AUG 1998 /
7273+
/
7274+
7275+
WELTARG
7276+
'P1' 'THP' 60 /
7277+
/
7278+
7279+
DATES -- 4
7280+
10 SEP 1998 /
7281+
/
7282+
7283+
WELTARG -- unchanged VFP table number
7284+
'P1' 'VFP' 0 /
7285+
/
7286+
7287+
DATES -- 5
7288+
10 OKT 1998 /
7289+
/
7290+
7291+
WTMULT
7292+
'P1' 'THP' 2.0 /
7293+
/
7294+
7295+
DATES -- 6
7296+
10 NOV 1998 /
7297+
/
7298+
7299+
WCONHIST
7300+
'P1' 'OPEN' 'ORAT' 100 0 0 /
7301+
/
7302+
)");
7303+
7304+
// Initial WCONPROD specifies the THP limit and VFP table
7305+
BOOST_CHECK( schedule[0].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7306+
// A WCONPROD with unchanged values re-specifies the THP limit and VFP
7307+
// table without triggering PRODUCTION_UPDATE
7308+
BOOST_CHECK( schedule[1].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7309+
BOOST_CHECK(!schedule[1].wellgroup_events().hasEvent("P1", ScheduleEvents::PRODUCTION_UPDATE));
7310+
// WELTARG ORAT does not touch the THP limit or VFP table
7311+
BOOST_CHECK(!schedule[2].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7312+
BOOST_CHECK( schedule[2].wellgroup_events().hasEvent("P1", ScheduleEvents::PRODUCTION_UPDATE));
7313+
// WELTARG THP re-specifies the THP limit
7314+
BOOST_CHECK( schedule[3].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7315+
// WELTARG VFP re-specifies the VFP table, also for an unchanged value
7316+
BOOST_CHECK( schedule[4].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7317+
BOOST_CHECK(!schedule[4].wellgroup_events().hasEvent("P1", ScheduleEvents::PRODUCTION_UPDATE));
7318+
// WTMULT with THP control re-specifies (multiplies) the THP limit
7319+
BOOST_CHECK( schedule[5].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7320+
// WCONHIST re-specifies the VFP table
7321+
BOOST_CHECK( schedule[6].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7322+
}

0 commit comments

Comments
 (0)