Skip to content

Commit be2e18a

Browse files
committed
Add WELL_THP_UPDATE schedule event
Raised when the well THP limit and/or VFP table is (re)specified: by WCONPROD, WCONHIST, WCONINJE or WCONINJH, by WELTARG with THP or VFP control, or by WTMULT with THP control. Unlike PRODUCTION_UPDATE and INJECTION_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 be2e18a

4 files changed

Lines changed: 187 additions & 1 deletion

File tree

opm/input/eclipse/Schedule/Events.hpp

Lines changed: 12 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,17 @@ 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, WCONHIST, WCONINJE or WCONINJH for the named
119+
/// wells, by WELTARG with THP or VFP control, or by WTMULT with
120+
/// THP control. The event applies to producers and injectors
121+
/// alike; consumers must check the well type where it matters.
122+
/// Unlike PRODUCTION_UPDATE and INJECTION_UPDATE, the event is
123+
/// also triggered when the entered values are unchanged, since
124+
/// re-specifying either input cancels a THP limit imposed
125+
/// dynamically by the simulator (e.g. by network balancing).
126+
WELL_THP_UPDATE = (UINT64_C(1) << 25),
116127
};
117128
} // namespace ScheduleEvents
118129

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

Lines changed: 27 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);
@@ -261,6 +266,11 @@ void handleWCONINJE(HandlerContext& handlerContext)
261266
update_well = true;
262267
}
263268

269+
// The THP limit and VFP table (items 8 and 9) are re-specified
270+
// by every WCONINJE, whether or not any value changed.
271+
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
272+
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::WELL_THP_UPDATE);
273+
264274
if (update_well) {
265275
handlerContext.state().events().addEvent(ScheduleEvents::INJECTION_UPDATE);
266276
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::INJECTION_UPDATE);
@@ -336,6 +346,11 @@ void handleWCONINJH(HandlerContext& handlerContext)
336346
update_well = true;
337347
}
338348

349+
// The VFP table (item 7) is re-specified by every WCONINJH,
350+
// whether or not any value changed.
351+
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
352+
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::WELL_THP_UPDATE);
353+
339354
if (update_well) {
340355
handlerContext.state().events().addEvent( ScheduleEvents::INJECTION_UPDATE );
341356
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::INJECTION_UPDATE);
@@ -437,6 +452,11 @@ void handleWCONPROD(HandlerContext& handlerContext)
437452
update_well = true;
438453
}
439454

455+
// The THP limit and VFP table (items 10 and 11) are re-specified
456+
// by every WCONPROD, whether or not any value changed.
457+
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
458+
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::WELL_THP_UPDATE);
459+
440460
if (update_well) {
441461
handlerContext.state().events().addEvent( ScheduleEvents::PRODUCTION_UPDATE );
442462
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::PRODUCTION_UPDATE);
@@ -834,6 +854,13 @@ void handleWELTARG(HandlerContext& handlerContext)
834854
}
835855
}
836856

857+
// The THP limit or VFP table is re-specified, whether or not
858+
// the value changed.
859+
if (cmode == Well::WELTARGCMode::THP || cmode == Well::WELTARGCMode::VFP) {
860+
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
861+
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::WELL_THP_UPDATE);
862+
}
863+
837864
if (update) {
838865
if (well2.isProducer()) {
839866
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
@@ -609,6 +609,16 @@ void handleWTMULT(HandlerContext& handlerContext)
609609
for (const auto& well_name : well_names) {
610610
auto well = handlerContext.state().wells.get(well_name);
611611

612+
// The THP limit is re-specified (multiplied).
613+
if (cmode == Well::WELTARGCMode::THP) {
614+
handlerContext.state().events()
615+
.addEvent(ScheduleEvents::WELL_THP_UPDATE);
616+
617+
handlerContext.state().wellgroup_events()
618+
.addEvent(well_name, ScheduleEvents::WELL_THP_UPDATE);
619+
620+
}
621+
612622
if (well.isInjector()) {
613623
const bool update_well = true;
614624

@@ -633,6 +643,7 @@ void handleWTMULT(HandlerContext& handlerContext)
633643
properties->handleWTMULT(cmode, factor.get<double>());
634644

635645
well.updateProduction(properties);
646+
636647
if (update_well) {
637648
handlerContext.state().events()
638649
.addEvent(ScheduleEvents::PRODUCTION_UPDATE);

tests/parser/ScheduleTests.cpp

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7232,3 +7232,140 @@ 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+
'I1' 'G1' 2 2 2500 'WAT' /
7251+
/
7252+
WCONPROD
7253+
'P1' 'OPEN' 'ORAT' 1000 4* 50.0 /
7254+
/
7255+
WCONINJE
7256+
'I1' 'WATER' 'OPEN' 'RATE' 1000 /
7257+
/
7258+
7259+
DATES -- 1
7260+
10 JUN 1998 /
7261+
/
7262+
7263+
WCONPROD -- identical to the current well controls
7264+
'P1' 'OPEN' 'ORAT' 1000 4* 50.0 /
7265+
/
7266+
7267+
DATES -- 2
7268+
10 JUL 1998 /
7269+
/
7270+
7271+
WELTARG
7272+
'P1' 'ORAT' 500 /
7273+
/
7274+
7275+
DATES -- 3
7276+
10 AUG 1998 /
7277+
/
7278+
7279+
WELTARG
7280+
'P1' 'THP' 60 /
7281+
/
7282+
7283+
DATES -- 4
7284+
10 SEP 1998 /
7285+
/
7286+
7287+
WELTARG -- unchanged VFP table number
7288+
'P1' 'VFP' 0 /
7289+
/
7290+
7291+
DATES -- 5
7292+
10 OKT 1998 /
7293+
/
7294+
7295+
WTMULT
7296+
'P1' 'THP' 2.0 /
7297+
/
7298+
7299+
DATES -- 6
7300+
10 NOV 1998 /
7301+
/
7302+
7303+
WCONHIST
7304+
'P1' 'OPEN' 'ORAT' 100 0 0 /
7305+
/
7306+
7307+
DATES -- 7
7308+
10 DES 1998 /
7309+
/
7310+
7311+
WELTARG
7312+
'I1' 'THP' 30 /
7313+
/
7314+
7315+
DATES -- 8
7316+
10 JAN 1999 /
7317+
/
7318+
7319+
WELTARG
7320+
'I1' 'WRAT' 800 /
7321+
/
7322+
7323+
DATES -- 9
7324+
10 FEB 1999 /
7325+
/
7326+
7327+
WTMULT
7328+
'I1' 'THP' 2.0 /
7329+
/
7330+
7331+
DATES -- 10
7332+
10 MAR 1999 /
7333+
/
7334+
7335+
WCONINJH
7336+
'I1' 'WATER' 'OPEN' 100 /
7337+
/
7338+
)");
7339+
7340+
// Initial WCONPROD specifies the THP limit and VFP table
7341+
BOOST_CHECK( schedule[0].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7342+
// A WCONPROD with unchanged values re-specifies the THP limit and VFP
7343+
// table without triggering PRODUCTION_UPDATE
7344+
BOOST_CHECK( schedule[1].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7345+
BOOST_CHECK(!schedule[1].wellgroup_events().hasEvent("P1", ScheduleEvents::PRODUCTION_UPDATE));
7346+
// WELTARG ORAT does not touch the THP limit or VFP table
7347+
BOOST_CHECK(!schedule[2].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7348+
BOOST_CHECK( schedule[2].wellgroup_events().hasEvent("P1", ScheduleEvents::PRODUCTION_UPDATE));
7349+
// WELTARG THP re-specifies the THP limit
7350+
BOOST_CHECK( schedule[3].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7351+
// WELTARG VFP re-specifies the VFP table, also for an unchanged value
7352+
BOOST_CHECK( schedule[4].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7353+
BOOST_CHECK(!schedule[4].wellgroup_events().hasEvent("P1", ScheduleEvents::PRODUCTION_UPDATE));
7354+
// WTMULT with THP control re-specifies (multiplies) the THP limit
7355+
BOOST_CHECK( schedule[5].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7356+
// WCONHIST re-specifies the VFP table
7357+
BOOST_CHECK( schedule[6].wellgroup_events().hasEvent("P1", ScheduleEvents::WELL_THP_UPDATE));
7358+
7359+
// The event also applies to injectors:
7360+
// WCONINJE re-specifies the THP limit and VFP table
7361+
BOOST_CHECK( schedule[0].wellgroup_events().hasEvent("I1", ScheduleEvents::WELL_THP_UPDATE));
7362+
// WELTARG THP re-specifies the THP limit
7363+
BOOST_CHECK( schedule[7].wellgroup_events().hasEvent("I1", ScheduleEvents::WELL_THP_UPDATE));
7364+
// WELTARG WRAT does not touch the THP limit or VFP table
7365+
BOOST_CHECK(!schedule[8].wellgroup_events().hasEvent("I1", ScheduleEvents::WELL_THP_UPDATE));
7366+
BOOST_CHECK( schedule[8].wellgroup_events().hasEvent("I1", ScheduleEvents::INJECTION_UPDATE));
7367+
// WTMULT with THP control re-specifies (multiplies) the THP limit
7368+
BOOST_CHECK( schedule[9].wellgroup_events().hasEvent("I1", ScheduleEvents::WELL_THP_UPDATE));
7369+
// WCONINJH re-specifies the VFP table
7370+
BOOST_CHECK( schedule[10].wellgroup_events().hasEvent("I1", ScheduleEvents::WELL_THP_UPDATE));
7371+
}

0 commit comments

Comments
 (0)