mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #875 from atgeirr/completion-data-changes
Update well data output integration.
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
#include <opm/common/data/SimulationDataContainer.hpp>
|
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/autodiff/WellStateFullyImplicitBlackoil.hpp>
|
||||||
#include <opm/autodiff/BlackoilSolventState.hpp>
|
#include <opm/autodiff/BlackoilSolventState.hpp>
|
||||||
#include <opm/output/data/Cells.hpp>
|
#include <opm/output/data/Cells.hpp>
|
||||||
#include <opm/output/data/Solution.hpp>
|
#include <opm/output/data/Solution.hpp>
|
||||||
@@ -172,7 +172,7 @@ inline void solutionToSim( const data::Solution& sol,
|
|||||||
|
|
||||||
inline void wellsToState( const data::Wells& wells,
|
inline void wellsToState( const data::Wells& wells,
|
||||||
PhaseUsage phases,
|
PhaseUsage phases,
|
||||||
WellState& state ) {
|
WellStateFullyImplicitBlackoil& state ) {
|
||||||
|
|
||||||
using rt = data::Rates::opt;
|
using rt = data::Rates::opt;
|
||||||
|
|
||||||
@@ -197,6 +197,7 @@ inline void wellsToState( const data::Wells& wells,
|
|||||||
|
|
||||||
state.bhp()[ well_index ] = well.bhp;
|
state.bhp()[ well_index ] = well.bhp;
|
||||||
state.temperature()[ well_index ] = well.temperature;
|
state.temperature()[ well_index ] = well.temperature;
|
||||||
|
state.currentControls()[ well_index ] = well.control;
|
||||||
|
|
||||||
const auto wellrate_index = well_index * np;
|
const auto wellrate_index = well_index * np;
|
||||||
for( size_t i = 0; i < phs.size(); ++i ) {
|
for( size_t i = 0; i < phs.size(); ++i ) {
|
||||||
@@ -204,13 +205,12 @@ inline void wellsToState( const data::Wells& wells,
|
|||||||
state.wellRates()[ wellrate_index + i ] = well.rates.get( phs[ i ] );
|
state.wellRates()[ wellrate_index + i ] = well.rates.get( phs[ i ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
using PerfPairTypeAlias = decltype( *well.completions.begin() );
|
const auto perforation_pressure = []( const data::Completion& comp ) {
|
||||||
const auto perforation_pressure = []( const PerfPairTypeAlias& p ) {
|
return comp.pressure;
|
||||||
return p.second.pressure;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto perforation_reservoir_rate = []( const PerfPairTypeAlias& p ) {
|
const auto perforation_reservoir_rate = []( const data::Completion& comp ) {
|
||||||
return p.second.reservoir_rate;
|
return comp.reservoir_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::transform( well.completions.begin(),
|
std::transform( well.completions.begin(),
|
||||||
@@ -222,6 +222,15 @@ inline void wellsToState( const data::Wells& wells,
|
|||||||
well.completions.end(),
|
well.completions.end(),
|
||||||
state.perfRates().begin() + wm.second[ 1 ],
|
state.perfRates().begin() + wm.second[ 1 ],
|
||||||
perforation_reservoir_rate );
|
perforation_reservoir_rate );
|
||||||
|
|
||||||
|
int local_comp_index = 0;
|
||||||
|
for (const data::Completion& comp : well.completions) {
|
||||||
|
const int global_comp_index = wm.second[1] + local_comp_index;
|
||||||
|
for (int phase_index = 0; phase_index < np; ++phase_index) {
|
||||||
|
state.perfPhaseRates()[global_comp_index*np + phase_index] = comp.rates.get(phs[phase_index]);
|
||||||
|
}
|
||||||
|
++local_comp_index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -227,16 +227,17 @@ namespace Opm
|
|||||||
well.control = this->currentControls()[ w ];
|
well.control = this->currentControls()[ w ];
|
||||||
|
|
||||||
int local_comp_index = 0;
|
int local_comp_index = 0;
|
||||||
for( auto& cpair : well.completions ) {
|
for( auto& comp : well.completions ) {
|
||||||
const auto rates = this->perfPhaseRates().begin()
|
const auto rates = this->perfPhaseRates().begin()
|
||||||
+ (np * wt.second[ 1 ])
|
+ (np * wt.second[ 1 ])
|
||||||
+ (np * local_comp_index);
|
+ (np * local_comp_index);
|
||||||
++local_comp_index;
|
++local_comp_index;
|
||||||
|
|
||||||
for( int i = 0; i < np; ++i ) {
|
for( int i = 0; i < np; ++i ) {
|
||||||
cpair.second.rates.set( phs[ i ], *(rates + i) );
|
comp.rates.set( phs[ i ], *(rates + i) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(local_comp_index == this->wells_->well_connpos[ w + 1 ] - this->wells_->well_connpos[ w ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
Reference in New Issue
Block a user