Commit Graph

42 Commits

Author SHA1 Message Date
Arne Morten Kvarving
aee8a764e2 GasLiftSingleWellGeneric.hpp: include WellProductionControls.hpp instead of Well.hpp 2023-01-18 11:56:21 +01:00
Arne Morten Kvarving
7b2b18045e adjust to upstream enum changes 2023-01-18 11:24:25 +01:00
Arne Morten Kvarving
e68d05a147 adapt to renamed GasLift(Group|Well) 2023-01-10 09:54:07 +01:00
Tor Harald Sandve
7d7b2803a5 renaming and adding more comments based on review 2022-11-21 08:58:49 +01:00
Tor Harald Sandve
9c8f778495 Compute the group rates that takes into account limitation on the sublevels 2022-11-21 08:58:49 +01:00
Tor Harald Sandve
1a09608263 Fix removeSurplus alq
Add water rate target limit
Add the gradient to the checkXXXTarget so that surplus alq is removed
until it would go below the target. I.e. the group still want to produce it  target
2022-11-21 08:58:49 +01:00
Tor Harald Sandve
cd09c130b3 pass group name to getRateWithGroupLimit to avoid checking for that 2022-11-21 08:58:49 +01:00
Håkon Hægland
43244c2132 Change condition under which stage 2 is done.
It only makes sense to try to optimize the distribution of lift gas if
the amount of lift gas is constrained either by the maximum allowed
gaslift or total gas or the group is under individual control.
2022-11-21 08:58:49 +01:00
Håkon Hægland
686a6a969d Calculate gradients with group limits.
Take into account group limits when calculating gradients for individual
wells in stage 2 of gas lift optimization.
2022-11-21 08:58:49 +01:00
Håkon Hægland
9c61262329 Changed formatting. 2022-11-21 08:58:49 +01:00
Håkon Hægland
61ed803740 Do stage2 even if GLIFTOPT is not defined 2022-11-21 08:58:49 +01:00
Tor Harald Sandve
b072cc1d5d Allow for gaslift for wells that violate thp limit but are not allowed to switch 2022-09-16 10:49:03 +02:00
Håkon Hægland
11907495c1 Well testing of gas lift wells
Assign a maximum ALQ value to each GLIFT producer when doing well testing
in beginTimeStep(). This allows the well to be considered open. Then,
later in the timestep, when assemble() is called, the full gas lift
optimization procedure can adjust the ALQ to its correct value.

It is also observed that in some cases when gas lift is switched off by
setting ALQ to zero, and later in the schedule is switched back on again,
it might not be possible to determine bhp from thp for low small ALQ values.
Instead of aborting the gas lift optimization, we should try increasing
ALQ until we get convergence or until the maximum ALQ for the well is
reached.
2022-04-20 10:51:34 +02:00
Håkon Hægland
fbd6c03dd6 Cleanup glift debugging output code 2022-03-24 12:42:46 +01:00
Håkon Hægland
438a712e54 Gas lift optimization for two-phase oil-water.
Add gas lift optimization support for two-phase oil-water flow.
2022-03-07 15:19:43 +01:00
Håkon Hægland
54160827de Add gaslift optimization support for MSW.
Implements gas lift optimization support for multisegmented wells (MSW).
2022-02-14 21:38:50 +01:00
Tor Harald Sandve
0c8d0764d6 update well potensials in well state along with alq and update guide rates accordingly 2022-02-08 15:46:08 +01:00
Tor Harald Sandve
bb99d1437b reduce alq when alq + gas production target is violated 2022-02-03 12:11:03 +01:00
Tor Harald Sandve
0b923e505a Add support for maximum total gas (alq + gas rate) in GLIFTOPT
Dont increase gaslift if the groups alq + gas production rate is above the given target
2022-02-02 10:54:32 +01:00
Tor Harald Sandve
009134d037 Limit well rates to honor group rates
If a well is under a group that is limited by a target, it should use as little gaslift as possible.
The reduction algorithm will reduce the gaslift of the well as long as the groups potential is above the groups target.
2022-02-02 10:30:48 +01:00
Håkon Hægland
65c323e1a4 Replace assert with warning.
Replace assert with warning when group rates exceeds target.
2022-01-31 01:52:36 +01:00
Håkon Hægland
8810fa65af Cleanup code in GasLiftSingleWellGeneric
Introduces two new data types BasicRates and LimitedRates to capture
oil, gas, and water rates, and whether they have been limited by well
or group targets. This reduces the number of variables that are passed
to and returned from various methods and thus makes the code easier to
read.
2022-01-31 01:39:20 +01:00
Håkon Hægland
4970b0641e Improve debugging tools in gaslift code.
Introduces a gaslift debugging variable in ALQState in WellState. This
variable will persist between timesteps in contrast to when debugging
variables are defined in GasLiftSingleWell, GasLiftGroupState, or GasLiftStage2.

Currently only an integer variable debug_counter is added to ALQState,
which can be used as follows: First debugging is switched on globally
for BlackOilWellModel, GasLiftSingleWell, GasLiftGroupState, and
GasLiftStage2 by setting glift_debug to a true value in BlackOilWellModelGeneric.
Then, the following debugging code can be added to e.g. one of
GasLiftSingleWell, GasLiftGroupState, or GasLiftStage2 :

    auto count = debugUpdateGlobalCounter_();
    if (count == some_integer) {
        displayDebugMessage_("stop here");
    }

Here, the integer "some_integer" is determined typically by looking at
the debugging output of a previous run. This can be done since the
call to debugUpdateGlobalCounter_() will print out the current value
of the counter and then increment the counter by one. And it will be
easy to recognize these values in the debug ouput. If you find a place
in the output that looks suspect, just take a note of the counter
value in the output around that point and insert the value for
"some_integer", then after recompiling the code with the desired value
for "some_integer", it is now easy to set a breakpoint in GDB at the
line

    displayDebugMessage_("stop here").

shown in the above snippet. This should improve the ability to quickly
to set a breakpoint in GDB around at a given time and point in the simulation.
2022-01-23 20:37:26 +01:00
Tor Harald Sandve
3e4e62bc4f
Merge pull request #3751 from hakonhagland/glift_swg_fx3
Refactor some methods in `GasLiftSingleWellGeneric.cpp` (part 2)
2022-01-03 14:14:15 +01:00
Joakim Hove
6b92443cb4 Downstream filesystem reorganisation in opm-common 2022-01-02 14:33:34 +01:00
Håkon Hægland
4bdf7c1b58 Refactor methods getXyzRateWithLimit_()
Refactors getOilRateWithLimit_(), getGasRateWithLimit_(), and
getWaterRateWithLimit_() in GasLiftSingleWellGeneric.cpp. The
common part of the methods is split out into a new method called
getRateWithLimit_(). The purpose of the refactorization is to reduce
reptetive code and make the code easier to maintain.
2021-12-22 10:45:31 +01:00
Håkon Hægland
11ad879472 Make parameters to getLiquidRateWithGroupLimit_() const
To improve readability, we make the parameters of
getLiquidRateWithGroupLimit_() const as discussed in
https://github.com/OPM/opm-simulators/pull/3748
2021-12-20 23:19:40 +01:00
Håkon Hægland
837f33e679 Refactor some methods in GasLiftSingleWellGeneric.
Refactor getOilRateWithGroupLimit_(), getGasRateWithGroupLimit_(),
getWaterRateWithGroupLimit_(), and getLiquidRateWithGroupLimit_() into
a single generic method called getRateWithGroupLimit_().
2021-12-20 23:08:31 +01:00
Håkon Hægland
e388827d81 Fixup in GasLiftSingleWellGeneric
Consider all groups when reducing oil rate to group limits.
The current code just checks the first group limit in the set.
But there might be groups later in the set with more restrictive
limits, causing the oil rate to be reduced more than the first
limit.
2021-12-15 19:15:35 +01:00
Håkon Hægland
738b5c5f18 Small clean up in GasLiftSingleWellGeneric.cpp
As discussed in PR #3728, it is better to move the two methods
reduceALQtoGroupTarget() and checkGroupTargetsViolated() from
OptimizeState to the parent class, then we do not have to abuse
OptimizeState in maybeAdjustALQbeforeOptimizeLoop_() just to call
reduceALQtoGroupTarget().

Also fixes a typo (as discussed in PR #3729) in reduceALQtoGrouptTarget()
where the water rate is updated with the gas flow rate instead of the
water flow rate. Should be like this:

 water_rate = -potentials[this->parent.water_pos_];

instead of

 water_rate = -potentials[this->parent.gas_pos_];
2021-12-09 11:58:43 +01:00
Tor Harald Sandve
66425eb7c2 WIP fix when both well and group control restrict gasslift 2021-12-08 09:36:26 +00:00
Tor Harald Sandve
a765ab213b fix WRAT GRAT reduction 2021-11-09 13:40:55 +01:00
Tor Harald Sandve
7728df33bb Fix LRAT reduction 2021-11-09 10:45:10 +01:00
Tor Harald Sandve
d2fd5505ca Check group production LRAT and WRAT targets 2021-11-09 08:24:57 +01:00
Tor Harald Sandve
23225d24e5 Fix bug in runOptimize1_ 2021-11-09 08:21:42 +01:00
Tor Harald Sandve
305de4016e oil target may be limited by LRAT as well 2021-09-10 13:19:07 +02:00
Joakim Hove
5a721b8cd2 Remove WellMap from WellState 2021-08-24 13:25:02 +02:00
Joakim Hove
581f571c9d Use SingleWellState for production and injection control 2021-08-15 09:07:39 +02:00
Tor Harald Sandve
60f59cd6e6 Potentially reduce gaslift when under well is under group control
Current implemention only support ORAT and GRAT controlled groups
2021-06-30 09:59:09 +02:00
Håkon Hægland
fbb24e2a5a Check group limits in gas lift stage 1.
Check group limits in gas lift stage 1 to avoid adding too much ALQ which must
anyway later be removed in stage 2. This should make the optimization
more efficient for small ALQ increment values. Also adds MPI support.
2021-06-16 12:00:54 +02:00
Joakim Hove
23180e06d2 Rename WellStateFullyImplicitBlackoil -> WellState 2021-05-21 15:07:21 +02:00
Arne Morten Kvarving
1614767362 GasLiftSingleWell: split typetag independent code to separate class 2021-05-21 09:09:10 +02:00