WIP in testing new group update strtegy.

results with min_iter=2 works okay, while not min_iter=1.

It means the iteration stop at the wrong situation.
This commit is contained in:
Kai Bao 2016-11-04 15:39:43 +01:00
parent 753da2dd36
commit 002439c5b1
3 changed files with 17 additions and 17 deletions

View File

@ -321,7 +321,7 @@ namespace Opm {
void applyVREPGroupControl(const ReservoirState& reservoir_state,
const WellState& well_state);
WellState& well_state);
protected:

View File

@ -793,6 +793,8 @@ namespace detail {
// enforce VREP control when necessary.
applyVREPGroupControl(reservoir_state, well_state);
asImpl().wellModel().wellCollection()->updateWellTargets(well_state.wellRates());
// Create the primary variables.
SolutionState state = asImpl().variableState(reservoir_state, well_state);
@ -1069,20 +1071,7 @@ namespace detail {
asImpl().wellModel().addWellControlEq(wellSolutionState, well_state, aliveWells, residual_);
converged = getWellConvergence(it);
// Enforce the VREP control
if (it == 0) {
applyVREPGroupControl(reservoir_state, well_state);
}
// When the well targets are just updated or need to be updated, we need at least one more iteration.
if (asImpl().wellModel().wellCollection()->justUpdateWellTargets()) {
converged = false;
asImpl().wellModel().wellCollection()->setJustUpdateWellTargets(false);
}
if (converged && asImpl().wellModel().wellCollection()->needUpdateWellTargets()) {
converged = false;
}
if (converged) {
break;
@ -1112,6 +1101,7 @@ namespace detail {
asImpl().wellModel().updateWellControls(well_state);
// Enforce the VREP control
applyVREPGroupControl(reservoir_state, well_state);
asImpl().wellModel().wellCollection()->updateWellTargets(well_state.wellRates());
} while (it < 15);
if (converged) {
@ -2678,13 +2668,23 @@ namespace detail {
void
BlackoilModelBase<Grid, WellModel, Implementation>::
applyVREPGroupControl(const ReservoirState& reservoir_state,
const WellState& well_state)
WellState& well_state)
{
if (asImpl().wellModel().wellCollection()->havingVREPGroups()) {
std::vector<double> well_voidage_rates;
std::vector<double> voidage_conversion_coeffs;
computeWellVoidageRates(reservoir_state, well_state, well_voidage_rates, voidage_conversion_coeffs);
asImpl().wellModel().wellCollection()->applyVREPGroupControls(well_voidage_rates, voidage_conversion_coeffs);
// for the wells under group control, update the currentControls for the well_state
const size_t number_node = asImpl().wellModel().wellCollection()->numNode();
for (size_t w = 0; w < number_node; ++w) {
const WellNode* well_node = asImpl().wellModel().wellCollection()->getNode(w);
if (well_node->isInjector() && !well_node->individualControl()) {
const int well_index = well_node->selfIndex();
well_state.currentControls()[well_index] = well_node->groupControlIndex();
}
}
}
}

View File

@ -716,13 +716,13 @@ namespace Opm
// if we need to update the well targets related to group control,
// we update them then re-run the simulation before updating the well control
if (well_collection_->needUpdateWellTargets() ) {
/* if (well_collection_->needUpdateWellTargets() ) {
well_collection_->updateWellTargets(xw.wellRates());
for (size_t i = 0; i < well_collection_->numNode(); ++i) {
well_collection_->getNode(i)->setShouldUpdateWellTargets(false);
}
return;
}
} */
// Find, for each well, if any constraints are broken. If so,
// switch control to first broken constraint.