PerfData maintains producre / injector status

This commit is contained in:
Joakim Hove 2021-06-14 08:55:03 +02:00
parent 7c133bb0eb
commit a22b836b82
4 changed files with 20 additions and 12 deletions

View File

@ -24,20 +24,22 @@ namespace Opm
{
PerfData::PerfData(std::size_t num_perf, const PhaseUsage& pu_arg):
PerfData::PerfData(std::size_t num_perf, bool injector_, const PhaseUsage& pu_arg):
pu(pu_arg),
injector(injector_),
pressure(num_perf),
rates(num_perf),
phase_rates(num_perf * pu.num_phases),
solvent_rates(num_perf),
polymer_rates(num_perf),
brine_rates(num_perf),
prod_index(num_perf * pu.num_phases),
water_throughput(num_perf),
skin_pressure(num_perf),
water_velocity(num_perf)
prod_index(num_perf * pu.num_phases)
{
if (injector) {
this->water_throughput.resize(num_perf);
this->skin_pressure.resize(num_perf);
this->water_velocity.resize(num_perf);
}
}
std::size_t PerfData::size() const {
@ -48,6 +50,9 @@ bool PerfData::try_assign(const PerfData& other) {
if (this->size() != other.size())
return false;
if (this->injector != other.injector)
return false;
this->pressure = other.pressure;
this->rates = other.rates;
this->phase_rates = other.phase_rates;
@ -58,7 +63,6 @@ bool PerfData::try_assign(const PerfData& other) {
this->skin_pressure = other.skin_pressure;
this->water_velocity = other.water_velocity;
this->prod_index = other.prod_index;
return true;
}

View File

@ -32,9 +32,10 @@ class PerfData
{
private:
PhaseUsage pu;
bool injector;
public:
PerfData(std::size_t num_perf, const PhaseUsage& pu);
PerfData(std::size_t num_perf, bool injector_, const PhaseUsage& pu);
std::size_t size() const;
bool try_assign(const PerfData& other);

View File

@ -100,7 +100,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{static_cast<std::size_t>(num_perf_this_well), this->phase_usage_});
this->perfdata.add(well.name(), PerfData{static_cast<std::size_t>(num_perf_this_well), well.isInjector(), 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

@ -545,9 +545,10 @@ GAS
)";
Opm::PhaseUsage pu = Opm::phaseUsageFromDeck(Opm::Parser{}.parseString(deck_string));
Opm::PerfData pd1(3,pu);
Opm::PerfData pd2(3,pu);
Opm::PerfData pd3(2,pu);
Opm::PerfData pd1(3, true, pu);
Opm::PerfData pd2(3, true, pu);
Opm::PerfData pd3(2, true, pu);
Opm::PerfData pd4(3, false, pu);
for (std::size_t i = 0; i < 3; i++) {
@ -565,6 +566,8 @@ GAS
for (std::size_t i = 0; i < 3; i++) {
BOOST_CHECK(pd1.pressure[i] == 10*(i+1));
}
BOOST_CHECK(!pd1.try_assign(pd4));
}