Add ParallelWellInfo member to SingleWellState

This commit is contained in:
Joakim Hove 2021-09-27 10:00:37 +02:00
parent 56afec81b4
commit cf340644b2
5 changed files with 18 additions and 15 deletions

View File

@ -21,8 +21,9 @@
namespace Opm {
SingleWellState::SingleWellState(bool is_producer, std::size_t num_perf, std::size_t num_phases, double temp)
: producer(is_producer)
SingleWellState::SingleWellState(const ParallelWellInfo* pinfo, bool is_producer, std::size_t num_perf, std::size_t num_phases, double temp)
: parallel_info(pinfo)
, producer(is_producer)
, temperature(temp)
, well_potentials(num_phases)
, productivity_index(num_phases)

View File

@ -26,12 +26,15 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/simulators/wells/PerfData.hpp>
#include <opm/simulators/wells/ParallelWellInfo.hpp>
namespace Opm {
class SingleWellState {
public:
SingleWellState(bool is_producer, std::size_t num_perf, std::size_t num_phases, double temp);
SingleWellState(const ParallelWellInfo* pinfo, bool is_producer, std::size_t num_perf, std::size_t num_phases, double temp);
const ParallelWellInfo* parallel_info;
Well::Status status{Well::Status::OPEN};
bool producer;

View File

@ -39,7 +39,6 @@ void WellState::base_init(const std::vector<double>& cellPressures,
const SummaryState& summary_state)
{
// clear old name mapping
this->parallel_well_info_.clear();
this->wells_.clear();
{
// const int nw = wells->number_of_wells;
@ -72,8 +71,7 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
const int np = pu.num_phases;
double temp = well.isInjector() ? well.injectionControls(summary_state).temperature : 273.15 + 15.56;
this->parallel_well_info_.add(well.name(), well_info);
auto& ws = this->wells_.add(well.name(), SingleWellState{well.isProducer(), well_perf_data.size(), static_cast<std::size_t>(np), temp});
auto& ws = this->wells_.add(well.name(), SingleWellState{well_info, well.isProducer(), well_perf_data.size(), static_cast<std::size_t>(np), temp});
if ( ws.perf_data.empty())
return;
@ -500,7 +498,7 @@ WellState::report(const int* globalCellIdxMap,
curr.inj = ws.injection_cmode;
}
const auto& pwinfo = *this->parallel_well_info_[well_index];
const auto& pwinfo = *ws.parallel_info;
if (pwinfo.communication().size()==1)
{
reportConnections(well.connections, pu, well_index, globalCellIdxMap);
@ -742,7 +740,7 @@ double WellState::solventWellRate(const int w) const
auto& ws = this->well(w);
const auto& perf_data = ws.perf_data;
const auto& perf_rates_solvent = perf_data.solvent_rates;
return parallel_well_info_[w]->sumPerfValues(perf_rates_solvent.begin(), perf_rates_solvent.end());
return ws.parallel_info->sumPerfValues(perf_rates_solvent.begin(), perf_rates_solvent.end());
}
double WellState::polymerWellRate(const int w) const
@ -750,7 +748,7 @@ double WellState::polymerWellRate(const int w) const
auto& ws = this->well(w);
const auto& perf_data = ws.perf_data;
const auto& perf_rates_polymer = perf_data.polymer_rates;
return parallel_well_info_[w]->sumPerfValues(perf_rates_polymer.begin(), perf_rates_polymer.end());
return ws.parallel_info->sumPerfValues(perf_rates_polymer.begin(), perf_rates_polymer.end());
}
double WellState::brineWellRate(const int w) const
@ -758,7 +756,7 @@ double WellState::brineWellRate(const int w) const
auto& ws = this->well(w);
const auto& perf_data = ws.perf_data;
const auto& perf_rates_brine = perf_data.brine_rates;
return parallel_well_info_[w]->sumPerfValues(perf_rates_brine.begin(), perf_rates_brine.end());
return ws.parallel_info->sumPerfValues(perf_rates_brine.begin(), perf_rates_brine.end());
}
@ -986,7 +984,8 @@ void WellState::resetConnectionTransFactors(const int well_index,
const ParallelWellInfo&
WellState::parallelWellInfo(std::size_t well_index) const
{
return *parallel_well_info_[well_index];
const auto& ws = this->well(well_index);
return *ws.parallel_info;
}
template void WellState::updateGlobalIsGrup<ParallelWellInfo::Communication>(const ParallelWellInfo::Communication& comm);

View File

@ -268,7 +268,6 @@ private:
PhaseUsage phase_usage_;
WellContainer<SingleWellState> wells_;
WellContainer<const ParallelWellInfo*> parallel_well_info_;
// The well_rates variable is defined for all wells on all processors. The
// bool in the value pair is whether the current process owns the well or
// not.

View File

@ -569,9 +569,10 @@ BOOST_AUTO_TEST_CASE(TESTPerfData) {
BOOST_AUTO_TEST_CASE(TestSingleWellState) {
Opm::SingleWellState ws1(true, 10, 3, 1);
Opm::SingleWellState ws2(true, 10, 3, 2);
Opm::SingleWellState ws3(false, 10, 3, 3);
Opm::ParallelWellInfo pinfo;
Opm::SingleWellState ws1(&pinfo, true, 10, 3, 1);
Opm::SingleWellState ws2(&pinfo, true, 10, 3, 2);
Opm::SingleWellState ws3(&pinfo, false, 10, 3, 3);
ws1.bhp = 100;
ws1.thp = 200;