-
Notifications
You must be signed in to change notification settings - Fork 130
Using IPR in gaslift optimization #6653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
jenkins build this please |
|
jenkins build this failure_report please |
|
jenkins build this failure_report please |
|
Do we have any profiling results demonstrating the speedup? |
|
jenkins build this failure_report please |
1 similar comment
|
jenkins build this failure_report please |
|
jenkins build this failure_report please |
hakonhagland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I profiled this PR with tracy and compared with master for test case 4_GLIFT_MODEL5.DATA and 4 MPI ranks.
The results indicate a 15% overall speedup by using Inflow Performance Relationship (IPR) for gas lift optimization BHP calculations:
| Metric | Master | PR #6653 | Improvement |
|---|---|---|---|
| Total runtime | 5.81 s | 4.93 s | -15.1% |
| Gas lift BHP solve | 562 ms | 33 ms | -94% |
| MPI synchronization | 725 ms | 394 ms | -46% |
It looks very good to me. I will approve this once the comments have been addressed.
| return {-potentials[this->oil_pos_], | ||
| -potentials[this->gas_pos_], | ||
| -potentials[this->water_pos_], | ||
| bhp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now returns BasicRates which seems to indicate to the reader that well rates are returned, but BasicRates now includes bhp which is a pressure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename to something like BasicWellState or LimitedWellState? However, that may be confused with the well state? Any other suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about RatesAndBhp and LimitedRatesAndBhp ?
| std::optional<typename GasLiftSingleWell<TypeTag>::Scalar> | ||
| GasLiftSingleWell<TypeTag>:: | ||
| computeBhpAtThpLimit_(Scalar alq, bool debug_output) const | ||
| computeBhpAtThpLimit_(Scalar alq, Scalar bhp, bool debug_output) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be more readable if bhp is renamed current_bhp or similar? And add a comment above the method describing input parameters and purpose of method.
| OPM_TIMEFUNCTION(); | ||
| const auto& groupStateHelper = this->simulator_.problem().wellModel().groupStateHelper(); | ||
| auto bhp_at_thp_limit = this->well_.computeBhpAtThpLimitProdWithAlq( | ||
| auto bhp_at_thp_limit = this->well_.computeBhpAtThpLimitProdWithAlqUsingIPR( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment why we now are using computeBhpAtThpLimitProdWithAlqUsingIPR() instead of computeBhpAtThpLimitProdWithAlq() ?
| std::optional<typename GasLiftSingleWellGeneric<Scalar, IndexTraits>::LimitedRates> | ||
| GasLiftSingleWellGeneric<Scalar, IndexTraits>:: | ||
| computeLimitedWellRatesWithALQ_(Scalar alq) const | ||
| computeLimitedWellRatesWithALQ_(Scalar alq, Scalar bhp) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change bhp to current_bhp? And add a comment above the method explaining input parameters and purpose of method.
| rates.gas, | ||
| water_rate, | ||
| rates.water, | ||
| rates.bhp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name LimitedRates seems to indicate to the reader that it contains limited rates. But now it also contains bhp which is a pressure.
| , water_is_limited{water_is_limited_} | ||
| , alq{alq_} | ||
| , alq_is_limited{alq_is_limited_} | ||
| , bhp(bhp_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use curly braces to be consistent with the above initializations
| } | ||
|
|
||
| Scalar oil, gas, water; | ||
| Scalar oil, gas, water, bhp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer to earlier comment about the name BasicRates and including bhp as a member.
| template<typename TypeTag> | ||
| std::optional<typename WellInterface<TypeTag>::Scalar> | ||
| WellInterface<TypeTag>:: | ||
| computeBhpAtThpLimitProdWithAlqUsingIPR(const Simulator& simulator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment above this method about its purpose
| { | ||
| OPM_TIMEFUNCTION(); | ||
| WellStateType well_state_copy = well_state; | ||
| const auto& groupStateHelper = simulator.problem().wellModel().groupStateHelper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, we should avoid passing around simulator and instead pass groupStateHelper if possible to avoid this kind of hidden dual state pattern where the groupStateHelper is not the same as simulator.problem().wellModel().groupStateHelper(), see: #6631. But I think this requires a larger refactorization, and is better done in a follow-up PR.
|
jenkins build this failure_report please |
|
This was merged with warnings, https://ci.opm-project.org/job/opm-simulators/3044/gcc/folder.1225362760/ |
Sorry. I will fix asap. |
Start using IPR in gaslift optimization.
Gives a significant speed-up compared to the old code