Add WellContainer<SegmentState> member

This commit is contained in:
Joakim Hove
2021-05-30 19:39:26 +02:00
parent 5dc267c6f5
commit 45e7c8c982
3 changed files with 32 additions and 0 deletions

View File

@@ -49,6 +49,7 @@ void WellState::base_init(const std::vector<double>& cellPressures,
this->bhp_.clear();
this->thp_.clear();
this->temperature_.clear();
this->segment_state.clear();
{
// const int nw = wells->number_of_wells;
const int nw = wells_ecl.size();
@@ -97,6 +98,7 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
this->wellrates_.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->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->bhp_.add(well.name(), 0.0);
@@ -851,6 +853,7 @@ void WellState::initWellStateMSWell(const std::vector<Well>& wells_ecl,
// assuming the order of the perforations in well_ecl is the same with Wells
const WellConnections& completion_set = well_ecl.getConnections();
// number of segment for this single well
this->segment_state.update(w, SegmentState{np, segment_set});
const int well_nseg = segment_set.size();
int n_activeperf = 0;
nseg_ += well_nseg;

View File

@@ -23,6 +23,7 @@
#include <opm/simulators/wells/ALQState.hpp>
#include <opm/simulators/wells/GlobalWellInfo.hpp>
#include <opm/simulators/wells/SegmentState.hpp>
#include <opm/simulators/wells/WellContainer.hpp>
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/simulators/wells/PerforationData.hpp>
@@ -270,6 +271,15 @@ public:
int topSegmentIndex(const int w) const;
const SegmentState& segments(const std::size_t well_index) const {
return this->segment_state[well_index];
}
SegmentState& segments(const std::size_t well_index) {
return this->segment_state[well_index];
}
std::vector<double>& productivityIndex() {
return productivity_index_;
}
@@ -524,6 +534,7 @@ private:
// \Note: for now, only WCON* keywords, and well status change is considered
WellContainer<Events> events_;
WellContainer<SegmentState> segment_state;
// MS well related
// for StandardWell, the number of segments will be one
std::vector<double> seg_rates_;

View File

@@ -538,5 +538,23 @@ BOOST_AUTO_TEST_CASE(TESTSegmentState) {
BOOST_CHECK_EQUAL(ss1.pressure_drop(0), 6);
}
BOOST_AUTO_TEST_CASE(TESTSegmentState2) {
const Setup setup{ "msw.data" };
std::vector<Opm::ParallelWellInfo> pinfo;
const auto wstate = buildWellState(setup, 0, pinfo);
const auto& well = setup.sched.getWell("PROD01", 0);
BOOST_CHECK_THROW(wstate.segments(100), std::exception);
auto segments = wstate.segments(1); // PROD01 is well 1
BOOST_CHECK_EQUAL(segments.pressure.size(), well.getSegments().size());
segments.pressure_drop_friction[0] = 1;
segments.pressure_drop_accel[0] = 2;
segments.pressure_drop_hydrostatic[0] = 4;
BOOST_CHECK_EQUAL(segments.pressure_drop(0), 7);
}
BOOST_AUTO_TEST_SUITE_END()