mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-11-03 20:56:43 -06:00
Store group potentials in GroupState
Store the group potentials in the GroupState object so we avoid recomputing them later when we need to send the slave group potentials to the master.
This commit is contained in:
1 parent
1623f37f49
commit
6bd6c7a872
5 files changed
+49
-10
No files matched your search
@@ -475,7 +475,7 @@ namespace Opm {
|
||||
);
|
||||
#ifdef RESERVOIR_COUPLING_ENABLED
|
||||
if (this->isReservoirCouplingSlave()) {
|
||||
this->guide_rate_handler_.sendSlaveGroupPotentialsToMaster();
|
||||
this->guide_rate_handler_.sendSlaveGroupPotentialsToMaster(this->groupState());
|
||||
}
|
||||
#endif
|
||||
std::string exc_msg;
|
||||
|
||||
@@ -509,6 +509,23 @@ gconsump_rates(const std::string& gname) const {
|
||||
return zero_pair;
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
void GroupState<Scalar>::
|
||||
update_group_production_potential(const std::string& gname, Scalar oil_rate,
|
||||
Scalar gas_rate, Scalar water_rate)
|
||||
{
|
||||
this->production_group_potentials.emplace(
|
||||
gname, GroupPotential{oil_rate, gas_rate, water_rate}
|
||||
);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
const typename GroupState<Scalar>::GroupPotential&
|
||||
GroupState<Scalar>::
|
||||
get_production_group_potential(const std::string& gname) const
|
||||
{
|
||||
return this->production_group_potentials.at(gname);
|
||||
}
|
||||
|
||||
template class GroupState<double>;
|
||||
|
||||
|
||||
@@ -107,6 +107,19 @@ public:
|
||||
void update_gconsump(const Schedule& schedule, const int report_step, const SummaryState& summary_state);
|
||||
const std::pair<Scalar, Scalar>& gconsump_rates(const std::string& gname) const;
|
||||
|
||||
struct GroupPotential {
|
||||
Scalar oil_rate;
|
||||
Scalar gas_rate;
|
||||
Scalar water_rate;
|
||||
|
||||
GroupPotential(Scalar oil = 0.0, Scalar gas = 0.0, Scalar water = 0.0)
|
||||
: oil_rate(oil), gas_rate(gas), water_rate(water) {}
|
||||
};
|
||||
|
||||
void update_group_production_potential(
|
||||
const std::string& gname, Scalar oil_rate, Scalar gas_rate, Scalar water_rate
|
||||
);
|
||||
const GroupPotential& get_production_group_potential(const std::string& gname) const;
|
||||
|
||||
std::size_t data_size() const;
|
||||
std::size_t collect(Scalar* data) const;
|
||||
@@ -220,6 +233,7 @@ private:
|
||||
std::map<std::string, Scalar> m_grat_sales_target;
|
||||
std::map<std::string, Scalar> m_gpmaint_target;
|
||||
std::map<std::string, Scalar> group_thp;
|
||||
std::map<std::string, GroupPotential> production_group_potentials;
|
||||
|
||||
std::map<std::pair<Phase, std::string>, Group::InjectionCMode> injection_controls;
|
||||
WellContainer<GPMaint::State> gpmaint_state;
|
||||
|
||||
@@ -108,7 +108,7 @@ receiveMasterGroupPotentialsFromSlaves()
|
||||
template<class Scalar>
|
||||
void
|
||||
GuideRateHandler<Scalar>::
|
||||
sendSlaveGroupPotentialsToMaster()
|
||||
sendSlaveGroupPotentialsToMaster(const GroupState<Scalar>& group_state)
|
||||
{
|
||||
assert(this->isReservoirCouplingSlave());
|
||||
auto& rescoup_slave = this->reservoirCouplingSlave();
|
||||
@@ -124,10 +124,10 @@ sendSlaveGroupPotentialsToMaster()
|
||||
// For injection groups, we do not have potentials. In that case,
|
||||
// we will send dummy values (0.0) for the potentials.
|
||||
if (this->guide_rate_.hasPotentials(slave_group_name)) {
|
||||
const auto& gr_pot = this->guide_rate_.getPotentials(slave_group_name);
|
||||
pot[Potentials::Phase::Oil] = gr_pot.oil_rat;
|
||||
pot[Potentials::Phase::Gas] = gr_pot.gas_rat;
|
||||
pot[Potentials::Phase::Water] = gr_pot.wat_rat;
|
||||
const auto& gr_pot = group_state.get_production_group_potential(slave_group_name);
|
||||
pot[Potentials::Phase::Oil] = gr_pot.oil_rate;
|
||||
pot[Potentials::Phase::Gas] = gr_pot.gas_rate;
|
||||
pot[Potentials::Phase::Water] = gr_pot.water_rate;
|
||||
}
|
||||
potentials.push_back(pot);
|
||||
}
|
||||
@@ -444,7 +444,7 @@ UpdateGuideRates(
|
||||
const int report_step_idx,
|
||||
const double sim_time,
|
||||
const WellState<Scalar>& well_state,
|
||||
const GroupState<Scalar>& group_state,
|
||||
GroupState<Scalar>& group_state,
|
||||
const int num_phases
|
||||
) : parent_{parent}
|
||||
, report_step_idx_{report_step_idx}
|
||||
@@ -609,6 +609,14 @@ updateGuideRatesForProductionGroups_(const Group& group, std::vector<Scalar>& po
|
||||
this->guideRate().compute(
|
||||
group.name(), this->report_step_idx_, this->sim_time_, oil_pot, gas_pot, water_pot
|
||||
);
|
||||
// NOTE: For reservoir coupling: We will later need to send the slave group potentials
|
||||
// to the master. The above call to GuideRate::compute() will as a side-effect store
|
||||
// them in the GuideRate object. But those potentials are meant to be internal to the
|
||||
// GuideRate object, so we choose to store the potentials in the GroupState object
|
||||
// below for this reason.
|
||||
this->group_state_.update_group_production_potential(
|
||||
group.name(), oil_pot, gas_pot, water_pot
|
||||
);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
const int report_step_idx,
|
||||
const double sim_time,
|
||||
const WellState<Scalar> &well_state,
|
||||
const GroupState<Scalar> &group_state,
|
||||
GroupState<Scalar> &group_state,
|
||||
const int num_phases
|
||||
);
|
||||
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
const int report_step_idx_;
|
||||
const double sim_time_;
|
||||
const WellState<Scalar> &well_state_;
|
||||
const GroupState<Scalar> &group_state_;
|
||||
GroupState<Scalar> &group_state_;
|
||||
const int num_phases_;
|
||||
const UnitSystem& unit_system_;
|
||||
};
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
void receiveMasterGroupPotentialsFromSlaves();
|
||||
ReservoirCouplingMaster& reservoirCouplingMaster() { return *(this->reservoir_coupling_master_); }
|
||||
ReservoirCouplingSlave& reservoirCouplingSlave() { return *(this->reservoir_coupling_slave_); }
|
||||
void sendSlaveGroupPotentialsToMaster();
|
||||
void sendSlaveGroupPotentialsToMaster(const GroupState<Scalar>& group_state);
|
||||
void setReservoirCouplingMaster(ReservoirCouplingMaster *reservoir_coupling_master) {
|
||||
this->reservoir_coupling_master_ = reservoir_coupling_master;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user