Store instantaneous instead of effective tracer rates#7187
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a reporting bug where well efficiency factors (WEFAC and global efficiency scaling) end up being applied twice to tracer rates in summary output, by storing tracer rates in a way that avoids double-application downstream.
Changes:
- Added a
constoverload ofgetGenWell()to allow querying well data fromconstcontexts. - Adjusted well and MSW tracer summary rate assignment to undo the applied well efficiency factor before storing into
data::Wells.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| opm/simulators/wells/BlackoilWellModelGeneric.hpp | Adds const overload for getGenWell() to support const reporting paths. |
| opm/simulators/wells/BlackoilWellModelGeneric.cpp | Implements const/non-const getGenWell() overloads and scales tracer rates by inverse well efficiency factor during reporting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const Scalar invEffFactor = 1.0 / std::max(1.0e-10, well->wellEfficiencyFactor()); | ||
| for (const auto& tr : wTR.second) { | ||
| xwPos->second.rates.set(data::Rates::opt::tracer, tr.rate, tr.name); | ||
| xwPos->second.rates.set(data::Rates::opt::tracer, tr.rate * invEffFactor, tr.name); |
|
jenkins build this please |
9bd9e33 to
450000a
Compare
|
jenkins build this please |
|
jenkins build this please |
450000a to
60be59f
Compare
|
jenkins build this please |
bska
left a comment
There was a problem hiding this comment.
What about group-level efficiency factors, do we need to account for those?
To be honest, this looks a bit like a workaround and I'd prefer if there were a way for the TracerModel to report instantaneous rates directly in BlackoilWellModel<>::assignWellTracerRates() instead of trying to undo parts of its internal implementation here.
These will be correctly accounted for by the mechanicsms in Summary.cpp as long as the raw well rates are reported.
I see you your point, this just seemed to be the least intrusive approach. I'll have a second look. |
60be59f to
7381806
Compare
…e application of efficiency factors in summary output
7381806 to
6ab647a
Compare
|
Second attempt, similar hack (and same results), but hopefully makes more sense to do it in TracerModel (?) |
|
jenkins build this please |
I agree that it makes sense to do this work closer to the source. In an ideal world the TracerModel would just use raw flow rates, unencumbered by well level efficiency factors, internally and we wouldn't need this at all, so maybe that suggests that there's a deeper problem elsewhere. I'll ask @totto82 to have a look at this from that point of view. If no other fix will be forthcoming on a short-term basis then I'll nevertheless get this into the master branch. |
Thanks. One way or another the efficiencies need to be used in TracerModel since they ultimately impact how much tracer mass enters or leaves the reservoir, so for me it is not obvious that one approach is better than the other, but I'll leave further discussion to you guys. I'll be happy to close this PR if an alternative solution is provided. |
We'll figure it out. That said, if the TracerModel needs to include efficiency factors to compute cumulatives like volumes or masses, then it should probably also care about group level efficiency factors ( |
Maybe I'm mistaken, but I believe this is properly taken care of (though naming could be discussed): opm-simulators/opm/simulators/wells/BlackoilWellModelGeneric.cpp Lines 1508 to 1522 in 13ed7bd |
This fixes a bug where well efficiency factors are applied twice in summary output.