Automatic choke

This commit is contained in:
Paul 2023-10-03 13:28:23 +02:00 committed by plgbrts
parent efe0192cca
commit 3933166001
5 changed files with 42 additions and 12 deletions

View File

@ -1546,7 +1546,6 @@ updateNetworkPressures(const int reportStepIdx, const Scalar damping_factor)
}
for (auto& well : well_container_generic_) {
// Producers only, since we so far only support the
// "extended" network model (properties defined by
// BRANPROP and NODEPROP) which only applies to producers.
@ -1563,6 +1562,9 @@ updateNetworkPressures(const int reportStepIdx, const Scalar damping_factor)
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;
}
}
}

View File

@ -46,6 +46,8 @@
#include <opm/simulators/wells/TargetCalculator.hpp>
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <opm/simulators/wells/WellGroupHelpers.hpp>
#include <opm/simulators/wells/TargetCalculator.hpp>
#include <opm/simulators/utils/MPIPacker.hpp>
#include <opm/simulators/utils/phaseUsageFromDeck.hpp>
@ -1232,6 +1234,9 @@ namespace Opm {
BlackoilWellModel<TypeTag>::
updateWellControlsAndNetwork(const bool mandatory_network_balance, const double dt, DeferredLogger& local_deferredLogger)
{
// PJPE: calculate common THP for subsea manifold well group (item 3 of NODEPROP set to YES)
computeWellGroupThp(local_deferredLogger);
// not necessarily that we always need to update once of the network solutions
bool do_network_update = true;
bool well_group_control_changed = false;
@ -2682,9 +2687,6 @@ namespace Opm {
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);

View File

@ -105,6 +105,23 @@ GroupState<Scalar>::production_rates(const std::string& gname) const
}
//-------------------------------------------------------------------------
template<class Scalar>
bool GroupState<Scalar>::
GroupState::update_well_group_thp(const std::string& gname, const double& thp)
{
this->group_thp[gname] = thp;
}
template<class Scalar>
double GroupState<Scalar>::
GroupState::well_group_thp(const std::string& gname) const
{
auto group_iter = this->group_thp.find(gname);
if (group_iter == this->group_thp.end())
throw std::logic_error("No such group");
return group_iter->second;
}
template<class Scalar>
void GroupState<Scalar>::

View File

@ -55,6 +55,7 @@ public:
const std::vector<Scalar>& production_rates(const std::string& gname) const;
void update_well_group_thp(const std::string& gname, const double& thp);
Scalar well_group_thp(const std::string& gname) const;
bool has_production_reduction_rates(const std::string& gname) const;
@ -213,7 +214,11 @@ private:
std::map<std::string, Scalar> inj_vrep_rate;
std::map<std::string, Scalar> m_grat_sales_target;
std::map<std::string, Scalar> m_gpmaint_target;
<<<<<<< HEAD
std::map<std::string, Scalar> group_thp;
=======
std::map<std::string, double> group_thp;
>>>>>>> 8e410ac73 (Automatic choke)
std::map<std::pair<Phase, std::string>, Group::InjectionCMode> injection_controls;
WellContainer<GPMaint::State> gpmaint_state;

View File

@ -1473,17 +1473,21 @@ namespace Opm
efficiencyFactor,
deferred_logger);
// we don't want to scale with zero and get zero rates.
if (scale > 0) {
for (int p = 0; p<np; ++p) {
ws.surface_rates[p] *= scale;
// we don't want to scale with zero and get zero rates.
if (scale > 0) {
for (int p = 0; p<np; ++p) {
ws.surface_rates[p] *= scale;
}
ws.trivial_target = false;
} else {
ws.trivial_target = true;
}
ws.trivial_target = false;
} else {
ws.trivial_target = true;
}
// PJPE: the group is a subsea manifold.Guide rates to be ignored.
// The wells of the group are to be operated on a common THP (= manifold node pressure)
}
break;
}
}
case Well::ProducerCMode::CMODE_UNDEFINED:
case Well::ProducerCMode::NONE:
{