Skip to content

Commit 35ccb76

Browse files
committed
Record THP limit re-specification in SimulatorUpdate
The new thp_respec_wells set carries the WELL_THP_UPDATE information through ACTIONX processing, where report-step events do not reach the simulator.
1 parent be2e18a commit 35ccb76

5 files changed

Lines changed: 34 additions & 0 deletions

File tree

opm/input/eclipse/Schedule/Action/SimulatorUpdate.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct SimulatorUpdate
4444
simulatorUpdate.well_structure_changed = true;
4545
simulatorUpdate.affected_wells = {"test"};
4646
simulatorUpdate.welpi_wells.insert("I-45");
47+
simulatorUpdate.thp_respec_wells.insert("P-3");
4748
simulatorUpdate.new_frac_wconns.assign({
4849
std::pair { "I-45"s, std::vector { std::size_t{11}, std::size_t{22}, std::size_t{33} } },
4950
std::pair { "RA-MAN"s, std::vector { std::size_t{1}, std::size_t{7}, std::size_t{29} } },
@@ -57,6 +58,7 @@ struct SimulatorUpdate
5758
{
5859
serializer(affected_wells);
5960
serializer(welpi_wells);
61+
serializer(thp_respec_wells);
6062
serializer(new_frac_wconns);
6163
serializer(tran_update);
6264
serializer(well_structure_changed);
@@ -70,6 +72,16 @@ struct SimulatorUpdate
7072
/// its internal notion of the connection transmissibility factors.
7173
std::unordered_set<std::string> welpi_wells{};
7274

75+
/// Wells whose THP limit and/or VFP table has been (re)specified by
76+
/// WCONPROD, WCONHIST, WCONINJE or WCONINJH for the named wells, by
77+
/// WELTARG with THP or VFP control, or by WTMULT with THP control.
78+
/// Producers and injectors alike are included. Unlike affected_wells,
79+
/// this set also includes wells for which the entered values are
80+
/// unchanged, since re-specifying either input cancels a THP limit
81+
/// imposed dynamically by the simulator (e.g. by network balancing).
82+
/// See also the WELL_THP_UPDATE schedule event.
83+
std::unordered_set<std::string> thp_respec_wells{};
84+
7385
/// New well connections created as a result of a geomechanical
7486
/// fracturing process.
7587
///
@@ -116,6 +128,9 @@ struct SimulatorUpdate
116128
this->welpi_wells.insert(otherSimUpdate.welpi_wells.begin(),
117129
otherSimUpdate.welpi_wells.end());
118130

131+
this->thp_respec_wells.insert(otherSimUpdate.thp_respec_wells.begin(),
132+
otherSimUpdate.thp_respec_wells.end());
133+
119134
this->new_frac_wconns.insert(this->new_frac_wconns.end(),
120135
otherSimUpdate.new_frac_wconns.begin(),
121136
otherSimUpdate.new_frac_wconns.end());
@@ -128,6 +143,7 @@ struct SimulatorUpdate
128143
this->well_structure_changed = false;
129144
this->affected_wells.clear();
130145
this->welpi_wells.clear();
146+
this->thp_respec_wells.clear();
131147
this->new_frac_wconns.clear();
132148
}
133149

@@ -137,6 +153,7 @@ struct SimulatorUpdate
137153
&& (this->well_structure_changed == that.well_structure_changed)
138154
&& (this->affected_wells == that.affected_wells)
139155
&& (this->welpi_wells == that.welpi_wells)
156+
&& (this->thp_respec_wells == that.thp_respec_wells)
140157
&& (this->new_frac_wconns == that.new_frac_wconns)
141158
;
142159
}

opm/input/eclipse/Schedule/HandlerContext.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ void HandlerContext::affected_well(const std::string& well_name)
4848
}
4949
}
5050

51+
void HandlerContext::thp_respec_well(const std::string& well_name)
52+
{
53+
if (sim_update != nullptr) {
54+
sim_update->thp_respec_wells.insert(well_name);
55+
}
56+
}
57+
5158
void HandlerContext::welpi_well(const std::string& well_name)
5259
{
5360
if (sim_update != nullptr) {

opm/input/eclipse/Schedule/HandlerContext.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ class HandlerContext
107107
//! \brief Mark that a well is affected by WELPI.
108108
void welpi_well(const std::string& well_name);
109109

110+
//! \brief Mark that the THP limit and/or VFP table of a well has been
111+
//! (re)specified, also when the entered values are unchanged.
112+
void thp_respec_well(const std::string& well_name);
113+
110114
//! \brief Mark that transmissibilities must be recalculated.
111115
void record_tran_change();
112116

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ void handleWCONHIST(HandlerContext& handlerContext)
192192
// whether or not any value changed.
193193
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
194194
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::WELL_THP_UPDATE);
195+
handlerContext.thp_respec_well(well2.name());
195196

196197
if (update_well) {
197198
handlerContext.state().events().addEvent( ScheduleEvents::PRODUCTION_UPDATE );
@@ -270,6 +271,7 @@ void handleWCONINJE(HandlerContext& handlerContext)
270271
// by every WCONINJE, whether or not any value changed.
271272
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
272273
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::WELL_THP_UPDATE);
274+
handlerContext.thp_respec_well(well_name);
273275

274276
if (update_well) {
275277
handlerContext.state().events().addEvent(ScheduleEvents::INJECTION_UPDATE);
@@ -350,6 +352,7 @@ void handleWCONINJH(HandlerContext& handlerContext)
350352
// whether or not any value changed.
351353
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
352354
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::WELL_THP_UPDATE);
355+
handlerContext.thp_respec_well(well_name);
353356

354357
if (update_well) {
355358
handlerContext.state().events().addEvent( ScheduleEvents::INJECTION_UPDATE );
@@ -456,6 +459,7 @@ void handleWCONPROD(HandlerContext& handlerContext)
456459
// by every WCONPROD, whether or not any value changed.
457460
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
458461
handlerContext.state().wellgroup_events().addEvent( well2.name(), ScheduleEvents::WELL_THP_UPDATE);
462+
handlerContext.thp_respec_well(well2.name());
459463

460464
if (update_well) {
461465
handlerContext.state().events().addEvent( ScheduleEvents::PRODUCTION_UPDATE );
@@ -859,6 +863,7 @@ void handleWELTARG(HandlerContext& handlerContext)
859863
if (cmode == Well::WELTARGCMode::THP || cmode == Well::WELTARGCMode::VFP) {
860864
handlerContext.state().events().addEvent( ScheduleEvents::WELL_THP_UPDATE );
861865
handlerContext.state().wellgroup_events().addEvent( well_name, ScheduleEvents::WELL_THP_UPDATE);
866+
handlerContext.thp_respec_well(well_name);
862867
}
863868

864869
if (update) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ void handleWTMULT(HandlerContext& handlerContext)
617617
handlerContext.state().wellgroup_events()
618618
.addEvent(well_name, ScheduleEvents::WELL_THP_UPDATE);
619619

620+
handlerContext.thp_respec_well(well_name);
620621
}
621622

622623
if (well.isInjector()) {

0 commit comments

Comments
 (0)