Merge pull request #2130 from totto82/reorderThp

Check THP in the end
This commit is contained in:
Atgeirr Flø Rasmussen 2019-11-04 09:14:24 +01:00 committed by GitHub
commit 95aeca322f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1393,16 +1393,6 @@ namespace Opm
}
}
if (controls.hasControl(Well2::InjectorCMode::THP) && currentControl != Well2::InjectorCMode::THP)
{
const auto& thp = controls.thp_limit;
double current_thp = well_state.thp()[well_index];
if (thp < current_thp) {
currentControl = Well2::InjectorCMode::THP;
return true;
}
}
if (controls.hasControl(Well2::InjectorCMode::RATE) && currentControl != Well2::InjectorCMode::RATE)
{
Well2::InjectorType injectorType = controls.injector_type;
@ -1453,6 +1443,16 @@ namespace Opm
}
}
if (controls.hasControl(Well2::InjectorCMode::THP) && currentControl != Well2::InjectorCMode::THP)
{
const auto& thp = controls.thp_limit;
double current_thp = well_state.thp()[well_index];
if (thp < current_thp) {
currentControl = Well2::InjectorCMode::THP;
return true;
}
}
}
if (well.isProducer( )) {
@ -1469,16 +1469,6 @@ namespace Opm
}
}
if (controls.hasControl(Well2::ProducerCMode::THP) && currentControl != Well2::ProducerCMode::THP)
{
const auto& thp = controls.thp_limit;
double current_thp = well_state.thp()[well_index];
if (thp > current_thp) {
currentControl = Well2::ProducerCMode::THP;
return true;
}
}
if (controls.hasControl(Well2::ProducerCMode::ORAT) && currentControl != Well2::ProducerCMode::ORAT) {
double current_rate = -well_state.wellRates()[ wellrate_index + pu.phase_pos[BlackoilPhases::Liquid] ];
if (controls.oil_rate < current_rate ) {
@ -1555,6 +1545,16 @@ namespace Opm
}
}
if (controls.hasControl(Well2::ProducerCMode::THP) && currentControl != Well2::ProducerCMode::THP)
{
const auto& thp = controls.thp_limit;
double current_thp = well_state.thp()[well_index];
if (thp > current_thp) {
currentControl = Well2::ProducerCMode::THP;
return true;
}
}
}
return false;