Update to interface change in opm-output

This commit is contained in:
Jørgen Kvalsvik 2016-09-26 16:22:51 +02:00
parent 93ffb318cd
commit 6ba21fd4c0
2 changed files with 27 additions and 41 deletions

View File

@ -420,7 +420,7 @@ namespace Opm
Opm::UgGridHelpers::numCells(grid) ); Opm::UgGridHelpers::numCells(grid) );
solutionToSim( restarted.first, phaseusage, simulatorstate ); solutionToSim( restarted.first, phaseusage, simulatorstate );
wellsToState( restarted.second, wellstate ); wellsToState( restarted.second, phaseusage, wellstate );
} }

View File

@ -196,10 +196,22 @@ namespace Opm
data::Wells res = WellState::report(pu); data::Wells res = WellState::report(pu);
const int nw = this->numWells(); const int nw = this->numWells();
// If there are now wells numPhases throws a floating point
// exception.
const int np = nw ? this->numPhases() : -1; const int np = nw ? this->numPhases() : -1;
using rt = data::Rates::opt;
std::vector< rt > phs( np );
if( pu.phase_used[BlackoilPhases::Aqua] ) {
phs.at( pu.phase_pos[BlackoilPhases::Aqua] ) = rt::wat;
}
if( pu.phase_used[BlackoilPhases::Liquid] ) {
phs.at( pu.phase_pos[BlackoilPhases::Liquid] ) = rt::oil;
}
if( pu.phase_used[BlackoilPhases::Vapour] ) {
phs.at( pu.phase_pos[BlackoilPhases::Vapour] ) = rt::gas;
}
/* this is a reference or example on **how** to convert from /* this is a reference or example on **how** to convert from
* WellState to something understood by opm-output. it is intended * WellState to something understood by opm-output. it is intended
* to be properly implemented and maintained as a part of * to be properly implemented and maintained as a part of
@ -207,47 +219,21 @@ namespace Opm
* representations. * representations.
*/ */
for( auto w = 0; w < nw; ++w ) { for( const auto& wt : this->wellMap() ) {
using rt = data::Rates::opt; const auto w = wt.second[ 0 ];
std::map< size_t, data::Completion > completions; auto& well = res.at( wt.first );
// completions aren't supported yet int local_comp_index = 0;
//const auto* begin = wells_->well_connpos + w; for( auto& cpair : well.completions ) {
//const auto* end = wells_->well_connpos + w + 1; const auto rates = this->perfPhaseRates().begin()
//for( auto* i = begin; i != end; ++i ) { + (np * wt.second[ 1 ])
// const auto perfrate = this->perfPhaseRates().begin() + *i; + (np * local_comp_index);
// data::Rates perfrates; ++local_comp_index;
// perfrates.set( rt::wat, *(perfrate + 0) );
// perfrates.set( rt::oil, *(perfrate + 1) );
// perfrates.set( rt::gas, *(perfrate + 2) );
// const size_t active_index = wells_->well_cells[ *i ]; for( int i = 0; i < np; ++i ) {
cpair.second.rates.set( phs[ i ], *(rates + i) );
// completions.emplace( active_index,
// data::Completion{ active_index, perfrates } );
//}
const auto wellrate_index = np * w;
const auto& wv = this->wellRates();
data::Rates wellrates;
if( pu.phase_used[BlackoilPhases::Aqua] ) {
wellrates.set( rt::wat, wv[ wellrate_index + pu.phase_pos[BlackoilPhases::Aqua] ] );
} }
if( pu.phase_used[BlackoilPhases::Liquid] ) {
wellrates.set( rt::oil, wv[ wellrate_index + pu.phase_pos[BlackoilPhases::Liquid] ] );
} }
if( pu.phase_used[BlackoilPhases::Vapour] ) {
wellrates.set( rt::gas, wv[ wellrate_index + pu.phase_pos[BlackoilPhases::Vapour] ] );
}
const double bhp = this->bhp()[ w ];
const double thp = this->thp()[ w ];
res.emplace( wells_->name[ w ],
data::Well { wellrates, bhp, thp, std::move( completions ) } );
} }
return res; return res;