mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use SingleWellState argument instead of full WellState
This commit is contained in:
@@ -1323,12 +1323,13 @@ namespace Opm {
|
|||||||
{
|
{
|
||||||
DeferredLogger local_deferredLogger;
|
DeferredLogger local_deferredLogger;
|
||||||
for (const auto& well : well_container_) {
|
for (const auto& well : well_container_) {
|
||||||
const auto wasClosed = wellTestState.hasWellClosed(well->name());
|
const auto& wname = well->name();
|
||||||
|
const auto wasClosed = wellTestState.hasWellClosed(wname);
|
||||||
|
|
||||||
well->updateWellTestState(this->wellState(), simulationTime, /*writeMessageToOPMLog=*/ true, wellTestState, local_deferredLogger);
|
well->updateWellTestState(this->wellState().well(wname), simulationTime, /*writeMessageToOPMLog=*/ true, wellTestState, local_deferredLogger);
|
||||||
|
|
||||||
if (!wasClosed && wellTestState.hasWellClosed(well->name())) {
|
if (!wasClosed && wellTestState.hasWellClosed(wname)) {
|
||||||
this->closed_this_step_.insert(well->name());
|
this->closed_this_step_.insert(wname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ namespace Opm
|
|||||||
max_pressure_change);
|
max_pressure_change);
|
||||||
|
|
||||||
this->updateWellStateFromPrimaryVariables(well_state, getRefDensity(), deferred_logger);
|
this->updateWellStateFromPrimaryVariables(well_state, getRefDensity(), deferred_logger);
|
||||||
Base::calculateReservoirRates(well_state);
|
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ namespace Opm
|
|||||||
updatePrimaryVariablesNewton(dwells, well_state);
|
updatePrimaryVariablesNewton(dwells, well_state);
|
||||||
|
|
||||||
updateWellStateFromPrimaryVariables(well_state, deferred_logger);
|
updateWellStateFromPrimaryVariables(well_state, deferred_logger);
|
||||||
Base::calculateReservoirRates(well_state);
|
Base::calculateReservoirRates(well_state.well(this->index_of_well_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
||||||
#include <opm/simulators/wells/WellGroupHelpers.hpp>
|
#include <opm/simulators/wells/WellGroupHelpers.hpp>
|
||||||
#include <opm/simulators/wells/WellState.hpp>
|
#include <opm/simulators/wells/WellState.hpp>
|
||||||
|
#include <opm/simulators/wells/SingleWellState.hpp>
|
||||||
#include <opm/simulators/wells/GroupState.hpp>
|
#include <opm/simulators/wells/GroupState.hpp>
|
||||||
#include <opm/simulators/wells/TargetCalculator.hpp>
|
#include <opm/simulators/wells/TargetCalculator.hpp>
|
||||||
|
|
||||||
@@ -62,12 +63,11 @@ WellInterfaceFluidSystem(const Well& well,
|
|||||||
template<typename FluidSystem>
|
template<typename FluidSystem>
|
||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
calculateReservoirRates(WellState& well_state) const
|
calculateReservoirRates(SingleWellState& ws) const
|
||||||
{
|
{
|
||||||
const int fipreg = 0; // not considering the region for now
|
const int fipreg = 0; // not considering the region for now
|
||||||
const int np = number_of_phases_;
|
const int np = number_of_phases_;
|
||||||
|
|
||||||
auto& ws = well_state.well(this->index_of_well_);
|
|
||||||
std::vector<double> surface_rates(np, 0.0);
|
std::vector<double> surface_rates(np, 0.0);
|
||||||
for (int p = 0; p < np; ++p) {
|
for (int p = 0; p < np; ++p) {
|
||||||
surface_rates[p] = ws.surface_rates[p];
|
surface_rates[p] = ws.surface_rates[p];
|
||||||
@@ -82,13 +82,11 @@ calculateReservoirRates(WellState& well_state) const
|
|||||||
template <typename FluidSystem>
|
template <typename FluidSystem>
|
||||||
Well::ProducerCMode
|
Well::ProducerCMode
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
activeProductionConstraint(const WellState& well_state,
|
activeProductionConstraint(const SingleWellState& ws,
|
||||||
const SummaryState& summaryState) const
|
const SummaryState& summaryState) const
|
||||||
{
|
{
|
||||||
const PhaseUsage& pu = this->phaseUsage();
|
const PhaseUsage& pu = this->phaseUsage();
|
||||||
const int well_index = this->index_of_well_;
|
|
||||||
const auto controls = this->well_ecl_.productionControls(summaryState);
|
const auto controls = this->well_ecl_.productionControls(summaryState);
|
||||||
auto& ws = well_state.well(well_index);
|
|
||||||
const auto currentControl = ws.production_cmode;
|
const auto currentControl = ws.production_cmode;
|
||||||
|
|
||||||
if (controls.hasControl(Well::ProducerCMode::BHP) && currentControl != Well::ProducerCMode::BHP) {
|
if (controls.hasControl(Well::ProducerCMode::BHP) && currentControl != Well::ProducerCMode::BHP) {
|
||||||
@@ -175,12 +173,10 @@ activeProductionConstraint(const WellState& well_state,
|
|||||||
template <typename FluidSystem>
|
template <typename FluidSystem>
|
||||||
Well::InjectorCMode
|
Well::InjectorCMode
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
activeInjectionConstraint(const WellState& well_state,
|
activeInjectionConstraint(const SingleWellState& ws,
|
||||||
const SummaryState& summaryState) const
|
const SummaryState& summaryState) const
|
||||||
{
|
{
|
||||||
const PhaseUsage& pu = this->phaseUsage();
|
const PhaseUsage& pu = this->phaseUsage();
|
||||||
const int well_index = this->index_of_well_;
|
|
||||||
const auto& ws = well_state.well(well_index);
|
|
||||||
|
|
||||||
const auto controls = this->well_ecl_.injectionControls(summaryState);
|
const auto controls = this->well_ecl_.injectionControls(summaryState);
|
||||||
const auto currentControl = ws.injection_cmode;
|
const auto currentControl = ws.injection_cmode;
|
||||||
@@ -252,13 +248,11 @@ activeInjectionConstraint(const WellState& well_state,
|
|||||||
template <typename FluidSystem>
|
template <typename FluidSystem>
|
||||||
bool
|
bool
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkIndividualConstraints(WellState& well_state,
|
checkIndividualConstraints(SingleWellState& ws,
|
||||||
const SummaryState& summaryState) const
|
const SummaryState& summaryState) const
|
||||||
{
|
{
|
||||||
const int well_index = this->index_of_well_;
|
|
||||||
auto& ws = well_state.well(well_index);
|
|
||||||
if (this->well_ecl_.isProducer()) {
|
if (this->well_ecl_.isProducer()) {
|
||||||
auto new_cmode = this->activeProductionConstraint(well_state, summaryState);
|
auto new_cmode = this->activeProductionConstraint(ws, summaryState);
|
||||||
if (new_cmode != ws.production_cmode) {
|
if (new_cmode != ws.production_cmode) {
|
||||||
ws.production_cmode = new_cmode;
|
ws.production_cmode = new_cmode;
|
||||||
return true;
|
return true;
|
||||||
@@ -266,7 +260,7 @@ checkIndividualConstraints(WellState& well_state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this->well_ecl_.isInjector()) {
|
if (this->well_ecl_.isInjector()) {
|
||||||
auto new_cmode = this->activeInjectionConstraint(well_state, summaryState);
|
auto new_cmode = this->activeInjectionConstraint(ws, summaryState);
|
||||||
if (new_cmode != ws.injection_cmode) {
|
if (new_cmode != ws.injection_cmode) {
|
||||||
ws.injection_cmode = new_cmode;
|
ws.injection_cmode = new_cmode;
|
||||||
return true;
|
return true;
|
||||||
@@ -447,7 +441,7 @@ checkConstraints(WellState& well_state,
|
|||||||
const SummaryState& summaryState,
|
const SummaryState& summaryState,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
const bool ind_broken = checkIndividualConstraints(well_state, summaryState);
|
const bool ind_broken = checkIndividualConstraints(well_state.well(this->index_of_well_), summaryState);
|
||||||
if (ind_broken) {
|
if (ind_broken) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -505,7 +499,7 @@ template<typename FluidSystem>
|
|||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report) const
|
RatioLimitCheckReport& report) const
|
||||||
{
|
{
|
||||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
||||||
@@ -532,11 +526,11 @@ checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
|||||||
const double max_water_cut_limit = econ_production_limits.maxWaterCut();
|
const double max_water_cut_limit = econ_production_limits.maxWaterCut();
|
||||||
assert(max_water_cut_limit > 0.);
|
assert(max_water_cut_limit > 0.);
|
||||||
|
|
||||||
const bool watercut_limit_violated = checkMaxRatioLimitWell(well_state, max_water_cut_limit, waterCut);
|
const bool watercut_limit_violated = checkMaxRatioLimitWell(ws, max_water_cut_limit, waterCut);
|
||||||
|
|
||||||
if (watercut_limit_violated) {
|
if (watercut_limit_violated) {
|
||||||
report.ratio_limit_violated = true;
|
report.ratio_limit_violated = true;
|
||||||
checkMaxRatioLimitCompletions(well_state, max_water_cut_limit, waterCut, report);
|
checkMaxRatioLimitCompletions(ws, max_water_cut_limit, waterCut, report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -544,7 +538,7 @@ template<typename FluidSystem>
|
|||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report) const
|
RatioLimitCheckReport& report) const
|
||||||
{
|
{
|
||||||
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
assert(FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx));
|
||||||
@@ -578,11 +572,11 @@ checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
|||||||
const double max_gor_limit = econ_production_limits.maxGasOilRatio();
|
const double max_gor_limit = econ_production_limits.maxGasOilRatio();
|
||||||
assert(max_gor_limit > 0.);
|
assert(max_gor_limit > 0.);
|
||||||
|
|
||||||
const bool gor_limit_violated = checkMaxRatioLimitWell(well_state, max_gor_limit, gor);
|
const bool gor_limit_violated = checkMaxRatioLimitWell(ws, max_gor_limit, gor);
|
||||||
|
|
||||||
if (gor_limit_violated) {
|
if (gor_limit_violated) {
|
||||||
report.ratio_limit_violated = true;
|
report.ratio_limit_violated = true;
|
||||||
checkMaxRatioLimitCompletions(well_state, max_gor_limit, gor, report);
|
checkMaxRatioLimitCompletions(ws, max_gor_limit, gor, report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,7 +584,7 @@ template<typename FluidSystem>
|
|||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report) const
|
RatioLimitCheckReport& report) const
|
||||||
{
|
{
|
||||||
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
|
assert(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx));
|
||||||
@@ -624,11 +618,11 @@ checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
|||||||
const double max_wgr_limit = econ_production_limits.maxWaterGasRatio();
|
const double max_wgr_limit = econ_production_limits.maxWaterGasRatio();
|
||||||
assert(max_wgr_limit > 0.);
|
assert(max_wgr_limit > 0.);
|
||||||
|
|
||||||
const bool wgr_limit_violated = checkMaxRatioLimitWell(well_state, max_wgr_limit, wgr);
|
const bool wgr_limit_violated = checkMaxRatioLimitWell(ws, max_wgr_limit, wgr);
|
||||||
|
|
||||||
if (wgr_limit_violated) {
|
if (wgr_limit_violated) {
|
||||||
report.ratio_limit_violated = true;
|
report.ratio_limit_violated = true;
|
||||||
checkMaxRatioLimitCompletions(well_state, max_wgr_limit, wgr, report);
|
checkMaxRatioLimitCompletions(ws, max_wgr_limit, wgr, report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,7 +630,7 @@ template<typename FluidSystem>
|
|||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report,
|
RatioLimitCheckReport& report,
|
||||||
DeferredLogger& deferred_logger) const
|
DeferredLogger& deferred_logger) const
|
||||||
{
|
{
|
||||||
@@ -649,15 +643,15 @@ checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
|||||||
// extent.
|
// extent.
|
||||||
|
|
||||||
if (econ_production_limits.onMaxWaterCut()) {
|
if (econ_production_limits.onMaxWaterCut()) {
|
||||||
checkMaxWaterCutLimit(econ_production_limits, well_state, report);
|
checkMaxWaterCutLimit(econ_production_limits, ws, report);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (econ_production_limits.onMaxGasOilRatio()) {
|
if (econ_production_limits.onMaxGasOilRatio()) {
|
||||||
checkMaxGORLimit(econ_production_limits, well_state, report);
|
checkMaxGORLimit(econ_production_limits, ws, report);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (econ_production_limits.onMaxWaterGasRatio()) {
|
if (econ_production_limits.onMaxWaterGasRatio()) {
|
||||||
checkMaxWGRLimit(econ_production_limits, well_state, report);
|
checkMaxWGRLimit(econ_production_limits, ws, report);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (econ_production_limits.onMaxGasLiquidRatio()) {
|
if (econ_production_limits.onMaxGasLiquidRatio()) {
|
||||||
@@ -673,7 +667,7 @@ checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
|||||||
template<typename FluidSystem>
|
template<typename FluidSystem>
|
||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
updateWellTestStateEconomic(const WellState& well_state,
|
updateWellTestStateEconomic(const SingleWellState& ws,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
const bool write_message_to_opmlog,
|
const bool write_message_to_opmlog,
|
||||||
WellTestState& well_test_state,
|
WellTestState& well_test_state,
|
||||||
@@ -693,7 +687,6 @@ updateWellTestStateEconomic(const WellState& well_state,
|
|||||||
bool rate_limit_violated = false;
|
bool rate_limit_violated = false;
|
||||||
|
|
||||||
const auto& quantity_limit = econ_production_limits.quantityLimit();
|
const auto& quantity_limit = econ_production_limits.quantityLimit();
|
||||||
const auto& ws = well_state.well(this->index_of_well_);
|
|
||||||
if (econ_production_limits.onAnyRateLimit()) {
|
if (econ_production_limits.onAnyRateLimit()) {
|
||||||
if (quantity_limit == WellEconProductionLimits::QuantityLimit::POTN)
|
if (quantity_limit == WellEconProductionLimits::QuantityLimit::POTN)
|
||||||
rate_limit_violated = checkRateEconLimits(econ_production_limits, ws.well_potentials.data(), deferred_logger);
|
rate_limit_violated = checkRateEconLimits(econ_production_limits, ws.well_potentials.data(), deferred_logger);
|
||||||
@@ -738,7 +731,7 @@ updateWellTestStateEconomic(const WellState& well_state,
|
|||||||
// checking for ratio related limits, mostly all kinds of ratio.
|
// checking for ratio related limits, mostly all kinds of ratio.
|
||||||
RatioLimitCheckReport ratio_report;
|
RatioLimitCheckReport ratio_report;
|
||||||
|
|
||||||
checkRatioEconLimits(econ_production_limits, well_state, ratio_report, deferred_logger);
|
checkRatioEconLimits(econ_production_limits, ws, ratio_report, deferred_logger);
|
||||||
|
|
||||||
if (ratio_report.ratio_limit_violated) {
|
if (ratio_report.ratio_limit_violated) {
|
||||||
const auto workover = econ_production_limits.workover();
|
const auto workover = econ_production_limits.workover();
|
||||||
@@ -812,7 +805,7 @@ updateWellTestStateEconomic(const WellState& well_state,
|
|||||||
template<typename FluidSystem>
|
template<typename FluidSystem>
|
||||||
void
|
void
|
||||||
WellInterfaceFluidSystem<FluidSystem>::
|
WellInterfaceFluidSystem<FluidSystem>::
|
||||||
updateWellTestState(const WellState& well_state,
|
updateWellTestState(const SingleWellState& ws,
|
||||||
const double& simulationTime,
|
const double& simulationTime,
|
||||||
const bool& writeMessageToOPMLog,
|
const bool& writeMessageToOPMLog,
|
||||||
WellTestState& wellTestState,
|
WellTestState& wellTestState,
|
||||||
@@ -831,10 +824,10 @@ updateWellTestState(const WellState& well_state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// updating well test state based on physical (THP/BHP) limits.
|
// updating well test state based on physical (THP/BHP) limits.
|
||||||
updateWellTestStatePhysical(well_state, simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger);
|
updateWellTestStatePhysical(ws, simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger);
|
||||||
|
|
||||||
// updating well test state based on Economic limits.
|
// updating well test state based on Economic limits.
|
||||||
updateWellTestStateEconomic(well_state, simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger);
|
updateWellTestStateEconomic(ws, simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger);
|
||||||
|
|
||||||
// TODO: well can be shut/closed due to other reasons
|
// TODO: well can be shut/closed due to other reasons
|
||||||
}
|
}
|
||||||
@@ -842,7 +835,7 @@ updateWellTestState(const WellState& well_state,
|
|||||||
template<typename FluidSystem>
|
template<typename FluidSystem>
|
||||||
template <typename RatioFunc>
|
template <typename RatioFunc>
|
||||||
void WellInterfaceFluidSystem<FluidSystem>::
|
void WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkMaxRatioLimitCompletions(const WellState& well_state,
|
checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||||
const double max_ratio_limit,
|
const double max_ratio_limit,
|
||||||
const RatioFunc& ratioFunc,
|
const RatioFunc& ratioFunc,
|
||||||
RatioLimitCheckReport& report) const
|
RatioLimitCheckReport& report) const
|
||||||
@@ -854,7 +847,6 @@ checkMaxRatioLimitCompletions(const WellState& well_state,
|
|||||||
double max_ratio_completion = 0;
|
double max_ratio_completion = 0;
|
||||||
const int np = number_of_phases_;
|
const int np = number_of_phases_;
|
||||||
|
|
||||||
const auto& ws = well_state.well(this->index_of_well_);
|
|
||||||
const auto& perf_data = ws.perf_data;
|
const auto& perf_data = ws.perf_data;
|
||||||
const auto& perf_phase_rates = perf_data.phase_rates;
|
const auto& perf_phase_rates = perf_data.phase_rates;
|
||||||
// look for the worst_offending_completion
|
// look for the worst_offending_completion
|
||||||
@@ -893,14 +885,13 @@ checkMaxRatioLimitCompletions(const WellState& well_state,
|
|||||||
template<typename FluidSystem>
|
template<typename FluidSystem>
|
||||||
template<typename RatioFunc>
|
template<typename RatioFunc>
|
||||||
bool WellInterfaceFluidSystem<FluidSystem>::
|
bool WellInterfaceFluidSystem<FluidSystem>::
|
||||||
checkMaxRatioLimitWell(const WellState& well_state,
|
checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||||
const double max_ratio_limit,
|
const double max_ratio_limit,
|
||||||
const RatioFunc& ratioFunc) const
|
const RatioFunc& ratioFunc) const
|
||||||
{
|
{
|
||||||
const int np = number_of_phases_;
|
const int np = number_of_phases_;
|
||||||
|
|
||||||
std::vector<double> well_rates(np, 0.0);
|
std::vector<double> well_rates(np, 0.0);
|
||||||
const auto& ws = well_state.well(this->index_of_well_);
|
|
||||||
for (int p = 0; p < np; ++p) {
|
for (int p = 0; p < np; ++p) {
|
||||||
well_rates[p] = ws.surface_rates[p];
|
well_rates[p] = ws.surface_rates[p];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class Group;
|
|||||||
class GroupState;
|
class GroupState;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
class WellState;
|
class WellState;
|
||||||
|
class SingleWellState;
|
||||||
|
|
||||||
template<class FluidSystem>
|
template<class FluidSystem>
|
||||||
class WellInterfaceFluidSystem : public WellInterfaceGeneric {
|
class WellInterfaceFluidSystem : public WellInterfaceGeneric {
|
||||||
@@ -50,7 +51,7 @@ protected:
|
|||||||
static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
|
static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void updateWellTestState(const WellState& well_state,
|
void updateWellTestState(const SingleWellState& ws,
|
||||||
const double& simulationTime,
|
const double& simulationTime,
|
||||||
const bool& writeMessageToOPMLog,
|
const bool& writeMessageToOPMLog,
|
||||||
WellTestState& wellTestState,
|
WellTestState& wellTestState,
|
||||||
@@ -79,15 +80,15 @@ protected:
|
|||||||
const std::vector<PerforationData>& perf_data);
|
const std::vector<PerforationData>& perf_data);
|
||||||
|
|
||||||
// updating the voidage rates in well_state when requested
|
// updating the voidage rates in well_state when requested
|
||||||
void calculateReservoirRates(WellState& well_state) const;
|
void calculateReservoirRates(SingleWellState& ws) const;
|
||||||
|
|
||||||
bool checkIndividualConstraints(WellState& well_state,
|
bool checkIndividualConstraints(SingleWellState& ws,
|
||||||
const SummaryState& summaryState) const;
|
const SummaryState& summaryState) const;
|
||||||
|
|
||||||
Well::InjectorCMode activeInjectionConstraint(const WellState& well_state,
|
Well::InjectorCMode activeInjectionConstraint(const SingleWellState& ws,
|
||||||
const SummaryState& summaryState) const;
|
const SummaryState& summaryState) const;
|
||||||
|
|
||||||
Well::ProducerCMode activeProductionConstraint(const WellState& well_state,
|
Well::ProducerCMode activeProductionConstraint(const SingleWellState& ws,
|
||||||
const SummaryState& summaryState) const;
|
const SummaryState& summaryState) const;
|
||||||
|
|
||||||
std::pair<bool, double> checkGroupConstraintsInj(const Group& group,
|
std::pair<bool, double> checkGroupConstraintsInj(const Group& group,
|
||||||
@@ -129,23 +130,23 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
void checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
|
|
||||||
void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
void checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
|
|
||||||
void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
void checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
|
|
||||||
void checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
void checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const SingleWellState& ws,
|
||||||
RatioLimitCheckReport& report,
|
RatioLimitCheckReport& report,
|
||||||
DeferredLogger& deferred_logger) const;
|
DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
void updateWellTestStateEconomic(const WellState& well_state,
|
void updateWellTestStateEconomic(const SingleWellState& ws,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
const bool write_message_to_opmlog,
|
const bool write_message_to_opmlog,
|
||||||
WellTestState& well_test_state,
|
WellTestState& well_test_state,
|
||||||
@@ -174,13 +175,13 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename RatioFunc>
|
template <typename RatioFunc>
|
||||||
void checkMaxRatioLimitCompletions(const WellState& well_state,
|
void checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||||
const double max_ratio_limit,
|
const double max_ratio_limit,
|
||||||
const RatioFunc& ratioFunc,
|
const RatioFunc& ratioFunc,
|
||||||
RatioLimitCheckReport& report) const;
|
RatioLimitCheckReport& report) const;
|
||||||
|
|
||||||
template<typename RatioFunc>
|
template<typename RatioFunc>
|
||||||
bool checkMaxRatioLimitWell(const WellState& well_state,
|
bool checkMaxRatioLimitWell(const SingleWellState& well_state,
|
||||||
const double max_ratio_limit,
|
const double max_ratio_limit,
|
||||||
const RatioFunc& ratioFunc) const;
|
const RatioFunc& ratioFunc) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ bool WellInterfaceGeneric::isVFPActive(DeferredLogger& deferred_logger) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellInterfaceGeneric::updateWellTestStatePhysical(const WellState& /* well_state */,
|
void WellInterfaceGeneric::updateWellTestStatePhysical(const SingleWellState& /* well_state */,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
const bool write_message_to_opmlog,
|
const bool write_message_to_opmlog,
|
||||||
WellTestState& well_test_state,
|
WellTestState& well_test_state,
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class SummaryState;
|
|||||||
class VFPProperties;
|
class VFPProperties;
|
||||||
class WellTestState;
|
class WellTestState;
|
||||||
class WellState;
|
class WellState;
|
||||||
|
class SingleWellState;
|
||||||
class GroupState;
|
class GroupState;
|
||||||
class Group;
|
class Group;
|
||||||
class Schedule;
|
class Schedule;
|
||||||
@@ -171,7 +172,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool getAllowCrossFlow() const;
|
bool getAllowCrossFlow() const;
|
||||||
double mostStrictBhpFromBhpLimits(const SummaryState& summaryState) const;
|
double mostStrictBhpFromBhpLimits(const SummaryState& summaryState) const;
|
||||||
void updateWellTestStatePhysical(const WellState& well_state,
|
void updateWellTestStatePhysical(const SingleWellState& ws,
|
||||||
const double simulation_time,
|
const double simulation_time,
|
||||||
const bool write_message_to_opmlog,
|
const bool write_message_to_opmlog,
|
||||||
WellTestState& well_test_state,
|
WellTestState& well_test_state,
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ namespace Opm
|
|||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (iog == IndividualOrGroup::Individual) {
|
if (iog == IndividualOrGroup::Individual) {
|
||||||
changed = this->checkIndividualConstraints(well_state, summaryState);
|
changed = this->checkIndividualConstraints(ws, summaryState);
|
||||||
} else if (iog == IndividualOrGroup::Group) {
|
} else if (iog == IndividualOrGroup::Group) {
|
||||||
changed = this->checkGroupConstraints(well_state, group_state, schedule, summaryState, deferred_logger);
|
changed = this->checkGroupConstraints(well_state, group_state, schedule, summaryState, deferred_logger);
|
||||||
} else {
|
} else {
|
||||||
@@ -273,7 +273,7 @@ namespace Opm
|
|||||||
for (int p = 0; p < np; ++p) {
|
for (int p = 0; p < np; ++p) {
|
||||||
ws.well_potentials[p] = std::abs(potentials[p]);
|
ws.well_potentials[p] = std::abs(potentials[p]);
|
||||||
}
|
}
|
||||||
this->updateWellTestState(well_state_copy, simulation_time, /*writeMessageToOPMLog=*/ false, welltest_state_temp, deferred_logger);
|
this->updateWellTestState(well_state_copy.well(this->indexOfWell()), simulation_time, /*writeMessageToOPMLog=*/ false, welltest_state_temp, deferred_logger);
|
||||||
this->closeCompletions(welltest_state_temp);
|
this->closeCompletions(welltest_state_temp);
|
||||||
|
|
||||||
// Stop testing if the well is closed or shut due to all completions shut
|
// Stop testing if the well is closed or shut due to all completions shut
|
||||||
|
|||||||
Reference in New Issue
Block a user