adding summary keywords for MSW

SPRD, SPRDH, SPRDF, SPRDA
This commit is contained in:
Kai Bao
2020-04-14 22:31:56 +02:00
parent 685ab301d2
commit 34ca02c253
3 changed files with 119 additions and 4 deletions

View File

@@ -153,12 +153,20 @@ namespace Opm {
struct Segment {
Rates rates;
double pressure;
double pressure_drop;
double pressure_drop_hydrostatic;
double pressure_drop_acceleration;
double pressure_drop_friction;
std::size_t segNumber;
bool operator==(const Segment& seg2) const
{
return rates == seg2.rates &&
pressure == seg2.pressure &&
pressure_drop == seg2.pressure_drop &&
pressure_drop_hydrostatic == seg2.pressure_drop_hydrostatic &&
pressure_drop_friction == seg2.pressure_drop_friction &&
pressure_drop_acceleration == seg2.pressure_drop_acceleration &&
segNumber == seg2.segNumber;
}
@@ -453,6 +461,10 @@ namespace Opm {
buffer.write(this->segNumber);
this->rates.write(buffer);
buffer.write(this->pressure);
buffer.write(this->pressure_drop);
buffer.write(this->pressure_drop_hydrostatic);
buffer.write(this->pressure_drop_friction);
buffer.write(this->pressure_drop_acceleration);
}
template <class MessageBufferType>
@@ -531,6 +543,10 @@ namespace Opm {
buffer.read(this->segNumber);
this->rates.read(buffer);
buffer.read(this->pressure);
buffer.read(this->pressure_drop);
buffer.read(this->pressure_drop_hydrostatic);
buffer.read(this->pressure_drop_friction);
buffer.read(this->pressure_drop_acceleration);
}
template <class MessageBufferType>

View File

@@ -592,6 +592,101 @@ inline quantity spr ( const fn_args& args ) {
return { v, measure::pressure };
}
inline quantity sprd ( const fn_args& args ) {
const quantity zero = { 0, measure::pressure };
if( args.schedule_wells.empty() ) return zero;
// Like completion rate we need to look
// up a connection with offset 0.
const size_t segNumber = args.num;
if( args.schedule_wells.empty() ) return zero;
const auto& well = args.schedule_wells.front();
const auto& name = well.name();
if( args.wells.count( name ) == 0 ) return zero;
const auto& well_data = args.wells.at( name );
const auto& segment = well_data.segments.find(segNumber);
if( segment == well_data.segments.end() ) return zero;
const auto& v = segment->second.pressure_drop;
return { v, measure::pressure };
}
inline quantity sprdh ( const fn_args& args ) {
const quantity zero = { 0, measure::pressure };
if( args.schedule_wells.empty() ) return zero;
// Like completion rate we need to look
// up a connection with offset 0.
const size_t segNumber = args.num;
if( args.schedule_wells.empty() ) return zero;
const auto& well = args.schedule_wells.front();
const auto& name = well.name();
if( args.wells.count( name ) == 0 ) return zero;
const auto& well_data = args.wells.at( name );
const auto& segment = well_data.segments.find(segNumber);
if( segment == well_data.segments.end() ) return zero;
const auto& v = segment->second.pressure_drop_hydrostatic;
return { v, measure::pressure };
}
inline quantity sprdf ( const fn_args& args ) {
const quantity zero = { 0, measure::pressure };
if( args.schedule_wells.empty() ) return zero;
// Like completion rate we need to look
// up a connection with offset 0.
const size_t segNumber = args.num;
if( args.schedule_wells.empty() ) return zero;
const auto& well = args.schedule_wells.front();
const auto& name = well.name();
if( args.wells.count( name ) == 0 ) return zero;
const auto& well_data = args.wells.at( name );
const auto& segment = well_data.segments.find(segNumber);
if( segment == well_data.segments.end() ) return zero;
const auto& v = segment->second.pressure_drop_friction;
return { v, measure::pressure };
}
inline quantity sprda ( const fn_args& args ) {
const quantity zero = { 0, measure::pressure };
if( args.schedule_wells.empty() ) return zero;
// Like completion rate we need to look
// up a connection with offset 0.
const size_t segNumber = args.num;
if( args.schedule_wells.empty() ) return zero;
const auto& well = args.schedule_wells.front();
const auto& name = well.name();
if( args.wells.count( name ) == 0 ) return zero;
const auto& well_data = args.wells.at( name );
const auto& segment = well_data.segments.find(segNumber);
if( segment == well_data.segments.end() ) return zero;
const auto& v = segment->second.pressure_drop_acceleration;
return { v, measure::pressure };
}
inline quantity bhp( const fn_args& args ) {
const quantity zero = { 0, measure::pressure };
@@ -1209,7 +1304,11 @@ static const std::unordered_map< std::string, ofun > funs = {
{ "SOFR", srate< rt::oil > },
{ "SWFR", srate< rt::wat > },
{ "SGFR", srate< rt::gas > },
{ "SPR", spr },
{ "SPR", spr },
{ "SPRD", sprd },
{ "SPRDH", sprdh },
{ "SPRDF", sprdf },
{ "SPRDA", sprda },
// Well productivity index
{ "WPIW", potential_rate< rt::productivity_index_water >},
{ "WPIO", potential_rate< rt::productivity_index_oil >},

View File

@@ -178,7 +178,7 @@ namespace {
bool is_pressure(const std::string& keyword) {
static const keyword_set presskw {
"BHP", "BHPH", "THP", "THPH", "PR"
"BHP", "BHPH", "THP", "THPH", "PR", "PRD", "PRDH", "PRDF", "PRDA",
};
return is_in_set(presskw, keyword.substr(1));
@@ -557,13 +557,13 @@ inline void keywordMISC( SummaryConfig::keyword_list& list,
{
const auto& kw = keyword.name();
if (kw.size() > 4) {
if (kw.size() > 5) {
// Easy check first--handles SUMMARY and SUMTHIN &c.
return false;
}
const auto kw_whitelist = std::vector<const char*> {
"SOFR", "SGFR", "SWFR", "SPR",
"SOFR", "SGFR", "SWFR", "SPR", "SPRD", "SPRDH", "SPRDF", "SPRDA",
};
return std::any_of(kw_whitelist.begin(), kw_whitelist.end(),