mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
trying to fix a problematic situation when updateWellState
for example, distr = 0 1 0, for rate control, F = 1 0 0, we will get a zero F_target, then it is wrong to do the division with F_target. It is okay when target = 0. When target != 0, the result is already very wrong. Non-linear iteration can send us anywhere, not sure the best solution for this kind of strange situation.
This commit is contained in:
parent
10887ddaca
commit
ec8dc4f534
@ -965,15 +965,40 @@ namespace Opm
|
||||
if (well_controls_iget_type(wc, current) == SURFACE_RATE) {
|
||||
if (well_type_ == PRODUCER) {
|
||||
|
||||
const double* distr = well_controls_iget_distr(wc, current);
|
||||
|
||||
double F_target = 0.0;
|
||||
const double* distr = well_controls_iget_distr(wc, current);
|
||||
for (int p = 0; p < np; ++p) {
|
||||
F_target += distr[p] * F[p];
|
||||
}
|
||||
|
||||
if (F_target > 0.) {
|
||||
for (int p = 0; p < np; ++p) {
|
||||
well_state.wellRates()[np * index_of_well_ + p] = F[p] * target_rate / F_target;
|
||||
}
|
||||
} else {
|
||||
// F_target == 0., which creates some difficulties in term of handling things perfectly.
|
||||
// The following are some temporary solution by putting all rates to be zero, while some better
|
||||
// solution is required to analyze all the rate/bhp limits situation and give a more reasonable
|
||||
// solution. However, it is still possible the situation is not solvable, which requires some
|
||||
// test cases to find out good solution for these situation.
|
||||
|
||||
if (target_rate == 0.) { // zero target rate for producer
|
||||
const std::string msg = " Setting all rates to be zero for well " + name()
|
||||
+ " due to zero target rate for the phase that does not exist in the wellbore."
|
||||
+ " however, there is no unique solution for the situation";
|
||||
OpmLog::warning("NOT_UNIQUE_WELL_SOLUTION", msg);
|
||||
} else {
|
||||
const std::string msg = " Setting all rates to be zero for well " + name()
|
||||
+ " due to un-solvable situation. There is non-zero target for the phase "
|
||||
+ " that does not exist in the wellbore for the situation";
|
||||
OpmLog::warning("NON_SOLVABLE_WELL_SOLUTION", msg);
|
||||
}
|
||||
|
||||
for (int p = 0; p < np; ++p) {
|
||||
well_state.wellRates()[np * index_of_well_ + p] = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for (int p = 0; p < np; ++p) {
|
||||
|
Loading…
Reference in New Issue
Block a user