Additional changes to accomodate for loop over several wells beloning to

either a group or the field in generation of the group or field production or
injection potential rates
This commit is contained in:
Jostein Alvestad
2018-12-07 09:23:01 +01:00
parent 3429db8fc1
commit a4d0bb685b

View File

@@ -655,7 +655,7 @@ quantity region_rate( const fn_args& args ) {
return { -sum, rate_unit< phase >() };
}
template < rt phase, bool outputProducer = true, bool outputInjector = true>
/*template < rt phase, bool outputProducer = true, bool outputInjector = true>
quantity generic_well_rate (const fn_args& args ) {
const quantity zero = { 0, rate_unit< phase >() };
if( args.schedule_wells.empty() ) return zero;
@@ -669,6 +669,26 @@ quantity generic_well_rate (const fn_args& args ) {
return p->second.rates.has(phase) ? quantity {p->second.rates.get(phase), rate_unit<phase>()} : zero;
//return { p->second.rates.get(phase), rate_unit< phase >() };
}*/
template < rt phase, bool outputProducer = true, bool outputInjector = true>
inline quantity generic_potential_rate( const fn_args& args ) {
double sum = 0.0;
for( const auto* sched_well : args.schedule_wells ) {
const auto& name = sched_well->name();
if( args.wells.count( name ) == 0 ) continue;
if (sched_well->isInjector(args.sim_step) && outputInjector) {
const auto v = args.wells.at(name).rates.get(phase, 0.0);
sum += v;
}
else if (sched_well->isProducer(args.sim_step) && outputProducer) {
const auto v = args.wells.at(name).rates.get(phase, 0.0);
sum += v;
}
}
return { sum, rate_unit< phase >() };
}
template< typename F, typename G >
@@ -787,12 +807,12 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "GVPT", mul( sum( sum( rate< rt::reservoir_water, producer >, rate< rt::reservoir_oil, producer > ),
rate< rt::reservoir_gas, producer > ), duration ) },
// Group potential
{ "GWPP", generic_well_rate< rt::well_potential_water , true, false>},
{ "GOPP", generic_well_rate< rt::well_potential_oil , true, false>},
{ "GGPP", generic_well_rate< rt::well_potential_gas , true, false>},
{ "GWPI", generic_well_rate< rt::well_potential_water , false, true>},
{ "GOPI", generic_well_rate< rt::well_potential_oil , false, true>},
{ "GGPI", generic_well_rate< rt::well_potential_gas , false, true>},
{ "GWPP", generic_potential_rate< rt::well_potential_water , true, false>},
{ "GOPP", generic_potential_rate< rt::well_potential_oil , true, false>},
{ "GGPP", generic_potential_rate< rt::well_potential_gas , true, false>},
{ "GWPI", generic_potential_rate< rt::well_potential_water , false, true>},
{ "GOPI", generic_potential_rate< rt::well_potential_oil , false, true>},
{ "GGPI", generic_potential_rate< rt::well_potential_gas , false, true>},
{ "WWPRH", production_history< Phase::WATER > },
{ "WOPRH", production_history< Phase::OIL > },
@@ -934,12 +954,12 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "FVIT", mul( sum( sum( rate< rt::reservoir_water, injector>, rate< rt::reservoir_oil, injector >),
rate< rt::reservoir_gas, injector>), duration)},
// Field potential
{ "FWPP", generic_well_rate< rt::well_potential_water , true, false>},
{ "FOPP", generic_well_rate< rt::well_potential_oil , true, false>},
{ "FGPP", generic_well_rate< rt::well_potential_gas , true, false>},
{ "FWPI", generic_well_rate< rt::well_potential_water , false, true>},
{ "FOPI", generic_well_rate< rt::well_potential_oil , false, true>},
{ "FGPI", generic_well_rate< rt::well_potential_gas , false, true>},
{ "FWPP", generic_potential_rate< rt::well_potential_water , true, false>},
{ "FOPP", generic_potential_rate< rt::well_potential_oil , true, false>},
{ "FGPP", generic_potential_rate< rt::well_potential_gas , true, false>},
{ "FWPI", generic_potential_rate< rt::well_potential_water , false, true>},
{ "FOPI", generic_potential_rate< rt::well_potential_oil , false, true>},
{ "FGPI", generic_potential_rate< rt::well_potential_gas , false, true>},
{ "FWPRH", production_history< Phase::WATER > },
@@ -997,17 +1017,17 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "SGFR", srate< rt::gas > },
{ "SPR", spr },
// Well productivity index
{ "WPIW", generic_well_rate< rt::productivity_index_water >},
{ "WPIO", generic_well_rate< rt::productivity_index_oil >},
{ "WPIG", generic_well_rate< rt::productivity_index_gas >},
{ "WPIL", sum( generic_well_rate< rt::productivity_index_water >, generic_well_rate< rt::productivity_index_oil>)},
{ "WPIW", generic_potential_rate< rt::productivity_index_water >},
{ "WPIO", generic_potential_rate< rt::productivity_index_oil >},
{ "WPIG", generic_potential_rate< rt::productivity_index_gas >},
{ "WPIL", sum( generic_potential_rate< rt::productivity_index_water >, generic_potential_rate< rt::productivity_index_oil>)},
// Well potential
{ "WWPP", generic_well_rate< rt::well_potential_water , true, false>},
{ "WOPP", generic_well_rate< rt::well_potential_oil , true, false>},
{ "WGPP", generic_well_rate< rt::well_potential_gas , true, false>},
{ "WWPI", generic_well_rate< rt::well_potential_water , false, true>},
{ "WOPI", generic_well_rate< rt::well_potential_oil , false, true>},
{ "WGPI", generic_well_rate< rt::well_potential_gas , false, true>},
{ "WWPP", generic_potential_rate< rt::well_potential_water , true, false>},
{ "WOPP", generic_potential_rate< rt::well_potential_oil , true, false>},
{ "WGPP", generic_potential_rate< rt::well_potential_gas , true, false>},
{ "WWPI", generic_potential_rate< rt::well_potential_water , false, true>},
{ "WOPI", generic_potential_rate< rt::well_potential_oil , false, true>},
{ "WGPI", generic_potential_rate< rt::well_potential_gas , false, true>},
};