-
Notifications
You must be signed in to change notification settings - Fork 130
m_efficiency_scaling_factors default to be 1. instead of 0. #6608
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 failure_report please |
2b5988f to
ff16298
Compare
|
jenkins build this failure_report please |
|
As far I can say, the only place that can modify this value is related to the WCYCLE. 964 if (!wcycle.empty()) {
965 const auto schedule_open =
966 [&wg_events = this->report_step_start_events_](const std::string& name)
967 {
968 return wg_events.hasEvent(name, ScheduleEvents::REQUEST_OPEN_WELL);
969 };
970 for (const auto& [wname, wscale] : wcycle.efficiencyScale(this->simulator_.time(),
971 this->simulator_.timeStepSize(),
972 wmatcher,
973 this->well_open_times_,
974 schedule_open))
975 {
976 this->wellState().updateEfficiencyScalingFactor(wname, wscale);
977 this->schedule_.add_event(ScheduleEvents::WELLGROUP_EFFICIENCY_UPDATE, report_step);
978 }I think it is okay to let it stay 1.0 when WCYCLE is not there. while I might miss something. |
I think also here: opm-simulators/opm/simulators/wells/WellState.cpp Lines 1027 to 1043 in 0a7715a
In any case, the well testing appears before these functions are called, so I think the total efficiency factor always ends up to be zero when wells are tested at the beginning of a report step. Seems that this situation appear twice in the failed test, allthough not sure why it would trigger failure since it's standard wells (for MS wells zero efficiency factor results in singular matrix) |
vkip
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.
Looks very reasonable to me.
Possibly we should call this function or
Maybe it also effects other places not only well testing. while it needs some investigation to figure out. As said above. we might need to do more to have a more complete setup. For example, WCYCLE + WTEST scenario, while initializing the |
| std::vector<int> m_in_producing_group; // global_index -> int/bool | ||
| std::vector<int> m_is_open; // global_index -> int/bool | ||
| std::vector<Scalar> m_efficiency_scaling_factors; // global_index --> double | ||
| std::vector<Scalar> m_efficiency_scaling_factors {1.}; // global_index --> double |
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 initialises m_efficiency_scaling_factors to a single-element vector<> holding the value 1. Are we sure that that's appropriate in all cases?
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 can't possibly be the correct fix. We are supposed to hold one entry per well. If anything derefs this vector out-of-bounds there is a logic error elsewhere, since this is resized in the ctor. Maybe you meant
this->m_efficiency_scaling_factors.resize(num_wells, 1.0);in the ctor? That is more in line with what you say you want to achieve in the pr description.
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.
yeah, you guys are totally right. Not working today and will also check a few things around this. Will update.
vkip
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.
Having a default of 1 seemed reasonable, but obviously I did not think this through. I'll stay out of this...
Sorry for proposing the PR this way. I did not think it clearly at the end of the day. |
It looks like for this specific case, with 0 efficiency scaling factor, the well get OP_1 get singular matrix. Did not dig through the exact cause yet. |
Don't worry about it. This is why we have PR reviews (and unit tests). |
For standard well, well efficiency factor is used in the following two places (third one in energy connection rate) const EvalWell cq_s_effective = cq_s[componentIdx] * this->well_efficiency_factor_; resWell_loc -= this->primary_variables_.getQs(componentIdx) * this->well_efficiency_factor_;If resWell_loc += (this->primary_variables_.surfaceVolumeFraction(componentIdx) -
this->F0_[componentIdx]) * volume / dtIf it is rate controlled, it might be singular since there is no derivative against BHP at all. |
ff16298 to
636fc30
Compare
|
jenkins build this failure_report please |
|
Keeping a record for previous testing results. https://ci.opm-project.org/job/opm-simulators-PR-builder/9030/#showFailuresLink |
|
jenkins build this failure_report please |
|
We can also get the efficiency factor from the SingleWellState directly.
|
|
jenkins build this failure_report please |
With more digging in, template<typename Scalar, typename IndexTraits, int numEq>
void StandardWellEquations<Scalar, IndexTraits, numEq>::invert()
{
try {
invDuneD_ = duneD_; // Not strictly need if not cpr with well contributions is used
detail::invertMatrix(invDuneD_[0][0]);
} catch (NumericalProblem&) {
// for singular matrices, use identity as the inverse
invDuneD_[0][0] = 0.0;
for (std::size_t i = 0; i < invDuneD_[0][0].rows(); ++i) {
invDuneD_[0][0][i][i] = 1.0;
}
}
} |
For the case during the well testing, it is under BHP control, singluar matrix is assembled, while the function with the above identity inverse matrix, the function managed to get converged after some iterations. I think this is simply wrong. |
|
With #6614 , we can see in several scenarios, well testing will not be able to succeed if we do not use the identity matrix. https://ci.opm-project.org/job/opm-simulators-PR-builder/9035/ |
|
the It is not totally clear how we copy/convey The main purpose of the PR is to avoid zero As said above, there might be more following up developments in both how we convey I will mark the PR as ready for review again for review and discussion. |
|
jenkins build this failure_report please |
bska
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'll let others comment on the relationship between WellState::getGlobalEfficiencyScalingFactor(name) and SingleWellState::efficiency_scaling_factor. From my point of view, I only have one tiny remark concerning the details of the floating point types involved here.
e8b6eac to
adf7a87
Compare
|
jenkins build this failure_report please |
adf7a87 to
1a2c337
Compare
as a efficiency factor, it is more reasonable to default it be 1. otherwise, it can be 0 when WCYCLE is not around.
|
jenkins build this failure_report please |
|
The regression failure looks fine. 01_max_watercut_4.pdf is better with this PR. 02_actionx_udq.pdf shows no visual difference. |
|
This PR looks like can remove a lot of UMFPack failures (not all) in one of the field cases being tested. |
bska
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.
Thanks a lot for the updates. This will improve the overall situation and we can come back to it if there are additional failures.
For now I'll merge this into the master branch.
|
jenkins build this update_data please |
Reason: PR OPM/opm-simulators#6608 opm-common = 07b07df558dd2f6db4c68c36d7880c0223fe9d34 opm-grid = 0ce0e8d833ece748a914bb0ae0191125bb8d4941 opm-simulators = 2164e3c30eb786e74644b19bedf529b399eb3994 ### Changed Tests ### * actionx_udq * max_watercut_4
|
jenkins build this opm-tests=1434 please |
Automatic Reference Data Update for PR OPM/opm-simulators#6608
The new reference solutions have been installed on the CI system. Merging this now to activate the fix. Thanks a lot, again, for tracking down this problem. |

as an efficiency factor, it is more reasonable to default it be 1. otherwise, it can be 0 when WCYCLE is not around.