Handle WELLPI keyword in ACTIONX

When an ACTIONX has evaluated to True we inspect the keyword payload and if it
contains WELPI we query the well model for current wellpi values and pass that
along as context to the Schedule::applyAction()
This commit is contained in:
Joakim Hove
2021-02-12 12:35:53 +01:00
parent fc398c8555
commit ff51c2d7ee
3 changed files with 86 additions and 3 deletions

View File

@@ -2583,6 +2583,17 @@ namespace Opm {
this->prod_index_calc_[well_index].reInit(well);
}
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
updateEclWell(int timeStepIdx, const std::string& wname) {
auto well_iter = std::find_if( this->wells_ecl_.begin(), this->wells_ecl_.end(), [wname] (const auto& well) -> bool { return well.name() == wname;});
if (well_iter == this->wells_ecl_.end())
throw std::logic_error("Could not find well: " + wname);
auto well_index = std::distance( this->wells_ecl_.begin(), well_iter );
this->updateEclWell(timeStepIdx, well_index);
}
template<typename TypeTag>
@@ -2619,6 +2630,19 @@ namespace Opm {
}
}
template<typename TypeTag>
double
BlackoilWellModel<TypeTag>::
wellPI(const std::string& well_name) const
{
auto well_iter = std::find_if(this->wells_ecl_.begin(), this->wells_ecl_.end(), [&well_name](const Well& well) { return well.name() == well_name; });
if (well_iter == this->wells_ecl_.end())
throw std::logic_error("Could not find well: " + well_name);
auto well_index = std::distance( this->wells_ecl_.begin(), well_iter );
return this->wellPI(well_index);
}
template<typename TypeTag>
void