mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add WellContainer<SegmentState> member
This commit is contained in:
@@ -49,6 +49,7 @@ void WellState::base_init(const std::vector<double>& cellPressures,
|
|||||||
this->bhp_.clear();
|
this->bhp_.clear();
|
||||||
this->thp_.clear();
|
this->thp_.clear();
|
||||||
this->temperature_.clear();
|
this->temperature_.clear();
|
||||||
|
this->segment_state.clear();
|
||||||
{
|
{
|
||||||
// const int nw = wells->number_of_wells;
|
// const int nw = wells->number_of_wells;
|
||||||
const int nw = wells_ecl.size();
|
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));
|
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());
|
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->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->perfrates_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
|
||||||
this->bhp_.add(well.name(), 0.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
|
// assuming the order of the perforations in well_ecl is the same with Wells
|
||||||
const WellConnections& completion_set = well_ecl.getConnections();
|
const WellConnections& completion_set = well_ecl.getConnections();
|
||||||
// number of segment for this single well
|
// number of segment for this single well
|
||||||
|
this->segment_state.update(w, SegmentState{np, segment_set});
|
||||||
const int well_nseg = segment_set.size();
|
const int well_nseg = segment_set.size();
|
||||||
int n_activeperf = 0;
|
int n_activeperf = 0;
|
||||||
nseg_ += well_nseg;
|
nseg_ += well_nseg;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <opm/simulators/wells/ALQState.hpp>
|
#include <opm/simulators/wells/ALQState.hpp>
|
||||||
#include <opm/simulators/wells/GlobalWellInfo.hpp>
|
#include <opm/simulators/wells/GlobalWellInfo.hpp>
|
||||||
|
#include <opm/simulators/wells/SegmentState.hpp>
|
||||||
#include <opm/simulators/wells/WellContainer.hpp>
|
#include <opm/simulators/wells/WellContainer.hpp>
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
#include <opm/simulators/wells/PerforationData.hpp>
|
#include <opm/simulators/wells/PerforationData.hpp>
|
||||||
@@ -270,6 +271,15 @@ public:
|
|||||||
|
|
||||||
int topSegmentIndex(const int w) const;
|
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() {
|
std::vector<double>& productivityIndex() {
|
||||||
return productivity_index_;
|
return productivity_index_;
|
||||||
}
|
}
|
||||||
@@ -524,6 +534,7 @@ private:
|
|||||||
// \Note: for now, only WCON* keywords, and well status change is considered
|
// \Note: for now, only WCON* keywords, and well status change is considered
|
||||||
WellContainer<Events> events_;
|
WellContainer<Events> events_;
|
||||||
|
|
||||||
|
WellContainer<SegmentState> segment_state;
|
||||||
// MS well related
|
// MS well related
|
||||||
// for StandardWell, the number of segments will be one
|
// for StandardWell, the number of segments will be one
|
||||||
std::vector<double> seg_rates_;
|
std::vector<double> seg_rates_;
|
||||||
|
|||||||
@@ -538,5 +538,23 @@ BOOST_AUTO_TEST_CASE(TESTSegmentState) {
|
|||||||
BOOST_CHECK_EQUAL(ss1.pressure_drop(0), 6);
|
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()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|||||||
Reference in New Issue
Block a user