Add WellContainer<PerfData> to WellState

This commit is contained in:
Joakim Hove 2021-06-04 14:12:54 +02:00
parent 34481e48c3
commit b6318ac017
3 changed files with 23 additions and 0 deletions

View File

@ -41,6 +41,7 @@ void WellState::base_init(const std::vector<double>& cellPressures,
// clear old name mapping
this->wellMap_.clear();
this->perfpress_.clear();
this->perfdata.clear();
this->perf_skin_pressure_.clear();
this->perf_water_throughput_.clear();
this->perf_water_velocity_.clear();
@ -109,6 +110,7 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
this->well_potentials_.add(well.name(), std::vector<double>(np, 0));
const int num_perf_this_well = well_info->communication().sum(well_perf_data_[w].size());
this->segment_state.add(well.name(), SegmentState{});
this->perfdata.add(well.name(), PerfData{num_perf_this_well, this->phase_usage_});
this->perfpress_.add(well.name(), std::vector<double>(num_perf_this_well, -1e100));
this->perfrates_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->perfphaserates_.add(well.name(), std::vector<double>(np*num_perf_this_well, 0));
@ -118,6 +120,7 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
this->perfRatePolymer_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->perfRateSolvent_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->perfRateBrine_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->perfdata.add(well.name(), PerfData{static_cast<std::size_t>(num_perf_this_well), this->phase_usage_});
this->bhp_.add(well.name(), 0.0);
this->thp_.add(well.name(), 0.0);
this->productivity_index_.add(well.name(), std::vector<double>(np, 0));

View File

@ -27,6 +27,7 @@
#include <opm/simulators/wells/WellContainer.hpp>
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/simulators/wells/PerforationData.hpp>
#include <opm/simulators/wells/PerfData.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
@ -412,6 +413,21 @@ public:
std::size_t numPerf(std::size_t well_index) const { return this->perfpress_[well_index].size(); }
PerfData& perfData(const std::string& wname) {
return this->perfdata[wname];
}
const PerfData& perfData(const std::string& wname) const {
return this->perfdata[wname];
}
PerfData& perfData(std::size_t well_index) {
return this->perfdata[well_index];
}
const PerfData& perfData(std::size_t well_index) const {
return this->perfdata[well_index];
}
private:
WellMapType wellMap_;
@ -430,6 +446,7 @@ private:
WellContainer<double> temperature_;
WellContainer<std::vector<double>> wellrates_;
PhaseUsage phase_usage_;
WellContainer<PerfData> perfdata;
WellContainer<std::vector<double>> perfrates_;
WellContainer<std::vector<double>> perfpress_;

View File

@ -289,6 +289,9 @@ BOOST_AUTO_TEST_CASE(Pressure)
BOOST_CHECK_CLOSE(xseg.pressures[pres_idx], pressTop + 1.0*segID, 1.0e-10);
}
}
const auto& perf_data = wstate.perfData("PROD01");
}
// ---------------------------------------------------------------------