Add output of well phase potential

This commit is contained in:
Tor Harald Sandve 2018-11-07 09:14:06 +01:00
parent 089b58f101
commit 5d3125c532
3 changed files with 62 additions and 8 deletions

View File

@ -61,6 +61,9 @@ namespace Opm {
productivity_index_water = (1 << 11), productivity_index_water = (1 << 11),
productivity_index_oil = (1 << 12), productivity_index_oil = (1 << 12),
productivity_index_gas = (1 << 13), productivity_index_gas = (1 << 13),
well_potential_water = (1 << 14),
well_potential_oil = (1 << 15),
well_potential_gas = (1 << 16),
}; };
using enum_size = std::underlying_type< opt >::type; using enum_size = std::underlying_type< opt >::type;
@ -107,6 +110,9 @@ namespace Opm {
double productivity_index_water = 0.0; double productivity_index_water = 0.0;
double productivity_index_oil = 0.0; double productivity_index_oil = 0.0;
double productivity_index_gas = 0.0; double productivity_index_gas = 0.0;
double well_potential_water = 0.0;
double well_potential_oil = 0.0;
double well_potential_gas = 0.0;
}; };
struct Connection { struct Connection {
@ -272,6 +278,9 @@ namespace Opm {
case opt::productivity_index_water: return this->productivity_index_water; case opt::productivity_index_water: return this->productivity_index_water;
case opt::productivity_index_oil: return this->productivity_index_oil; case opt::productivity_index_oil: return this->productivity_index_oil;
case opt::productivity_index_gas: return this->productivity_index_gas; case opt::productivity_index_gas: return this->productivity_index_gas;
case opt::well_potential_water: return this->well_potential_water;
case opt::well_potential_oil: return this->well_potential_oil;
case opt::well_potential_gas: return this->well_potential_gas;
} }
throw std::invalid_argument( throw std::invalid_argument(
@ -312,6 +321,9 @@ namespace Opm {
buffer.write(this->productivity_index_water); buffer.write(this->productivity_index_water);
buffer.write(this->productivity_index_oil); buffer.write(this->productivity_index_oil);
buffer.write(this->productivity_index_gas); buffer.write(this->productivity_index_gas);
buffer.write(this->well_potential_water);
buffer.write(this->well_potential_oil);
buffer.write(this->well_potential_gas);
} }
template <class MessageBufferType> template <class MessageBufferType>
@ -373,6 +385,9 @@ namespace Opm {
buffer.read(this->productivity_index_water); buffer.read(this->productivity_index_water);
buffer.read(this->productivity_index_oil); buffer.read(this->productivity_index_oil);
buffer.read(this->productivity_index_gas); buffer.read(this->productivity_index_gas);
buffer.read(this->well_potential_water);
buffer.read(this->well_potential_oil);
buffer.read(this->well_potential_gas);
} }
template <class MessageBufferType> template <class MessageBufferType>

View File

@ -349,6 +349,15 @@ measure rate_unit < rt::productivity_index_oil > () { return measure::liquid_pro
template<> constexpr template<> constexpr
measure rate_unit < rt::productivity_index_gas > () { return measure::gas_productivity_index; } measure rate_unit < rt::productivity_index_gas > () { return measure::gas_productivity_index; }
template<> constexpr
measure rate_unit< rt::well_potential_water >() { return measure::liquid_surface_rate; }
template<> constexpr
measure rate_unit< rt::well_potential_oil >() { return measure::liquid_surface_rate; }
template<> constexpr
measure rate_unit< rt::well_potential_gas >() { return measure::gas_surface_rate; }
double efac( const std::vector<std::pair<std::string,double>>& eff_factors, const std::string& name ) { double efac( const std::vector<std::pair<std::string,double>>& eff_factors, const std::string& name ) {
auto it = std::find_if( eff_factors.begin(), eff_factors.end(), auto it = std::find_if( eff_factors.begin(), eff_factors.end(),
[&] ( const std::pair< std::string, double > elem ) [&] ( const std::pair< std::string, double > elem )
@ -662,16 +671,21 @@ quantity region_rate( const fn_args& args ) {
return { -sum, rate_unit< phase >() }; return { -sum, rate_unit< phase >() };
} }
template < rt phase> template < rt phase, bool outputProducer = true, bool outputInjector = true>
quantity pi (const fn_args& args ) { quantity generic_well_rate (const fn_args& args ) {
const quantity zero = { 0, rate_unit< phase >() }; const quantity zero = { 0, rate_unit< phase >() };
if( args.schedule_wells.empty() ) return zero; if( args.schedule_wells.empty() ) return zero;
const auto p = args.wells.find( args.schedule_wells.front()->name() ); const auto p = args.wells.find( args.schedule_wells.front()->name() );
if( p == args.wells.end() ) return zero; if( p == args.wells.end() ) return zero;
std::cout << p->second.rates.get(phase) << std::endl;
if (args.schedule_wells.front()->isInjector(args.sim_step) && !outputInjector) return zero;
if (args.schedule_wells.front()->isProducer(args.sim_step) && !outputProducer) return zero;
return { p->second.rates.get(phase), rate_unit< phase >() }; return { p->second.rates.get(phase), rate_unit< phase >() };
} }
template< typename F, typename G > template< typename F, typename G >
auto mul( F f, G g ) -> bin_op< F, G, std::multiplies< quantity > > auto mul( F f, G g ) -> bin_op< F, G, std::multiplies< quantity > >
{ return { f, g }; } { return { f, g }; }
@ -982,11 +996,18 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "SWFR", srate< rt::wat > }, { "SWFR", srate< rt::wat > },
{ "SGFR", srate< rt::gas > }, { "SGFR", srate< rt::gas > },
{ "SPR", spr }, { "SPR", spr },
// Well PI // Well productivity index
{ "WPIW", pi< rt::productivity_index_water >}, { "WPIW", generic_well_rate< rt::productivity_index_water >},
{ "WPIO", pi< rt::productivity_index_oil >}, { "WPIO", generic_well_rate< rt::productivity_index_oil >},
{ "WPIG", pi< rt::productivity_index_gas >}, { "WPIG", generic_well_rate< rt::productivity_index_gas >},
{ "WPIL", sum( pi< rt::productivity_index_water >, pi< rt::productivity_index_oil>)}, { "WPIL", sum( generic_well_rate< rt::productivity_index_water >, generic_well_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>},
}; };

View File

@ -100,6 +100,12 @@ static data::Wells result_wells() {
rates1.set( rt::reservoir_water, -10.6 / day ); rates1.set( rt::reservoir_water, -10.6 / day );
rates1.set( rt::reservoir_oil, -10.7 / day ); rates1.set( rt::reservoir_oil, -10.7 / day );
rates1.set( rt::reservoir_gas, -10.8 / day ); rates1.set( rt::reservoir_gas, -10.8 / day );
rates1.set( rt::productivity_index_water, -10.9 / day );
rates1.set( rt::productivity_index_oil, -10.11 / day );
rates1.set( rt::productivity_index_gas, -10.12 / day );
rates1.set( rt::well_potential_water, -10.13 / day );
rates1.set( rt::well_potential_oil, -10.14 / day );
rates1.set( rt::well_potential_gas, -10.15 / day );
data::Rates rates2; data::Rates rates2;
rates2.set( rt::wat, -20.0 / day ); rates2.set( rt::wat, -20.0 / day );
@ -111,6 +117,12 @@ static data::Wells result_wells() {
rates2.set( rt::reservoir_water, -20.6 / day ); rates2.set( rt::reservoir_water, -20.6 / day );
rates2.set( rt::reservoir_oil, -20.7 / day ); rates2.set( rt::reservoir_oil, -20.7 / day );
rates2.set( rt::reservoir_gas, -20.8 / day ); rates2.set( rt::reservoir_gas, -20.8 / day );
rates2.set( rt::productivity_index_water, -20.9 / day );
rates2.set( rt::productivity_index_oil, -20.11 / day );
rates2.set( rt::productivity_index_gas, -20.12 / day );
rates2.set( rt::well_potential_water, -20.13 / day );
rates2.set( rt::well_potential_oil, -20.14 / day );
rates2.set( rt::well_potential_gas, -20.15 / day );
data::Rates rates3; data::Rates rates3;
rates3.set( rt::wat, 30.0 / day ); rates3.set( rt::wat, 30.0 / day );
@ -122,6 +134,12 @@ static data::Wells result_wells() {
rates3.set( rt::reservoir_water, 30.6 / day ); rates3.set( rt::reservoir_water, 30.6 / day );
rates3.set( rt::reservoir_oil, 30.7 / day ); rates3.set( rt::reservoir_oil, 30.7 / day );
rates3.set( rt::reservoir_gas, 30.8 / day ); rates3.set( rt::reservoir_gas, 30.8 / day );
rates3.set( rt::productivity_index_water, -30.9 / day );
rates3.set( rt::productivity_index_oil, -30.11 / day );
rates3.set( rt::productivity_index_gas, -30.12 / day );
rates3.set( rt::well_potential_water, -30.13 / day );
rates3.set( rt::well_potential_oil, -30.14 / day );
rates3.set( rt::well_potential_gas, -30.15 / day );
/* completion rates */ /* completion rates */