diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index 0c7d0afb6..2ed8f91a0 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -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;