move checkGroupConstraintsProd into WellGroupConstraints

This commit is contained in:
Arne Morten Kvarving 2022-10-24 09:36:05 +02:00
parent 698b748270
commit 75dad9f4c4
4 changed files with 51 additions and 42 deletions

View File

@ -91,4 +91,36 @@ checkGroupConstraintsInj(const Group& group,
deferred_logger);
}
std::pair<bool, double>
WellGroupConstraints::
checkGroupConstraintsProd(const Group& group,
const WellState& well_state,
const GroupState& group_state,
const double efficiencyFactor,
const Schedule& schedule,
const SummaryState& summaryState,
const RateConvFunc& rateConverter,
DeferredLogger& deferred_logger) const
{
// Make conversion factors for RESV <-> surface rates.
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.
const auto& ws = well_state.well(well_.indexOfWell());
return WellGroupHelpers::checkGroupConstraintsProd(well_.name(),
well_.wellEcl().groupName(),
group,
well_state,
group_state,
well_.currentStep(),
well_.guideRate(),
ws.surface_rates.data(),
well_.phaseUsage(),
efficiencyFactor,
schedule,
summaryState,
resv_coeff,
deferred_logger);
}
} // namespace Opm

View File

@ -59,6 +59,16 @@ public:
const RateConvFunc& rateConverter,
DeferredLogger& deferred_logger) const;
std::pair<bool, double>
checkGroupConstraintsProd(const Group& group,
const WellState& well_state,
const GroupState& group_state,
const double efficiencyFactor,
const Schedule& schedule,
const SummaryState& summaryState,
const RateConvFunc& rateConverter,
DeferredLogger& deferred_logger) const;
private:
const WellInterfaceGeneric& well_; //!< Reference to well interface
};

View File

@ -327,38 +327,6 @@ checkIndividualConstraints(SingleWellState& ws,
return false;
}
template <typename FluidSystem>
std::pair<bool, double>
WellInterfaceFluidSystem<FluidSystem>::
checkGroupConstraintsProd(const Group& group,
const WellState& well_state,
const GroupState& group_state,
const double efficiencyFactor,
const Schedule& schedule,
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const
{
// Make conversion factors for RESV <-> surface rates.
std::vector<double> resv_coeff(this->phaseUsage().num_phases, 1.0);
rateConverter_.calcCoeff(0, pvtRegionIdx_, resv_coeff); // FIPNUM region 0 here, should use FIPNUM from WELSPECS.
const auto& ws = well_state.well(this->index_of_well_);
return WellGroupHelpers::checkGroupConstraintsProd(name(),
well_ecl_.groupName(),
group,
well_state,
group_state,
current_step_,
guide_rate_,
ws.surface_rates.data(),
phaseUsage(),
efficiencyFactor,
schedule,
summaryState,
resv_coeff,
deferred_logger);
}
template <typename FluidSystem>
bool
WellInterfaceFluidSystem<FluidSystem>::
@ -425,8 +393,15 @@ checkGroupConstraints(WellState& well_state,
const auto& group = schedule.getGroup( well.groupName(), current_step_ );
const double efficiencyFactor = well.getEfficiencyFactor();
const std::pair<bool, double> group_constraint =
checkGroupConstraintsProd(group, well_state, group_state, efficiencyFactor,
schedule, summaryState, deferred_logger);
WellGroupConstraints(*this).
checkGroupConstraintsProd(group,
well_state,
group_state,
efficiencyFactor,
schedule,
summaryState,
rCoeff,
deferred_logger);
// If a group constraint was broken, we set the current well control to
// be GRUP.
if (group_constraint.first) {

View File

@ -89,14 +89,6 @@ protected:
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const;
std::pair<bool, double> checkGroupConstraintsProd(const Group& group,
const WellState& well_state,
const GroupState& group_state,
const double efficiencyFactor,
const Schedule& schedule,
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const;
bool checkGroupConstraints(WellState& well_state,
const GroupState& group_state,
const Schedule& schedule,