diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 0d60fd97b..6f6eb88d3 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -1379,9 +1379,6 @@ updateNetworkPressures(const int reportStepIdx) if (thp_is_limit) { ws.thp = well->getTHPConstraint(summaryState_); } - //PJPE: Set thp of wells belonging to a subsea manifold equal to the node_pressure - if (network.node(well->wellEcl().groupName()).as_choke()) - ws.thp = new_limit; } } } diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index dabb265ae..3665ed638 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1298,24 +1298,15 @@ namespace Opm { return well_group_rate - orig_target; }; - const std::array range {20E5, 40E5}; + const std::array range {1E5, 150E5}; //PJPE what lower/upper bound to be taken here? double low, high; - // // // trying to use bisect way to locate a bracket - // std::optional approximate_solution; - // bool finding_bracket = WellBhpThpCalculator::bisectBracketModified(mismatch, range, low, high, approximate_solution, local_deferredLogger); - // if (approximate_solution.has_value()) - // std::cout << "Approximate solution: " << *approximate_solution << std::endl; - - bool finding_bracket = false; - if (!finding_bracket) { - local_deferredLogger.debug(" Trying the brute force search to bracket the bhp for last attempt "); - finding_bracket = WellBhpThpCalculator::bruteForceBracket(mismatch, range, low, high, local_deferredLogger); - } - - if (!finding_bracket) { + local_deferredLogger.debug(" Trying the brute force search to bracket the bhp for last attempt "); + const bool finding_bracket = WellBhpThpCalculator::bruteForceBracket(mismatch, range, low, high, local_deferredLogger); + if (finding_bracket) { + std::cout << "low: " << low << " high: " << high << std::endl; + } else { local_deferredLogger.warning("Bracketing THP calculation failed"); - // return std::nullopt; } // PJPE: TODO what settings to take here? @@ -2482,6 +2473,9 @@ namespace Opm { const std::string msg = "Compute initial well solution for " + well->name() + " initially failed. Continue with the previous rates"; deferred_logger.warning("WELL_INITIAL_SOLVE_FAILED", msg); } + // If we're using local well solves that include control switches, they also update + // operability, so reset before main iterations begin + well->resetWellOperability(); } } updatePrimaryVariables(deferred_logger); diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index 0d447b6e6..098c6ff1c 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -1401,35 +1401,23 @@ namespace Opm assert(well.isAvailableForGroupControl()); const auto& group = schedule.getGroup(well.groupName(), this->currentStep()); const Scalar efficiencyFactor = well.getEfficiencyFactor(); + Scalar scale = this->getGroupProductionTargetRate(group, + well_state, + group_state, + schedule, + summaryState, + efficiencyFactor, + deferred_logger); - bool has_choke(false); - const std::size_t report_step = this->currentStep(); - auto& network = schedule[report_step].network(); - if (network.active()) - has_choke = network.node(group.name()).as_choke(); - if (!has_choke) { - Scalar scale = this->getGroupProductionTargetRate(group, - well_state, - group_state, - schedule, - summaryState, - efficiencyFactor, - deferred_logger); - - // we don't want to scale with zero and get zero rates. - if (scale > 0) { - for (int p = 0; p 0) { + for (int p = 0; p