Count of abondoned wells should handle both STOP and SHUT

This commit is contained in:
Joakim Hove 2020-10-14 15:58:44 +02:00
parent 6e82f3cb7a
commit a2f72f0953
3 changed files with 28 additions and 28 deletions

View File

@ -50,6 +50,7 @@
#include <opm/output/eclipse/RegionCache.hpp> #include <opm/output/eclipse/RegionCache.hpp>
#include <fmt/format.h>
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <cassert> #include <cassert>
@ -738,39 +739,31 @@ inline quantity injection_history( const fn_args& args ) {
return { sum, rate_unit< phase >() }; return { sum, rate_unit< phase >() };
} }
inline quantity abondoned_injectors( const fn_args& args ) { template< bool injection >
inline quantity abondoned_well( const fn_args& args ) {
std::size_t count = 0; std::size_t count = 0;
for (const auto& sched_well : args.schedule_wells) { for (const auto& sched_well : args.schedule_wells) {
if (sched_well.hasInjected()) { if (injection && !sched_well.hasInjected())
const auto& well_name = sched_well.name();
auto well_iter = args.wells.find( well_name );
if (well_iter == args.wells.end())
continue; continue;
count += !well_iter->second.flowing(); if (!injection && !sched_well.hasProduced())
continue;
const auto& well_name = sched_well.name();
auto well_iter = args.wells.find( well_name );
if (well_iter == args.wells.end()) {
count += 1;
continue;
} }
count += !well_iter->second.flowing();
} }
return { 1.0 * count, measure::identity }; return { 1.0 * count, measure::identity };
} }
inline quantity abondoned_producers( const fn_args& args ) {
std::size_t count = 0;
for (const auto& sched_well : args.schedule_wells) {
if (sched_well.hasProduced()) {
const auto& well_name = sched_well.name();
auto well_iter = args.wells.find( well_name );
if (well_iter == args.wells.end())
continue;
count += !well_iter->second.flowing();
}
}
return { 1.0 * count, measure::identity };
}
inline quantity res_vol_production_target( const fn_args& args ) { inline quantity res_vol_production_target( const fn_args& args ) {
@ -1379,8 +1372,8 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "FMWIN", flowing< injector > }, { "FMWIN", flowing< injector > },
{ "FMWPR", flowing< producer > }, { "FMWPR", flowing< producer > },
{ "FVPRT", res_vol_production_target }, { "FVPRT", res_vol_production_target },
{ "FMWPA", abondoned_producers }, { "FMWPA", abondoned_well< producer > },
{ "FMWIA", abondoned_injectors }, { "FMWIA", abondoned_well< injector >},
//Field control mode //Field control mode
{ "FMCTP", group_control< false, true, false, false >}, { "FMCTP", group_control< false, true, false, false >},

View File

@ -455,7 +455,7 @@ TSTEP
WELOPEN WELOPEN
'RFTP' 'SHUT' / 'RFTP' 'SHUT' /
'RFTI' 'SHUT' / 'RFTI' 'STOP' /
/ /
TSTEP TSTEP

View File

@ -56,11 +56,16 @@ double prod_rft(const EclipseState& es, const Schedule& /* sched */, const Summ
return -units.to_si(UnitSystem::measure::rate, 0.0); return -units.to_si(UnitSystem::measure::rate, 0.0);
} }
double inj_rft(const EclipseState& es, const Schedule& /* sched */, const SummaryState&, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) { double inj_rfti(const EclipseState& es, const Schedule& /* sched */, const SummaryState&, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) {
const auto& units = es.getUnits(); const auto& units = es.getUnits();
return units.to_si(UnitSystem::measure::rate, 0.0); return units.to_si(UnitSystem::measure::rate, 0.0);
} }
double inj_inj(const EclipseState& es, const Schedule& /* sched */, const SummaryState&, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) {
const auto& units = es.getUnits();
return units.to_si(UnitSystem::measure::rate, 100);
}
void pressure(const EclipseState& es, const Schedule& /* sched */, data::Solution& sol, size_t /* report_step */, double seconds_elapsed) { void pressure(const EclipseState& es, const Schedule& /* sched */, data::Solution& sol, size_t /* report_step */, double seconds_elapsed) {
const auto& grid = es.getInputGrid(); const auto& grid = es.getInputGrid();
const auto& units = es.getUnits(); const auto& units = es.getUnits();
@ -90,7 +95,8 @@ BOOST_AUTO_TEST_CASE(RUN) {
msim.well_rate("PROD", data::Rates::opt::oil, prod_opr); msim.well_rate("PROD", data::Rates::opt::oil, prod_opr);
msim.well_rate("RFTP", data::Rates::opt::oil, prod_rft); msim.well_rate("RFTP", data::Rates::opt::oil, prod_rft);
msim.well_rate("RFTI", data::Rates::opt::wat, inj_rft); msim.well_rate("RFTI", data::Rates::opt::wat, inj_rfti);
msim.well_rate("INJ", data::Rates::opt::gas, inj_inj);
msim.solution("PRESSURE", pressure); msim.solution("PRESSURE", pressure);
{ {
const WorkArea work_area("test_msim"); const WorkArea work_area("test_msim");
@ -128,6 +134,7 @@ BOOST_AUTO_TEST_CASE(RUN) {
BOOST_CHECK_EQUAL( fmwpa[0], 0.0 ); BOOST_CHECK_EQUAL( fmwpa[0], 0.0 );
BOOST_CHECK_EQUAL( fmwia[0], 0.0 ); BOOST_CHECK_EQUAL( fmwia[0], 0.0 );
// The RFTP /RFTI wells will appear as an abondoned well. // The RFTP /RFTI wells will appear as an abondoned well.
BOOST_CHECK_EQUAL( fmwpa[dates.size() - 1], 1.0 ); BOOST_CHECK_EQUAL( fmwpa[dates.size() - 1], 1.0 );
BOOST_CHECK_EQUAL( fmwia[dates.size() - 1], 1.0 ); BOOST_CHECK_EQUAL( fmwia[dates.size() - 1], 1.0 );