Merge pull request #1831 from joakim-hove/use-wells2-controls

Use wells2 controls
This commit is contained in:
Joakim Hove
2019-05-29 06:46:58 +02:00
committed by GitHub
9 changed files with 125 additions and 129 deletions

View File

@@ -104,7 +104,7 @@ public:
void init()
{
const Opm::Schedule& deckSchedule = simulator_.vanguard().schedule();
Opm::SummaryState summaryState;
// create the wells which intersect with the current process' grid
for (size_t deckWellIdx = 0; deckWellIdx < deckSchedule.numWells(); ++deckWellIdx)
{
@@ -112,7 +112,7 @@ public:
const std::string& wellName = deckWell.name();
Scalar wellTemperature = 273.15 + 15.56; // [K]
if (deckWell.isInjector())
wellTemperature = deckWell.getInjectionProperties().temperature;
wellTemperature = deckWell.injectionControls(summaryState).temperature;
// set the name of the well but not much else. (i.e., if it is not completed,
// the well primarily serves as a placeholder.) The big rest of the well is
@@ -136,7 +136,7 @@ public:
const Opm::EclipseState& eclState = simulator_.vanguard().eclState();
const Opm::Schedule& deckSchedule = simulator_.vanguard().schedule();
unsigned episodeIdx = simulator_.episodeIndex();
Opm::SummaryState summaryState;
WellConnectionsMap wellCompMap;
computeWellConnectionsMap_(episodeIdx, wellCompMap);
@@ -156,7 +156,7 @@ public:
auto well = this->well(deckWell.name());
if (deckWell.isInjector( ))
well->setTemperature(deckWell.getInjectionProperties( ).temperature);
well->setTemperature(deckWell.injectionControls(summaryState).temperature);
Opm::WellCommon::StatusEnum deckWellStatus = deckWell.getStatus( );
switch (deckWellStatus) {
@@ -181,11 +181,8 @@ public:
if (deckWell.isInjector( )) {
well->setWellType(Well::Injector);
const Opm::WellInjectionProperties& injectProperties =
deckWell.getInjectionProperties( );
switch (injectProperties.injectorType) {
const auto controls = deckWell.injectionControls(summaryState);
switch (controls.injector_type) {
case Opm::WellInjector::WATER:
well->setInjectedPhaseIndex(FluidSystem::waterPhaseIdx);
break;
@@ -199,7 +196,7 @@ public:
throw std::runtime_error("Not implemented: Multi-phase injector wells");
}
switch (injectProperties.controlMode) {
switch (controls.cmode) {
case Opm::WellInjector::RATE:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
break;
@@ -226,7 +223,7 @@ public:
continue;
}
switch (injectProperties.injectorType) {
switch (controls.injector_type) {
case Opm::WellInjector::WATER:
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0);
break;
@@ -243,44 +240,42 @@ public:
throw std::runtime_error("Not implemented: Multi-phase injection wells");
}
well->setMaximumSurfaceRate(injectProperties.surfaceInjectionRate);
well->setMaximumReservoirRate(injectProperties.reservoirInjectionRate);
well->setTargetBottomHolePressure(injectProperties.BHPLimit);
well->setMaximumSurfaceRate(controls.surface_rate);
well->setMaximumReservoirRate(controls.reservoir_rate);
well->setTargetBottomHolePressure(controls.bhp_limit);
// TODO
well->setTargetTubingHeadPressure(1e30);
//well->setTargetTubingHeadPressure(injectProperties.THPLimit);
//well->setTargetTubingHeadPressure(controls.thp_limit);
}
if (deckWell.isProducer( )) {
well->setWellType(Well::Producer);
const auto controls = deckWell.productionControls(summaryState);
const Opm::WellProductionProperties& producerProperties =
deckWell.getProductionProperties( );
switch (producerProperties.controlMode) {
switch (controls.cmode) {
case Opm::WellProducer::ORAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/0.0);
well->setMaximumSurfaceRate(producerProperties.OilRate);
well->setMaximumSurfaceRate(controls.oil_rate);
break;
case Opm::WellProducer::GRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/1.0, /*water=*/0.0);
well->setMaximumSurfaceRate(producerProperties.GasRate);
well->setMaximumSurfaceRate(controls.gas_rate);
break;
case Opm::WellProducer::WRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/0.0, /*gas=*/0.0, /*water=*/1.0);
well->setMaximumSurfaceRate(producerProperties.WaterRate);
well->setMaximumSurfaceRate(controls.water_rate);
break;
case Opm::WellProducer::LRAT:
well->setControlMode(Well::ControlMode::VolumetricSurfaceRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/0.0, /*water=*/1.0);
well->setMaximumSurfaceRate(producerProperties.LiquidRate);
well->setMaximumSurfaceRate(controls.liquid_rate);
break;
case Opm::WellProducer::CRAT:
@@ -289,7 +284,7 @@ public:
case Opm::WellProducer::RESV:
well->setControlMode(Well::ControlMode::VolumetricReservoirRate);
well->setVolumetricPhaseWeights(/*oil=*/1.0, /*gas=*/1.0, /*water=*/1.0);
well->setMaximumSurfaceRate(producerProperties.ResVRate);
well->setMaximumSurfaceRate(controls.resv_rate);
break;
case Opm::WellProducer::BHP:
@@ -312,11 +307,11 @@ public:
continue;
}
well->setTargetBottomHolePressure(producerProperties.BHPLimit);
well->setTargetBottomHolePressure(controls.bhp_limit);
// TODO
well->setTargetTubingHeadPressure(-1e30);
//well->setTargetTubingHeadPressure(producerProperties.THPLimit);
//well->setTargetTubingHeadPressure(controls.thp_limit);
}
}
}

View File

@@ -85,10 +85,10 @@ namespace Opm
inline void
historyRates(const PhaseUsage& pu,
const WellProductionProperties& p,
const ProductionControls& p,
std::vector<double>& rates)
{
assert (! p.predictionMode);
assert (! p.prediction_mode);
assert (rates.size() ==
std::vector<double>::size_type(pu.num_phases));
@@ -96,21 +96,21 @@ namespace Opm
const std::vector<double>::size_type
i = pu.phase_pos[ BlackoilPhases::Aqua ];
rates[i] = p.WaterRate;
rates[i] = p.water_rate;
}
if (pu.phase_used[ BlackoilPhases::Liquid ]) {
const std::vector<double>::size_type
i = pu.phase_pos[ BlackoilPhases::Liquid ];
rates[i] = p.OilRate;
rates[i] = p.oil_rate;
}
if (pu.phase_used[ BlackoilPhases::Vapour ]) {
const std::vector<double>::size_type
i = pu.phase_pos[ BlackoilPhases::Vapour ];
rates[i] = p.GasRate;
rates[i] = p.gas_rate;
}
}
} // namespace SimFIBODetails

View File

@@ -1590,28 +1590,29 @@ namespace Opm
*/
std::shared_ptr<WellsGroupInterface> createWellWellsGroup(const Well2& well, size_t timeStep, const PhaseUsage& phase_usage )
{
SummaryState summaryState;
InjectionSpecification injection_specification;
ProductionSpecification production_specification;
if (well.isInjector()) {
const WellInjectionProperties& properties = well.getInjectionProperties();
injection_specification.BHP_limit_ = properties.BHPLimit;
injection_specification.injector_type_ = toInjectorType(WellInjector::Type2String(properties.injectorType));
injection_specification.surface_flow_max_rate_ = properties.surfaceInjectionRate;
injection_specification.reservoir_flow_max_rate_ = properties.reservoirInjectionRate;
const auto controls = well.injectionControls(summaryState);
injection_specification.BHP_limit_ = controls.bhp_limit;
injection_specification.injector_type_ = toInjectorType(WellInjector::Type2String(controls.injector_type));
injection_specification.surface_flow_max_rate_ = controls.surface_rate;
injection_specification.reservoir_flow_max_rate_ = controls.reservoir_rate;
production_specification.guide_rate_ = 0.0; // We know we're not a producer
if (properties.controlMode != WellInjector::CMODE_UNDEFINED) {
injection_specification.control_mode_ = toInjectionControlMode(WellInjector::ControlMode2String(properties.controlMode));
if (controls.cmode != WellInjector::CMODE_UNDEFINED) {
injection_specification.control_mode_ = toInjectionControlMode(WellInjector::ControlMode2String(controls.cmode));
}
}
else if (well.isProducer()) {
const WellProductionProperties& properties = well.getProductionProperties();
production_specification.BHP_limit_ = properties.BHPLimit;
production_specification.reservoir_flow_max_rate_ = properties.ResVRate;
production_specification.oil_max_rate_ = properties.OilRate;
production_specification.water_max_rate_ = properties.WaterRate;
const auto controls = well.productionControls(summaryState);
production_specification.BHP_limit_ = controls.bhp_limit;
production_specification.reservoir_flow_max_rate_ = controls.resv_rate;
production_specification.oil_max_rate_ = controls.oil_rate;
production_specification.water_max_rate_ = controls.water_rate;
injection_specification.guide_rate_ = 0.0; // we know we're not an injector
if (properties.controlMode != WellProducer::CMODE_UNDEFINED) {
production_specification.control_mode_ = toProductionControlMode(WellProducer::ControlMode2String(properties.controlMode));
if (controls.cmode != WellProducer::CMODE_UNDEFINED) {
production_specification.control_mode_ = toProductionControlMode(WellProducer::ControlMode2String(controls.cmode));
}
}
// Efficiency factor given specified with WEFAC

View File

@@ -296,6 +296,7 @@ namespace Opm
const std::vector<int>& wells_on_proc) {
int well_index = 0;
auto well_on_proc = wells_on_proc.begin();
SummaryState summaryState;
for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter, ++well_on_proc) {
if( ! *well_on_proc )
@@ -318,15 +319,15 @@ namespace Opm
if (well.isInjector()) {
const WellInjectionProperties& injectionProperties = well.getInjectionProperties( );
const auto controls = well.injectionControls(summaryState);
int ok = 1;
int control_pos[5] = { -1, -1, -1, -1, -1 };
clear_well_controls(well_index, w_);
if (injectionProperties.hasInjectionControl(WellInjector::RATE)) {
if (controls.hasControl(WellInjector::RATE)) {
control_pos[WellsManagerDetail::InjectionControl::RATE] = well_controls_get_num(w_->ctrls[well_index]);
double distr[3] = { 0.0, 0.0, 0.0 };
WellInjector::TypeEnum injectorType = injectionProperties.injectorType;
WellInjector::TypeEnum injectorType = controls.injector_type;
if (injectorType == WellInjector::TypeEnum::WATER) {
distr[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0;
@@ -337,7 +338,7 @@ namespace Opm
}
ok = append_well_controls(SURFACE_RATE,
injectionProperties.surfaceInjectionRate,
controls.surface_rate,
invalid_alq,
invalid_vfp,
distr,
@@ -345,10 +346,10 @@ namespace Opm
w_);
}
if (ok && injectionProperties.hasInjectionControl(WellInjector::RESV)) {
if (ok && controls.hasControl(WellInjector::RESV)) {
control_pos[WellsManagerDetail::InjectionControl::RESV] = well_controls_get_num(w_->ctrls[well_index]);
double distr[3] = { 0.0, 0.0, 0.0 };
WellInjector::TypeEnum injectorType = injectionProperties.injectorType;
WellInjector::TypeEnum injectorType = controls.injector_type;
if (injectorType == WellInjector::TypeEnum::WATER) {
distr[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0;
@@ -359,7 +360,7 @@ namespace Opm
}
ok = append_well_controls(RESERVOIR_RATE,
injectionProperties.reservoirInjectionRate,
controls.reservoir_rate,
invalid_alq,
invalid_vfp,
distr,
@@ -367,10 +368,10 @@ namespace Opm
w_);
}
if (ok && injectionProperties.hasInjectionControl(WellInjector::BHP)) {
if (ok && controls.hasControl(WellInjector::BHP)) {
control_pos[WellsManagerDetail::InjectionControl::BHP] = well_controls_get_num(w_->ctrls[well_index]);
ok = append_well_controls(BHP,
injectionProperties.BHPLimit,
controls.bhp_limit,
invalid_alq,
invalid_vfp,
NULL,
@@ -378,10 +379,10 @@ namespace Opm
w_);
}
if (ok && injectionProperties.hasInjectionControl(WellInjector::THP)) {
if (ok && controls.hasControl(WellInjector::THP)) {
control_pos[WellsManagerDetail::InjectionControl::THP] = well_controls_get_num(w_->ctrls[well_index]);
const double thp_limit = injectionProperties.THPLimit;
const int vfp_number = injectionProperties.VFPTableNumber;
const double thp_limit = controls.thp_limit;
const int vfp_number = controls.vfp_table_number;
ok = append_well_controls(THP,
thp_limit,
invalid_alq,
@@ -395,8 +396,8 @@ namespace Opm
OPM_THROW(std::runtime_error, "Failure occured appending controls for well " << well_names[well_index]);
}
if (injectionProperties.controlMode != WellInjector::CMODE_UNDEFINED) {
WellsManagerDetail::InjectionControl::Mode mode = WellsManagerDetail::InjectionControl::mode( injectionProperties.controlMode );
if (controls.cmode != WellInjector::CMODE_UNDEFINED) {
WellsManagerDetail::InjectionControl::Mode mode = WellsManagerDetail::InjectionControl::mode(controls.cmode);
int cpos = control_pos[mode];
if (cpos == -1 && mode != WellsManagerDetail::InjectionControl::GRUP) {
OPM_THROW(std::runtime_error, "Control not specified in well " << well_names[well_index]);
@@ -408,7 +409,7 @@ namespace Opm
// Set well component fraction.
double cf[3] = { 0.0, 0.0, 0.0 };
{
WellInjector::TypeEnum injectorType = injectionProperties.injectorType;
WellInjector::TypeEnum injectorType = controls.injector_type;
if (injectorType == WellInjector::WATER) {
if (!phaseUsage.phase_used[BlackoilPhases::Aqua]) {
@@ -434,12 +435,12 @@ namespace Opm
// Add all controls that are present in well.
// First we must clear existing controls, in case the
// current WCONPROD line is modifying earlier controls.
const WellProductionProperties& productionProperties = well.getProductionProperties( );
const auto controls = well.productionControls(summaryState);
int control_pos[9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1 };
int ok = 1;
clear_well_controls(well_index, w_);
if (ok && productionProperties.hasProductionControl(WellProducer::ORAT)) {
if (ok && controls.hasControl(WellProducer::ORAT)) {
if (!phaseUsage.phase_used[BlackoilPhases::Liquid]) {
OPM_THROW(std::runtime_error, "Oil phase not active and ORAT control specified.");
}
@@ -448,7 +449,7 @@ namespace Opm
double distr[3] = { 0.0, 0.0, 0.0 };
distr[phaseUsage.phase_pos[BlackoilPhases::Liquid]] = 1.0;
ok = append_well_controls(SURFACE_RATE,
-productionProperties.OilRate,
-controls.oil_rate,
invalid_alq,
invalid_vfp,
distr,
@@ -456,7 +457,7 @@ namespace Opm
w_);
}
if (ok && productionProperties.hasProductionControl(WellProducer::WRAT)) {
if (ok && controls.hasControl(WellProducer::WRAT)) {
if (!phaseUsage.phase_used[BlackoilPhases::Aqua]) {
OPM_THROW(std::runtime_error, "Water phase not active and WRAT control specified.");
}
@@ -464,7 +465,7 @@ namespace Opm
double distr[3] = { 0.0, 0.0, 0.0 };
distr[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0;
ok = append_well_controls(SURFACE_RATE,
-productionProperties.WaterRate,
-controls.water_rate,
invalid_alq,
invalid_vfp,
distr,
@@ -472,7 +473,7 @@ namespace Opm
w_);
}
if (ok && productionProperties.hasProductionControl(WellProducer::GRAT)) {
if (ok && controls.hasControl(WellProducer::GRAT)) {
if (!phaseUsage.phase_used[BlackoilPhases::Vapour]) {
OPM_THROW(std::runtime_error, "Gas phase not active and GRAT control specified.");
}
@@ -480,7 +481,7 @@ namespace Opm
double distr[3] = { 0.0, 0.0, 0.0 };
distr[phaseUsage.phase_pos[BlackoilPhases::Vapour]] = 1.0;
ok = append_well_controls(SURFACE_RATE,
-productionProperties.GasRate,
-controls.gas_rate,
invalid_alq,
invalid_vfp,
distr,
@@ -488,7 +489,7 @@ namespace Opm
w_);
}
if (ok && productionProperties.hasProductionControl(WellProducer::LRAT)) {
if (ok && controls.hasControl(WellProducer::LRAT)) {
if (!phaseUsage.phase_used[BlackoilPhases::Aqua]) {
OPM_THROW(std::runtime_error, "Water phase not active and LRAT control specified.");
}
@@ -500,7 +501,7 @@ namespace Opm
distr[phaseUsage.phase_pos[BlackoilPhases::Aqua]] = 1.0;
distr[phaseUsage.phase_pos[BlackoilPhases::Liquid]] = 1.0;
ok = append_well_controls(SURFACE_RATE,
-productionProperties.LiquidRate,
-controls.liquid_rate,
invalid_alq,
invalid_vfp,
distr,
@@ -508,11 +509,11 @@ namespace Opm
w_);
}
if (ok && productionProperties.hasProductionControl(WellProducer::RESV)) {
if (ok && controls.hasControl(WellProducer::RESV)) {
control_pos[WellsManagerDetail::ProductionControl::RESV] = well_controls_get_num(w_->ctrls[well_index]);
double distr[3] = { 1.0, 1.0, 1.0 };
ok = append_well_controls(RESERVOIR_RATE,
-productionProperties.ResVRate,
-controls.resv_rate,
invalid_alq,
invalid_vfp,
distr,
@@ -520,10 +521,10 @@ namespace Opm
w_);
}
if (ok && productionProperties.hasProductionControl(WellProducer::THP)) {
const double thp_limit = productionProperties.THPLimit;
const double alq_value = productionProperties.ALQValue;
const int vfp_number = productionProperties.VFPTableNumber;
if (ok && controls.hasControl(WellProducer::THP)) {
const double thp_limit = controls.thp_limit;
const double alq_value = controls.alq_value;
const int vfp_number = controls.vfp_table_number;
control_pos[WellsManagerDetail::ProductionControl::THP] = well_controls_get_num(w_->ctrls[well_index]);
ok = append_well_controls(THP,
thp_limit,
@@ -535,7 +536,7 @@ namespace Opm
}
if (ok) {
const double bhp_limit = productionProperties.BHPLimit;
const double bhp_limit = controls.bhp_limit;
control_pos[WellsManagerDetail::ProductionControl::BHP] = well_controls_get_num(w_->ctrls[well_index]);
ok = append_well_controls(BHP,
bhp_limit,
@@ -550,8 +551,8 @@ namespace Opm
OPM_THROW(std::runtime_error, "Failure occured appending controls for well " << well_names[well_index]);
}
if (productionProperties.controlMode != WellProducer::CMODE_UNDEFINED) {
WellsManagerDetail::ProductionControl::Mode mode = WellsManagerDetail::ProductionControl::mode(productionProperties.controlMode);
if (controls.cmode != WellProducer::CMODE_UNDEFINED) {
WellsManagerDetail::ProductionControl::Mode mode = WellsManagerDetail::ProductionControl::mode(controls.cmode);
int cpos = control_pos[mode];
if (cpos == -1 && mode != WellsManagerDetail::ProductionControl::GRUP) {
OPM_THROW(std::runtime_error, "Control mode type " << mode << " not present in well " << well_names[well_index]);

View File

@@ -1648,6 +1648,7 @@ namespace Opm {
{
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells());
Opm::SummaryState summaryState;
int global_number_resv_wells = resv_wells.size();
global_number_resv_wells = ebosSimulator_.gridView().comm().sum(global_number_resv_wells);
@@ -1700,10 +1701,10 @@ namespace Opm {
OPM_DEFLOG_THROW(std::logic_error, "Failed to find the well " << wells()->name[*rp] << " in wmap.", deferred_logger);
}
const auto& wp = i->second;
const WellProductionProperties& production_properties = wp.getProductionProperties();
const auto production_controls = wp.productionControls(summaryState);
// historical phase rates
std::vector<double> hrates(np);
SimFIBODetails::historyRates(phase_usage_, production_properties, hrates);
SimFIBODetails::historyRates(phase_usage_, production_controls, hrates);
std::vector<double> hrates_resv(np);
rateConverter_->calcReservoirVoidageRates(fipreg, pvtreg, hrates, hrates_resv);

View File

@@ -487,7 +487,7 @@ namespace Opm
)
{
// TODO: only_wells should be put back to save some computation
Opm::SummaryState summaryState;
checkWellOperability(ebosSimulator, well_state, deferred_logger);
if (!this->isOperable()) return;
@@ -605,8 +605,11 @@ namespace Opm
// change temperature for injecting fluids
if (well_type_ == INJECTOR && cq_s[activeCompIdx] > 0.0){
const auto& injProps = this->well_ecl_.getInjectionProperties();
fs.setTemperature(injProps.temperature);
const auto controls = this->well_ecl_.injectionControls(summaryState);
// only handles single phase injection now
assert(controls.injector_type != WellInjector::MULTI);
fs.setTemperature(controls.temperature);
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
typename FluidSystem::template ParameterCache<FsScalar> paramCache;
const unsigned pvtRegionIdx = intQuants.pvtRegionIndex();
@@ -749,8 +752,6 @@ namespace Opm
{
const double target_rate = well_controls_get_current_target(well_controls_); // surface rate target
if (well_type_ == INJECTOR) {
// only handles single phase injection now
assert(well_ecl_.getInjectionProperties().injectorType != WellInjector::MULTI);
control_eq = getWQTotal() - target_rate;
} else if (well_type_ == PRODUCER) {
if (target_rate != 0.) {
@@ -795,7 +796,6 @@ namespace Opm
const double target_rate = well_controls_get_current_target(well_controls_); // reservoir rate target
if (well_type_ == INJECTOR) {
// only handles single phase injection now
assert(well_ecl_.getInjectionProperties().injectorType != WellInjector::MULTI);
const double* distr = well_controls_get_current_distr(well_controls_);
for (int phase = 0; phase < number_of_phases_; ++phase) {
if (distr[phase] > 0.0) {
@@ -2663,6 +2663,7 @@ namespace Opm
{
assert(int(rates.size()) == 3); // the vfp related only supports three phases now.
SummaryState summaryState;
const double aqua = rates[Water];
const double liquid = rates[Oil];
const double vapour = rates[Gas];
@@ -2672,15 +2673,17 @@ namespace Opm
double thp = 0.0;
if (well_type_ == INJECTOR) {
const int table_id = well_ecl_.getInjectionProperties().VFPTableNumber;
const auto controls = well_ecl_.injectionControls(summaryState);
const int table_id = controls.vfp_table_number;
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(table_id)->getDatumDepth();
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);
thp = vfp_properties_->getInj()->thp(table_id, aqua, liquid, vapour, bhp + dp);
}
else if (well_type_ == PRODUCER) {
const int table_id = well_ecl_.getProductionProperties().VFPTableNumber;
const double alq = well_ecl_.getProductionProperties().ALQValue;
const auto controls = well_ecl_.productionControls(summaryState);
const int table_id = controls.vfp_table_number;
const double alq = controls.alq_value;
const double vfp_ref_depth = vfp_properties_->getProd()->getTable(table_id)->getDatumDepth();
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);

View File

@@ -449,6 +449,7 @@ namespace Opm
WellState& well_state,
Opm::DeferredLogger& deferred_logger)
{
SummaryState summaryState;
checkWellOperability(ebosSimulator, well_state, deferred_logger);
@@ -564,7 +565,11 @@ namespace Opm
// change temperature for injecting fluids
if (well_type_ == INJECTOR && cq_s[activeCompIdx] > 0.0){
const auto& injProps = this->well_ecl_.getInjectionProperties();
const auto& injProps = this->well_ecl_.injectionControls(summaryState);
// only handles single phase injection now
assert(injProps.injector_type != WellInjector::MULTI);
fs.setTemperature(injProps.temperature);
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
typename FluidSystem::template ParameterCache<FsScalar> paramCache;
@@ -695,8 +700,6 @@ namespace Opm
{
const double target_rate = well_controls_get_current_target(well_controls_); // surface rate target
if (well_type_ == INJECTOR) {
// only handles single phase injection now
assert(well_ecl_.getInjectionProperties().injectorType != WellInjector::MULTI);
control_eq = getWQTotal() - target_rate;
} else if (well_type_ == PRODUCER) {
if (target_rate != 0.) {
@@ -740,8 +743,6 @@ namespace Opm
{
const double target_rate = well_controls_get_current_target(well_controls_); // reservoir rate target
if (well_type_ == INJECTOR) {
// only handles single phase injection now
assert(well_ecl_.getInjectionProperties().injectorType != WellInjector::MULTI);
const double* distr = well_controls_get_current_distr(well_controls_);
for (int phase = 0; phase < number_of_phases_; ++phase) {
if (distr[phase] > 0.0) {
@@ -2557,6 +2558,7 @@ namespace Opm
{
assert(int(rates.size()) == 3); // the vfp related only supports three phases now.
SummaryState summaryState;
const double aqua = rates[Water];
const double liquid = rates[Oil];
const double vapour = rates[Gas];
@@ -2566,15 +2568,16 @@ namespace Opm
double thp = 0.0;
if (well_type_ == INJECTOR) {
const int table_id = well_ecl_.getInjectionProperties().VFPTableNumber;
const int table_id = well_ecl_.injectionControls(summaryState).vfp_table_number;
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(table_id)->getDatumDepth();
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);
thp = vfp_properties_->getInj()->thp(table_id, aqua, liquid, vapour, bhp + dp);
}
else if (well_type_ == PRODUCER) {
const int table_id = well_ecl_.getProductionProperties().VFPTableNumber;
const double alq = well_ecl_.getProductionProperties().ALQValue;
const auto controls = well_ecl_.productionControls(summaryState);
const int table_id = controls.vfp_table_number;
const double alq = controls.alq_value;
const double vfp_ref_depth = vfp_properties_->getProd()->getTable(table_id)->getDatumDepth();
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);

View File

@@ -284,8 +284,9 @@ namespace Opm
return 0.0;
}
WellInjectionProperties injection = well_ecl_.getInjectionProperties();
if (injection.injectorType == WellInjector::GAS) {
SummaryState summaryState;
const auto controls = well_ecl_.injectionControls(summaryState);
if (controls.injector_type == WellInjector::GAS) {
double solvent_fraction = well_ecl_.getSolventFraction();
return solvent_fraction;
} else {
@@ -307,10 +308,11 @@ namespace Opm
return 0.0;
}
WellInjectionProperties injection = well_ecl_.getInjectionProperties();
SummaryState summaryState;
const auto controls = well_ecl_.injectionControls(summaryState);
WellPolymerProperties polymer = well_ecl_.getPolymerProperties();
if (injection.injectorType == WellInjector::WATER) {
if (controls.injector_type == WellInjector::WATER) {
const double polymer_injection_concentration = polymer.m_polymerConcentration;
return polymer_injection_concentration;
} else {
@@ -518,20 +520,7 @@ namespace Opm
WellInterface<TypeTag>::
underPredictionMode(Opm::DeferredLogger& deferred_logger) const
{
bool under_prediction_mode = false;
switch( well_type_ ) {
case PRODUCER:
under_prediction_mode = well_ecl_.getProductionProperties().predictionMode;
break;
case INJECTOR:
under_prediction_mode = well_ecl_.getInjectionProperties().predictionMode;
break;
default:
OPM_DEFLOG_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type for well " << name(), deferred_logger);
}
return under_prediction_mode;
return well_ecl_.predictionMode();
}
@@ -1130,9 +1119,11 @@ namespace Opm
// we need to get the table number through the parser, in case THP constraint/target is not there.
// When THP control/limit is not active, if available VFP table is provided, we will still need to
// update THP value. However, it will only used for output purpose.
SummaryState summaryState;
if (well_type_ == PRODUCER) { // producer
const int table_id = well_ecl_.getProductionProperties().VFPTableNumber;
const auto controls = well_ecl_.productionControls(summaryState);
const int table_id = controls.vfp_table_number;
if (table_id <= 0) {
return false;
} else {
@@ -1145,7 +1136,8 @@ namespace Opm
}
} else { // injector
const int table_id = well_ecl_.getInjectionProperties().VFPTableNumber;
const auto controls = well_ecl_.injectionControls(summaryState);
const int table_id = controls.vfp_table_number;
if (table_id <= 0) {
return false;
} else {

View File

@@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
const Opm::Runspec runspec (deck);
const Schedule sched(deck, grid, eclipseProperties, runspec);
SummaryState summaryState;
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
auto wells = sched.getWells2atEnd();
@@ -62,18 +62,18 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
std::shared_ptr<WellsGroupInterface> wellsGroup = createWellWellsGroup(well, 2, pu);
BOOST_CHECK_EQUAL(well.name(), wellsGroup->name());
if (well.isInjector()) {
const WellInjectionProperties& properties = well.getInjectionProperties();
BOOST_CHECK_EQUAL(properties.surfaceInjectionRate, wellsGroup->injSpec().surface_flow_max_rate_);
BOOST_CHECK_EQUAL(properties.BHPLimit, wellsGroup->injSpec().BHP_limit_);
BOOST_CHECK_EQUAL(properties.reservoirInjectionRate, wellsGroup->injSpec().reservoir_flow_max_rate_);
const auto controls = well.injectionControls(summaryState);
BOOST_CHECK_EQUAL(controls.surface_rate, wellsGroup->injSpec().surface_flow_max_rate_);
BOOST_CHECK_EQUAL(controls.bhp_limit, wellsGroup->injSpec().BHP_limit_);
BOOST_CHECK_EQUAL(controls.reservoir_rate, wellsGroup->injSpec().reservoir_flow_max_rate_);
BOOST_CHECK_EQUAL(0.0, wellsGroup->prodSpec().guide_rate_);
}
if (well.isProducer()) {
const WellProductionProperties& properties = well.getProductionProperties();
BOOST_CHECK_EQUAL(properties.ResVRate, wellsGroup->prodSpec().reservoir_flow_max_rate_);
BOOST_CHECK_EQUAL(properties.BHPLimit, wellsGroup->prodSpec().BHP_limit_);
BOOST_CHECK_EQUAL(properties.OilRate, wellsGroup->prodSpec().oil_max_rate_);
BOOST_CHECK_EQUAL(properties.WaterRate, wellsGroup->prodSpec().water_max_rate_);
const auto controls = well.productionControls(summaryState);
BOOST_CHECK_EQUAL(controls.resv_rate, wellsGroup->prodSpec().reservoir_flow_max_rate_);
BOOST_CHECK_EQUAL(controls.bhp_limit, wellsGroup->prodSpec().BHP_limit_);
BOOST_CHECK_EQUAL(controls.oil_rate, wellsGroup->prodSpec().oil_max_rate_);
BOOST_CHECK_EQUAL(controls.water_rate, wellsGroup->prodSpec().water_max_rate_);
BOOST_CHECK_EQUAL(0.0, wellsGroup->injSpec().guide_rate_);
}
}