mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add ParallelWellInfo member to SingleWellState
This commit is contained in:
parent
56afec81b4
commit
cf340644b2
@ -21,8 +21,9 @@
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
SingleWellState::SingleWellState(bool is_producer, std::size_t num_perf, std::size_t num_phases, double temp)
|
SingleWellState::SingleWellState(const ParallelWellInfo* pinfo, bool is_producer, std::size_t num_perf, std::size_t num_phases, double temp)
|
||||||
: producer(is_producer)
|
: parallel_info(pinfo)
|
||||||
|
, producer(is_producer)
|
||||||
, temperature(temp)
|
, temperature(temp)
|
||||||
, well_potentials(num_phases)
|
, well_potentials(num_phases)
|
||||||
, productivity_index(num_phases)
|
, productivity_index(num_phases)
|
||||||
|
@ -26,12 +26,15 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
||||||
#include <opm/simulators/wells/PerfData.hpp>
|
#include <opm/simulators/wells/PerfData.hpp>
|
||||||
|
#include <opm/simulators/wells/ParallelWellInfo.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
class SingleWellState {
|
class SingleWellState {
|
||||||
public:
|
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};
|
Well::Status status{Well::Status::OPEN};
|
||||||
bool producer;
|
bool producer;
|
||||||
|
@ -39,7 +39,6 @@ void WellState::base_init(const std::vector<double>& cellPressures,
|
|||||||
const SummaryState& summary_state)
|
const SummaryState& summary_state)
|
||||||
{
|
{
|
||||||
// clear old name mapping
|
// clear old name mapping
|
||||||
this->parallel_well_info_.clear();
|
|
||||||
this->wells_.clear();
|
this->wells_.clear();
|
||||||
{
|
{
|
||||||
// const int nw = wells->number_of_wells;
|
// 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;
|
const int np = pu.num_phases;
|
||||||
double temp = well.isInjector() ? well.injectionControls(summary_state).temperature : 273.15 + 15.56;
|
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_info, well.isProducer(), well_perf_data.size(), static_cast<std::size_t>(np), temp});
|
||||||
auto& ws = this->wells_.add(well.name(), SingleWellState{well.isProducer(), well_perf_data.size(), static_cast<std::size_t>(np), temp});
|
|
||||||
|
|
||||||
if ( ws.perf_data.empty())
|
if ( ws.perf_data.empty())
|
||||||
return;
|
return;
|
||||||
@ -500,7 +498,7 @@ WellState::report(const int* globalCellIdxMap,
|
|||||||
curr.inj = ws.injection_cmode;
|
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)
|
if (pwinfo.communication().size()==1)
|
||||||
{
|
{
|
||||||
reportConnections(well.connections, pu, well_index, globalCellIdxMap);
|
reportConnections(well.connections, pu, well_index, globalCellIdxMap);
|
||||||
@ -742,7 +740,7 @@ double WellState::solventWellRate(const int w) const
|
|||||||
auto& ws = this->well(w);
|
auto& ws = this->well(w);
|
||||||
const auto& perf_data = ws.perf_data;
|
const auto& perf_data = ws.perf_data;
|
||||||
const auto& perf_rates_solvent = perf_data.solvent_rates;
|
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
|
double WellState::polymerWellRate(const int w) const
|
||||||
@ -750,7 +748,7 @@ double WellState::polymerWellRate(const int w) const
|
|||||||
auto& ws = this->well(w);
|
auto& ws = this->well(w);
|
||||||
const auto& perf_data = ws.perf_data;
|
const auto& perf_data = ws.perf_data;
|
||||||
const auto& perf_rates_polymer = perf_data.polymer_rates;
|
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
|
double WellState::brineWellRate(const int w) const
|
||||||
@ -758,7 +756,7 @@ double WellState::brineWellRate(const int w) const
|
|||||||
auto& ws = this->well(w);
|
auto& ws = this->well(w);
|
||||||
const auto& perf_data = ws.perf_data;
|
const auto& perf_data = ws.perf_data;
|
||||||
const auto& perf_rates_brine = perf_data.brine_rates;
|
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&
|
const ParallelWellInfo&
|
||||||
WellState::parallelWellInfo(std::size_t well_index) const
|
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);
|
template void WellState::updateGlobalIsGrup<ParallelWellInfo::Communication>(const ParallelWellInfo::Communication& comm);
|
||||||
|
@ -268,7 +268,6 @@ private:
|
|||||||
PhaseUsage phase_usage_;
|
PhaseUsage phase_usage_;
|
||||||
|
|
||||||
WellContainer<SingleWellState> wells_;
|
WellContainer<SingleWellState> wells_;
|
||||||
WellContainer<const ParallelWellInfo*> parallel_well_info_;
|
|
||||||
// The well_rates variable is defined for all wells on all processors. The
|
// 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
|
// bool in the value pair is whether the current process owns the well or
|
||||||
// not.
|
// not.
|
||||||
|
@ -569,9 +569,10 @@ BOOST_AUTO_TEST_CASE(TESTPerfData) {
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(TestSingleWellState) {
|
BOOST_AUTO_TEST_CASE(TestSingleWellState) {
|
||||||
Opm::SingleWellState ws1(true, 10, 3, 1);
|
Opm::ParallelWellInfo pinfo;
|
||||||
Opm::SingleWellState ws2(true, 10, 3, 2);
|
Opm::SingleWellState ws1(&pinfo, true, 10, 3, 1);
|
||||||
Opm::SingleWellState ws3(false, 10, 3, 3);
|
Opm::SingleWellState ws2(&pinfo, true, 10, 3, 2);
|
||||||
|
Opm::SingleWellState ws3(&pinfo, false, 10, 3, 3);
|
||||||
|
|
||||||
ws1.bhp = 100;
|
ws1.bhp = 100;
|
||||||
ws1.thp = 200;
|
ws1.thp = 200;
|
||||||
|
Loading…
Reference in New Issue
Block a user