mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fix resv for groups
This commit is contained in:
@@ -444,6 +444,7 @@ namespace Opm {
|
|||||||
|
|
||||||
void calcRates(const int fipnum,
|
void calcRates(const int fipnum,
|
||||||
const int pvtreg,
|
const int pvtreg,
|
||||||
|
const std::vector<double>& production_rates,
|
||||||
std::vector<double>& resv_coeff) override;
|
std::vector<double>& resv_coeff) override;
|
||||||
|
|
||||||
void calcInjRates(const int fipnum,
|
void calcInjRates(const int fipnum,
|
||||||
|
@@ -549,7 +549,7 @@ checkGroupHigherConstraints(const Group& group,
|
|||||||
rates[phasePos] = -comm_.sum(local_current_rate);
|
rates[phasePos] = -comm_.sum(local_current_rate);
|
||||||
}
|
}
|
||||||
std::vector<double> resv_coeff(phase_usage_.num_phases, 0.0);
|
std::vector<double> resv_coeff(phase_usage_.num_phases, 0.0);
|
||||||
calcRates(fipnum, pvtreg, resv_coeff);
|
calcRates(fipnum, pvtreg, this->groupState().production_rates(group.name()), resv_coeff);
|
||||||
// Check higher up only if under individual (not FLD) control.
|
// Check higher up only if under individual (not FLD) control.
|
||||||
const Group::ProductionCMode& currentControl = this->groupState().production_control(group.name());
|
const Group::ProductionCMode& currentControl = this->groupState().production_control(group.name());
|
||||||
if (currentControl != Group::ProductionCMode::FLD && group.productionGroupControlAvailable()) {
|
if (currentControl != Group::ProductionCMode::FLD && group.productionGroupControlAvailable()) {
|
||||||
|
@@ -312,6 +312,7 @@ protected:
|
|||||||
double wsolvent);
|
double wsolvent);
|
||||||
virtual void calcRates(const int fipnum,
|
virtual void calcRates(const int fipnum,
|
||||||
const int pvtreg,
|
const int pvtreg,
|
||||||
|
const std::vector<double>& production_rates,
|
||||||
std::vector<double>& resv_coeff) = 0;
|
std::vector<double>& resv_coeff) = 0;
|
||||||
virtual void calcInjRates(const int fipnum,
|
virtual void calcInjRates(const int fipnum,
|
||||||
const int pvtreg,
|
const int pvtreg,
|
||||||
|
@@ -1856,9 +1856,10 @@ namespace Opm {
|
|||||||
BlackoilWellModel<TypeTag>::
|
BlackoilWellModel<TypeTag>::
|
||||||
calcRates(const int fipnum,
|
calcRates(const int fipnum,
|
||||||
const int pvtreg,
|
const int pvtreg,
|
||||||
|
const std::vector<double>& production_rates,
|
||||||
std::vector<double>& resv_coeff)
|
std::vector<double>& resv_coeff)
|
||||||
{
|
{
|
||||||
rateConverter_->calcCoeff(fipnum, pvtreg, resv_coeff);
|
rateConverter_->calcCoeff(fipnum, pvtreg, production_rates, resv_coeff);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
|
@@ -179,9 +179,13 @@ assembleControlEqProd(const WellState& well_state,
|
|||||||
active_rates[pu.phase_pos[canonical_phase]] = rates[canonical_phase];
|
active_rates[pu.phase_pos[canonical_phase]] = rates[canonical_phase];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto rCoeff = [this](const RegionId id, const int region, std::vector<double>& coeff)
|
auto rCoeff = [this, &group_state](const RegionId id, const int region, const std::optional<std::string>& prod_gname, std::vector<double>& coeff)
|
||||||
{
|
{
|
||||||
well_.rateConverter().calcCoeff(id, region, coeff);
|
if (prod_gname)
|
||||||
|
well_.rateConverter().calcCoeff(id, region, group_state.production_rates(*prod_gname), coeff);
|
||||||
|
else
|
||||||
|
well_.rateConverter().calcCoeff(id, region, coeff);
|
||||||
|
|
||||||
};
|
};
|
||||||
WellGroupControls(well_).getGroupProductionControl(group, well_state,
|
WellGroupControls(well_).getGroupProductionControl(group, well_state,
|
||||||
group_state,
|
group_state,
|
||||||
@@ -269,9 +273,13 @@ assembleControlEqInj(const WellState& well_state,
|
|||||||
case Well::InjectorCMode::GRUP: {
|
case Well::InjectorCMode::GRUP: {
|
||||||
assert(well_.wellEcl().isAvailableForGroupControl());
|
assert(well_.wellEcl().isAvailableForGroupControl());
|
||||||
const auto& group = schedule.getGroup(well_.wellEcl().groupName(), well_.currentStep());
|
const auto& group = schedule.getGroup(well_.wellEcl().groupName(), well_.currentStep());
|
||||||
auto rCoeff = [this](const RegionId id, const int region, std::vector<double>& coeff)
|
auto rCoeff = [this, &group_state](const RegionId id, const int region, const std::optional<std::string>& prod_gname, std::vector<double>& coeff)
|
||||||
{
|
{
|
||||||
well_.rateConverter().calcInjCoeff(id, region, coeff);
|
if(prod_gname) {
|
||||||
|
well_.rateConverter().calcCoeff(id, region, group_state.production_rates(*prod_gname), coeff);
|
||||||
|
} else {
|
||||||
|
well_.rateConverter().calcInjCoeff(id, region, coeff);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
WellGroupControls(well_).getGroupInjectionControl(group,
|
WellGroupControls(well_).getGroupInjectionControl(group,
|
||||||
well_state,
|
well_state,
|
||||||
|
@@ -70,7 +70,7 @@ checkGroupConstraintsInj(const Group& group,
|
|||||||
|
|
||||||
// Make conversion factors for RESV <-> surface rates.
|
// Make conversion factors for RESV <-> surface rates.
|
||||||
std::vector<double> resv_coeff(well_.phaseUsage().num_phases, 1.0);
|
std::vector<double> resv_coeff(well_.phaseUsage().num_phases, 1.0);
|
||||||
rateConverter(0, well_.pvtRegionIdx(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
rateConverter(0, well_.pvtRegionIdx(), group.name(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
||||||
|
|
||||||
const auto& ws = well_state.well(well_.indexOfWell());
|
const auto& ws = well_state.well(well_.indexOfWell());
|
||||||
// Call check for the well's injection phase.
|
// Call check for the well's injection phase.
|
||||||
@@ -104,7 +104,7 @@ checkGroupConstraintsProd(const Group& group,
|
|||||||
{
|
{
|
||||||
// Make conversion factors for RESV <-> surface rates.
|
// Make conversion factors for RESV <-> surface rates.
|
||||||
std::vector<double> resv_coeff(well_.phaseUsage().num_phases, 1.0);
|
std::vector<double> resv_coeff(well_.phaseUsage().num_phases, 1.0);
|
||||||
rateConverter(0, well_.pvtRegionIdx(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
rateConverter(0, well_.pvtRegionIdx(), group.name(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
||||||
|
|
||||||
const auto& ws = well_state.well(well_.indexOfWell());
|
const auto& ws = well_state.well(well_.indexOfWell());
|
||||||
return WellGroupHelpers::checkGroupConstraintsProd(well_.name(),
|
return WellGroupHelpers::checkGroupConstraintsProd(well_.name(),
|
||||||
|
@@ -47,7 +47,7 @@ public:
|
|||||||
//! \brief Constructor sets reference to well.
|
//! \brief Constructor sets reference to well.
|
||||||
WellGroupConstraints(const WellInterfaceGeneric& well) : well_(well) {}
|
WellGroupConstraints(const WellInterfaceGeneric& well) : well_(well) {}
|
||||||
|
|
||||||
using RateConvFunc = std::function<void(const RegionId, const int, std::vector<double>&)>;
|
using RateConvFunc = std::function<void(const RegionId, const int, const std::optional<std::string>&, std::vector<double>&)>;
|
||||||
|
|
||||||
bool checkGroupConstraints(WellState& well_state,
|
bool checkGroupConstraints(WellState& well_state,
|
||||||
const GroupState& group_state,
|
const GroupState& group_state,
|
||||||
|
@@ -127,7 +127,7 @@ getGroupInjectionControl(const Group& group,
|
|||||||
|
|
||||||
// Make conversion factors for RESV <-> surface rates.
|
// Make conversion factors for RESV <-> surface rates.
|
||||||
std::vector<double> resv_coeff(pu.num_phases, 1.0);
|
std::vector<double> resv_coeff(pu.num_phases, 1.0);
|
||||||
rateConverter(0, well_.pvtRegionIdx(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
rateConverter(0, well_.pvtRegionIdx(), std::nullopt, resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
||||||
|
|
||||||
double sales_target = 0;
|
double sales_target = 0;
|
||||||
if (schedule[well_.currentStep()].gconsale().has(group.name())) {
|
if (schedule[well_.currentStep()].gconsale().has(group.name())) {
|
||||||
@@ -251,7 +251,7 @@ getGroupInjectionTargetRate(const Group& group,
|
|||||||
|
|
||||||
// Make conversion factors for RESV <-> surface rates.
|
// Make conversion factors for RESV <-> surface rates.
|
||||||
std::vector<double> resv_coeff(pu.num_phases, 1.0);
|
std::vector<double> resv_coeff(pu.num_phases, 1.0);
|
||||||
rateConverter(0, well_.pvtRegionIdx(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
rateConverter(0, well_.pvtRegionIdx(), std::nullopt, resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
||||||
|
|
||||||
double sales_target = 0;
|
double sales_target = 0;
|
||||||
if (schedule[well_.currentStep()].gconsale().has(group.name())) {
|
if (schedule[well_.currentStep()].gconsale().has(group.name())) {
|
||||||
@@ -353,7 +353,7 @@ void WellGroupControls::getGroupProductionControl(const Group& group,
|
|||||||
|
|
||||||
// Make conversion factors for RESV <-> surface rates.
|
// Make conversion factors for RESV <-> surface rates.
|
||||||
std::vector<double> resv_coeff(well_.phaseUsage().num_phases, 1.0);
|
std::vector<double> resv_coeff(well_.phaseUsage().num_phases, 1.0);
|
||||||
rateConverter(0, well_.pvtRegionIdx(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
rateConverter(0, well_.pvtRegionIdx(), group.name(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
||||||
|
|
||||||
// gconsale may adjust the grat target.
|
// gconsale may adjust the grat target.
|
||||||
// the adjusted rates is send to the targetCalculator
|
// the adjusted rates is send to the targetCalculator
|
||||||
@@ -442,7 +442,7 @@ getGroupProductionTargetRate(const Group& group,
|
|||||||
|
|
||||||
// Make conversion factors for RESV <-> surface rates.
|
// Make conversion factors for RESV <-> surface rates.
|
||||||
std::vector<double> resv_coeff(well_.phaseUsage().num_phases, 1.0);
|
std::vector<double> resv_coeff(well_.phaseUsage().num_phases, 1.0);
|
||||||
rateConverter(0, well_.pvtRegionIdx(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
rateConverter(0, well_.pvtRegionIdx(), group.name(), resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
|
||||||
|
|
||||||
// gconsale may adjust the grat target.
|
// gconsale may adjust the grat target.
|
||||||
// the adjusted rates is send to the targetCalculator
|
// the adjusted rates is send to the targetCalculator
|
||||||
|
@@ -47,7 +47,7 @@ public:
|
|||||||
//! \brief Constructor sets reference to well.
|
//! \brief Constructor sets reference to well.
|
||||||
WellGroupControls(const WellInterfaceGeneric& well) : well_(well) {}
|
WellGroupControls(const WellInterfaceGeneric& well) : well_(well) {}
|
||||||
|
|
||||||
using RateConvFunc = std::function<void(const RegionId, const int, std::vector<double>&)>;
|
using RateConvFunc = std::function<void(const RegionId, const int, const std::optional<std::string>&, std::vector<double>&)>;
|
||||||
|
|
||||||
template<class EvalWell>
|
template<class EvalWell>
|
||||||
void getGroupInjectionControl(const Group& group,
|
void getGroupInjectionControl(const Group& group,
|
||||||
|
@@ -131,9 +131,13 @@ checkGroupConstraints(WellState& well_state,
|
|||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
auto rCoeff = [this](const int id, const int region, std::vector<double>& coeff)
|
auto rCoeff = [this, &group_state](const RegionId id, const int region, const std::optional<std::string>& prod_gname, std::vector<double>& coeff)
|
||||||
{
|
{
|
||||||
this->rateConverter().calcCoeff(id, region, coeff);
|
if (prod_gname)
|
||||||
|
this->rateConverter().calcCoeff(id, region, group_state.production_rates(*prod_gname), coeff);
|
||||||
|
else
|
||||||
|
this->rateConverter().calcInjCoeff(id, region, coeff);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return WellGroupConstraints(*this).checkGroupConstraints(well_state, group_state,
|
return WellGroupConstraints(*this).checkGroupConstraints(well_state, group_state,
|
||||||
@@ -187,9 +191,13 @@ getGroupInjectionTargetRate(const Group& group,
|
|||||||
double efficiencyFactor,
|
double efficiencyFactor,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
auto rCoeff = [this](const int id, const int region, std::vector<double>& coeff)
|
auto rCoeff = [this, &group_state](const RegionId id, const int region, const std::optional<std::string>& prod_gname, std::vector<double>& coeff)
|
||||||
{
|
{
|
||||||
this->rateConverter().calcCoeff(id, region, coeff);
|
if (prod_gname)
|
||||||
|
this->rateConverter().calcCoeff(id, region, group_state.production_rates(*prod_gname), coeff);
|
||||||
|
else
|
||||||
|
this->rateConverter().calcInjCoeff(id, region, coeff);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return WellGroupControls(*this).getGroupInjectionTargetRate(group, well_state,
|
return WellGroupControls(*this).getGroupInjectionTargetRate(group, well_state,
|
||||||
@@ -210,9 +218,13 @@ getGroupProductionTargetRate(const Group& group,
|
|||||||
double efficiencyFactor,
|
double efficiencyFactor,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
auto rCoeff = [this](const int id, const int region, std::vector<double>& coeff)
|
auto rCoeff = [this, &group_state](const RegionId id, const int region, const std::optional<std::string>& prod_gname, std::vector<double>& coeff)
|
||||||
{
|
{
|
||||||
this->rateConverter().calcCoeff(id, region, coeff);
|
if (prod_gname)
|
||||||
|
this->rateConverter().calcCoeff(id, region, group_state.production_rates(*prod_gname), coeff);
|
||||||
|
else
|
||||||
|
this->rateConverter().calcInjCoeff(id, region, coeff);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return WellGroupControls(*this).getGroupProductionTargetRate(group, well_state,
|
return WellGroupControls(*this).getGroupProductionTargetRate(group, well_state,
|
||||||
|
@@ -275,7 +275,7 @@ public:
|
|||||||
switched_inj_groups_ = {{{"test4", Phase::SOLVENT}, "test5"}};
|
switched_inj_groups_ = {{{"test4", Phase::SOLVENT}, "test5"}};
|
||||||
}
|
}
|
||||||
|
|
||||||
void calcRates(const int, const int, std::vector<double>&) override
|
void calcRates(const int, const int, const std::vector<double>&, std::vector<double>&) override
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void calcInjRates(const int, const int, std::vector<double>&) override
|
void calcInjRates(const int, const int, std::vector<double>&) override
|
||||||
|
Reference in New Issue
Block a user