addressing review comments

This commit is contained in:
Kai Bao 2019-04-04 15:36:35 +02:00 committed by Bård Skaflestad
parent ca69e2334a
commit b62dc0b5f2
2 changed files with 14 additions and 19 deletions

View File

@ -428,7 +428,8 @@ namespace Opm {
const int report_step,
WellStateFullyImplicitBlackoil& state ) const;
bool anyMSWellOpen(const Wells* wells, const int report_step) const;
// whether there exists any multisegment well open on this process
bool anyMSWellOpenLocal(const Wells* wells, const int report_step) const;
const Well* getWellEcl(const std::string& well_name) const;
};

View File

@ -259,7 +259,7 @@ namespace Opm {
well_state_.init(wells(), cellPressures, schedule(), wells_ecl_, timeStepIdx, &previous_well_state_, phase_usage_);
// handling MS well related
if (param_.use_multisegment_well_&& anyMSWellOpen(wells(), timeStepIdx)) { // if we use MultisegmentWell model
if (param_.use_multisegment_well_&& anyMSWellOpenLocal(wells(), timeStepIdx)) { // if we use MultisegmentWell model
well_state_.initWellStateMSWell(wells(), wells_ecl_, timeStepIdx, phase_usage_, &previous_well_state_);
}
@ -497,7 +497,7 @@ namespace Opm {
if (nw > 0) {
const auto phaseUsage = phaseUsageFromDeck(eclState());
const size_t numCells = Opm::UgGridHelpers::numCells(grid());
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpen(wells, report_step));
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal(wells, report_step));
well_state_.resize(wells, wells_ecl_, schedule(), handle_ms_well, report_step, numCells, phaseUsage); // Resize for restart step
wellsToState(restartValues.wells, phaseUsage, handle_ms_well, report_step, well_state_);
previous_well_state_ = well_state_;
@ -1760,7 +1760,7 @@ namespace Opm {
template<typename TypeTag>
bool
BlackoilWellModel<TypeTag>::
anyMSWellOpen(const Wells* wells, const int report_step) const
anyMSWellOpenLocal(const Wells* wells, const int report_step) const
{
bool any_ms_well_open = false;
@ -1770,8 +1770,6 @@ namespace Opm {
const Well* well_ecl = getWellEcl(well_name);
assert(well_ecl);
if (well_ecl->isMultiSegment(report_step) ) {
any_ms_well_open = true;
break;
@ -1789,20 +1787,16 @@ namespace Opm {
BlackoilWellModel<TypeTag>::
getWellEcl(const std::string& well_name) const
{
// finding the location of the well in wells_ecl
const int nw_wells_ecl = wells_ecl_.size();
int index_well = 0;
for (; index_well < nw_wells_ecl; ++index_well) {
if (well_name == wells_ecl_[index_well]->name()) {
break;
}
}
// finding the iterator of the well in wells_ecl
auto well_ecl = std::find_if(wells_ecl_.begin(),
wells_ecl_.end(),
[&well_name](const Well* elem)->bool {
return elem->name() == well_name;
});
if (index_well < nw_wells_ecl) {
return wells_ecl_[index_well];
} else {
return nullptr;
}
assert(well_ecl != wells_ecl_.end());
return *well_ecl;
}
} // namespace Opm