mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 18:21:00 -06:00
Handle closed connections when loading connection data from restart
This commit is contained in:
parent
7d825ba9d0
commit
289e0ea938
@ -1865,7 +1865,7 @@ namespace Opm {
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
BlackoilWellModel<TypeTag>::
|
BlackoilWellModel<TypeTag>::
|
||||||
loadRestartData( const data::Wells& wells,
|
loadRestartData( const data::Wells& rst_wells,
|
||||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||||
const PhaseUsage& phases,
|
const PhaseUsage& phases,
|
||||||
const bool handle_ms_well,
|
const bool handle_ms_well,
|
||||||
@ -1892,50 +1892,38 @@ namespace Opm {
|
|||||||
|
|
||||||
for( const auto& wm : state.wellMap() ) {
|
for( const auto& wm : state.wellMap() ) {
|
||||||
const auto well_index = wm.second[ 0 ];
|
const auto well_index = wm.second[ 0 ];
|
||||||
const auto& well = wells.at( wm.first );
|
const auto& rst_well = rst_wells.at( wm.first );
|
||||||
state.bhp()[ well_index ] = well.bhp;
|
state.bhp()[ well_index ] = rst_well.bhp;
|
||||||
state.temperature()[ well_index ] = well.temperature;
|
state.temperature()[ well_index ] = rst_well.temperature;
|
||||||
|
|
||||||
if (well.current_control.isProducer) {
|
if (rst_well.current_control.isProducer) {
|
||||||
state.currentProductionControls()[ well_index ] = well.current_control.prod;
|
state.currentProductionControls()[ well_index ] = rst_well.current_control.prod;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state.currentInjectionControls()[ well_index ] = well.current_control.inj;
|
state.currentInjectionControls()[ well_index ] = rst_well.current_control.inj;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ) {
|
||||||
assert( well.rates.has( phs[ i ] ) );
|
assert( rst_well.rates.has( phs[ i ] ) );
|
||||||
state.wellRates()[ wellrate_index + i ] = well.rates.get( phs[ i ] );
|
state.wellRates()[ wellrate_index + i ] = rst_well.rates.get( phs[ i ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto perforation_pressure = []( const data::Connection& comp ) {
|
auto * perf_pressure = state.perfPress().data() + wm.second[1];
|
||||||
return comp.pressure;
|
auto * perf_rates = state.perfRates().data() + wm.second[1];
|
||||||
};
|
auto * perf_phase_rates = state.perfPhaseRates().data() + wm.second[1]*np;
|
||||||
|
const auto& perf_data = this->well_perf_data_[well_index];
|
||||||
|
|
||||||
const auto perforation_reservoir_rate = []( const data::Connection& comp ) {
|
for (std::size_t perf_index = 0; perf_index < perf_data.size(); perf_index++) {
|
||||||
return comp.reservoir_rate;
|
const auto& pd = perf_data[perf_index];
|
||||||
};
|
const auto& rst_connection = rst_well.connections[pd.ecl_index];
|
||||||
std::transform( well.connections.begin(),
|
perf_pressure[perf_index] = rst_connection.pressure;
|
||||||
well.connections.end(),
|
perf_rates[perf_index] = rst_connection.reservoir_rate;
|
||||||
state.perfPress().begin() + wm.second[ 1 ],
|
for (int phase_index = 0; phase_index < np; ++phase_index)
|
||||||
perforation_pressure );
|
perf_phase_rates[perf_index*np + phase_index] = rst_connection.rates.get(phs[phase_index]);
|
||||||
|
|
||||||
std::transform( well.connections.begin(),
|
|
||||||
well.connections.end(),
|
|
||||||
state.perfRates().begin() + wm.second[ 1 ],
|
|
||||||
perforation_reservoir_rate );
|
|
||||||
|
|
||||||
int local_comp_index = 0;
|
|
||||||
for (const data::Connection& comp : well.connections) {
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle_ms_well && !well.segments.empty()) {
|
if (handle_ms_well && !rst_well.segments.empty()) {
|
||||||
// we need the well_ecl_ information
|
// we need the well_ecl_ information
|
||||||
const std::string& well_name = wm.first;
|
const std::string& well_name = wm.first;
|
||||||
const Well& well_ecl = getWellEcl(well_name);
|
const Well& well_ecl = getWellEcl(well_name);
|
||||||
@ -1943,7 +1931,7 @@ namespace Opm {
|
|||||||
const WellSegments& segment_set = well_ecl.getSegments();
|
const WellSegments& segment_set = well_ecl.getSegments();
|
||||||
|
|
||||||
const int top_segment_index = state.topSegmentIndex(well_index);
|
const int top_segment_index = state.topSegmentIndex(well_index);
|
||||||
const auto& segments = well.segments;
|
const auto& segments = rst_well.segments;
|
||||||
|
|
||||||
// \Note: eventually we need to hanlde the situations that some segments are shut
|
// \Note: eventually we need to hanlde the situations that some segments are shut
|
||||||
assert(0u + segment_set.size() == segments.size());
|
assert(0u + segment_set.size() == segments.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user