mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-26 03:00:17 -06:00
Use well index for segment rates
This commit is contained in:
parent
34ef516472
commit
5ac53f8106
@ -2011,14 +2011,13 @@ namespace Opm {
|
||||
|
||||
const WellSegments& segment_set = well_ecl.getSegments();
|
||||
|
||||
const int top_segment_index = well_state.topSegmentIndex(well_index);
|
||||
const auto& rst_segments = rst_well.segments;
|
||||
|
||||
// \Note: eventually we need to hanlde the situations that some segments are shut
|
||||
assert(0u + segment_set.size() == rst_segments.size());
|
||||
|
||||
auto * segment_rates = &well_state.segRates()[top_segment_index*np];
|
||||
auto segment_pressure = well_state.segPress(well_index);
|
||||
auto segment_rates = well_state.segRates(well_index);
|
||||
for (const auto& rst_segment : rst_segments) {
|
||||
const int segment_index = segment_set.segmentNumberToIndex(rst_segment.first);
|
||||
|
||||
|
@ -278,8 +278,7 @@ namespace Opm
|
||||
MultisegmentWell<TypeTag>::
|
||||
scaleSegmentRatesWithWellRates(WellState& well_state) const
|
||||
{
|
||||
const int top_segment_index = well_state.topSegmentIndex(index_of_well_);
|
||||
auto * segment_rates = &well_state.segRates()[top_segment_index*this->number_of_phases_];
|
||||
auto segment_rates = well_state.segRates(index_of_well_);
|
||||
for (int phase = 0; phase < number_of_phases_; ++phase) {
|
||||
const double unscaled_top_seg_rate = segment_rates[phase];
|
||||
const double well_phase_rate = well_state.wellRates(index_of_well_)[phase];
|
||||
@ -316,7 +315,6 @@ namespace Opm
|
||||
scaleSegmentPressuresWithBhp(WellState& well_state) const
|
||||
{
|
||||
//scale segment pressures
|
||||
const int top_segment_index = well_state.topSegmentIndex(index_of_well_);
|
||||
const double bhp = well_state.bhp(index_of_well_);
|
||||
auto segment_pressure = well_state.segPress(index_of_well_);
|
||||
const double unscaled_top_seg_pressure = segment_pressure[0];
|
||||
@ -722,8 +720,7 @@ namespace Opm
|
||||
const Well& well = Base::wellEcl();
|
||||
|
||||
// the index of the top segment in the WellState
|
||||
const int top_segment_index = well_state.topSegmentIndex(index_of_well_);
|
||||
const auto * segment_rates = &well_state.segRates()[top_segment_index * this->number_of_phases_];
|
||||
const auto segment_rates = well_state.segRates(index_of_well_);
|
||||
const auto segment_pressure = well_state.segPress(index_of_well_);
|
||||
const PhaseUsage& pu = phaseUsage();
|
||||
|
||||
@ -2340,7 +2337,7 @@ namespace Opm
|
||||
assert( FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) );
|
||||
const int oil_pos = pu.phase_pos[Oil];
|
||||
|
||||
auto * segment_rates = &well_state.segRates()[well_state.topSegmentIndex(this->index_of_well_) * this->number_of_phases_];
|
||||
auto segment_rates = well_state.segRates(this->index_of_well_);
|
||||
auto segment_pressure = well_state.segPress(this->index_of_well_);
|
||||
for (int seg = 0; seg < numberOfSegments(); ++seg) {
|
||||
std::vector<double> fractions(number_of_phases_, 0.0);
|
||||
|
@ -965,7 +965,6 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
continue;
|
||||
}
|
||||
|
||||
const int old_top_segment_index = prev_well_state->topSegmentIndex(old_index_well);
|
||||
const int new_top_segment_index = topSegmentIndex(new_index_well);
|
||||
int number_of_segment = 0;
|
||||
// if it is the last well in list
|
||||
@ -975,10 +974,10 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
number_of_segment = topSegmentIndex(new_index_well + 1) - new_top_segment_index;
|
||||
}
|
||||
|
||||
auto * segment_rates = &this->seg_rates_[new_top_segment_index*np];
|
||||
auto segment_rates = this->segRates(w);
|
||||
auto segment_pressure = this->segPress(w);
|
||||
|
||||
const auto * prev_segment_rates = &prev_well_state->segRates()[old_top_segment_index*np];
|
||||
const auto prev_segment_rates = prev_well_state->segRates(old_index_well);
|
||||
const auto prev_segment_pressure = prev_well_state->segPress(old_index_well);
|
||||
|
||||
for (int seg=0; seg < number_of_segment; ++seg) {
|
||||
@ -1152,13 +1151,8 @@ WellState::reportSegmentResults(const PhaseUsage& pu,
|
||||
const int seg_no) const
|
||||
{
|
||||
auto seg_res = data::Segment{};
|
||||
|
||||
const auto seg_dof =
|
||||
this->topSegmentIndex(well_id) + seg_ix;
|
||||
|
||||
const auto* rate =
|
||||
&this->segRates()[seg_dof * this->numPhases()];
|
||||
|
||||
{
|
||||
using Value = data::SegmentPressures::Value;
|
||||
auto& segpress = seg_res.pressures;
|
||||
@ -1169,6 +1163,8 @@ WellState::reportSegmentResults(const PhaseUsage& pu,
|
||||
segpress[Value::PDropAccel] = this->segPressDropAcceleration()[seg_dof];
|
||||
}
|
||||
|
||||
const auto segment_rates = this->segRates(well_id);
|
||||
const auto rate = &segment_rates[seg_ix * this->numPhases()];
|
||||
if (pu.phase_used[Water]) {
|
||||
seg_res.rates.set(data::Rates::opt::wat,
|
||||
rate[pu.phase_pos[Water]]);
|
||||
|
@ -192,14 +192,17 @@ public:
|
||||
return well_vaporized_oil_rates_[well_index];
|
||||
}
|
||||
|
||||
const std::vector<double>& segRates() const
|
||||
|
||||
const double * segRates(std::size_t well_index) const
|
||||
{
|
||||
return seg_rates_;
|
||||
const int top_segment_index = this->top_segment_index_[well_index];
|
||||
return &this->seg_rates_[top_segment_index * this->phase_usage_.num_phases];
|
||||
}
|
||||
|
||||
std::vector<double>& segRates()
|
||||
double * segRates(std::size_t well_index)
|
||||
{
|
||||
return seg_rates_;
|
||||
const int top_segment_index = this->top_segment_index_[well_index];
|
||||
return &this->seg_rates_[top_segment_index * this->phase_usage_.num_phases];
|
||||
}
|
||||
|
||||
double * segPress(std::size_t well_index)
|
||||
|
@ -206,16 +206,15 @@ namespace {
|
||||
|
||||
const auto nWell = wells.size();
|
||||
|
||||
auto& segRates = wstate.segRates();
|
||||
|
||||
for (auto wellID = 0*nWell; wellID < nWell; ++wellID) {
|
||||
const auto& well = wells[wellID];
|
||||
const auto topSegIx = wstate.topSegmentIndex(wellID);
|
||||
const auto rateTop = 1000.0 * wellID;
|
||||
auto segRates = wstate.segRates(wellID);
|
||||
|
||||
if (wat) { segRates[np*topSegIx + iw] = rateTop; }
|
||||
if (oil) { segRates[np*topSegIx + io] = rateTop; }
|
||||
if (gas) { segRates[np*topSegIx + ig] = rateTop; }
|
||||
if (wat) { segRates[iw] = rateTop; }
|
||||
if (oil) { segRates[io] = rateTop; }
|
||||
if (gas) { segRates[ig] = rateTop; }
|
||||
|
||||
if (! well.isMultiSegment()) {
|
||||
continue;
|
||||
@ -228,7 +227,7 @@ namespace {
|
||||
// One-based numbering scheme for segments.
|
||||
const auto segNo = segSet[segID].segmentNumber();
|
||||
|
||||
auto* rates = &segRates[(topSegIx + segNo - 1) * np];
|
||||
auto* rates = &segRates[(segNo - 1) * np];
|
||||
|
||||
if (wat) { rates[iw] = rateTop + 100.0*(segNo - 1); }
|
||||
if (oil) { rates[io] = rateTop + 200.0*(segNo - 1); }
|
||||
|
Loading…
Reference in New Issue
Block a user