mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Skip wells not owned when communicating goup rates.
This commit is contained in:
parent
4edca71a1b
commit
580ef249b3
@ -61,6 +61,7 @@ namespace Opm
|
||||
wellMap_.clear();
|
||||
|
||||
well_perf_data_ = well_perf_data;
|
||||
parallel_well_info_ = parallel_well_info;
|
||||
|
||||
{
|
||||
// const int nw = wells->number_of_wells;
|
||||
@ -421,6 +422,7 @@ namespace Opm
|
||||
|
||||
protected:
|
||||
std::vector<std::vector<PerforationData>> well_perf_data_;
|
||||
std::vector<ParallelWellInfo*> parallel_well_info_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -83,6 +83,10 @@ namespace Opm
|
||||
// call init on base class
|
||||
BaseType :: init(cellPressures, wells_ecl, parallel_well_info, pu, well_perf_data, summary_state);
|
||||
|
||||
for (const auto& winfo: parallel_well_info)
|
||||
{
|
||||
well_rates.insert({winfo->name(), std::make_pair(winfo->isOwner(), std::vector<double>())});
|
||||
}
|
||||
globalIsInjectionGrup_.assign(globalNumberOfWells,0);
|
||||
globalIsProductionGrup_.assign(globalNumberOfWells,0);
|
||||
wellNameToGlobalIdx_.clear();
|
||||
@ -387,7 +391,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
void setCurrentWellRates(const std::string& wellName, const std::vector<double>& rates ) {
|
||||
well_rates[wellName] = rates;
|
||||
well_rates[wellName].second = rates;
|
||||
}
|
||||
|
||||
const std::vector<double>& currentWellRates(const std::string& wellName) const {
|
||||
@ -396,7 +400,7 @@ namespace Opm
|
||||
if (it == well_rates.end())
|
||||
OPM_THROW(std::logic_error, "Could not find any rates for well " << wellName);
|
||||
|
||||
return it->second;
|
||||
return it->second.second;
|
||||
}
|
||||
|
||||
bool hasWellRates(const std::string& wellName) const {
|
||||
@ -1057,11 +1061,27 @@ namespace Opm
|
||||
// Create a function that calls some function
|
||||
// for all the individual data items to simplify
|
||||
// the further code.
|
||||
auto iterateContainer = [](auto& container, auto& func) {
|
||||
auto iterateContainer = [this](auto& container, auto& func) {
|
||||
for (auto& x : container) {
|
||||
func(x.second);
|
||||
}
|
||||
};
|
||||
auto iterateRatesContainer = [this](auto& container, auto& func) {
|
||||
for (auto& x : container) {
|
||||
if (x.second.first)
|
||||
{
|
||||
func(x.second.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We might actually store non-zero values for
|
||||
// distributed wells even if they are not owned.
|
||||
std::vector<double> dummyRate;
|
||||
dummyRate.assign(x.second.second.size(), 0);
|
||||
func(dummyRate);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
auto forAllGroupData = [&](auto& func) {
|
||||
iterateContainer(injection_group_rein_rates, func);
|
||||
@ -1069,7 +1089,7 @@ namespace Opm
|
||||
iterateContainer(injection_group_reduction_rates, func);
|
||||
iterateContainer(injection_group_reservoir_rates, func);
|
||||
iterateContainer(production_group_rates, func);
|
||||
iterateContainer(well_rates, func);
|
||||
iterateRatesContainer(well_rates, func);
|
||||
};
|
||||
|
||||
// Compute the size of the data.
|
||||
@ -1219,7 +1239,7 @@ namespace Opm
|
||||
std::map<std::string, Group::ProductionCMode> current_production_group_controls_;
|
||||
std::map<std::pair<Opm::Phase, std::string>, Group::InjectionCMode> current_injection_group_controls_;
|
||||
|
||||
std::map<std::string, std::vector<double>> well_rates;
|
||||
std::map<std::string, std::pair<bool, std::vector<double>>> well_rates;
|
||||
std::map<std::string, std::vector<double>> production_group_rates;
|
||||
std::map<std::string, std::vector<double>> production_group_reduction_rates;
|
||||
std::map<std::string, std::vector<double>> injection_group_reduction_rates;
|
||||
|
Loading…
Reference in New Issue
Block a user