mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fix RFT output for non-root connections..
This commit is contained in:
parent
f7ac4f8a3c
commit
4bc904d941
@ -435,6 +435,8 @@ public:
|
||||
this->outputModule_->assignToSolution(localCellData);
|
||||
}
|
||||
|
||||
// Collect RFT data on rank 0
|
||||
this->outputModule_->accumulateRftDataParallel(simulator_.gridView().comm());
|
||||
// Add cell data to perforations for RFT output
|
||||
this->outputModule_->addRftDataToWells(localWellData, reportStepNum);
|
||||
}
|
||||
|
@ -209,7 +209,6 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
}
|
||||
|
||||
// Add inactive wells to all ranks with connections (not solved, so OK even without distributed wells)
|
||||
// @NOTE: Approach below is just for testing, there has to be a better way...
|
||||
std::unordered_set<unsigned> cellOnRank;
|
||||
const auto& global_cells = this->grid_->globalCell();
|
||||
for (const auto cell : global_cells) cellOnRank.insert(cell);
|
||||
@ -229,7 +228,7 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
std::vector<int> well_on_rank_global(nranks, 0);
|
||||
comm.max(&well_on_rank[0], nranks);
|
||||
for (int i=0; i<nranks; ++i) {
|
||||
if (well_on_rank_global[i]) {
|
||||
if (well_on_rank[i]) {
|
||||
parallelWells.emplace_back(well_name, i);
|
||||
}
|
||||
}
|
||||
|
@ -391,6 +391,54 @@ outputFipAndResvLog(const Inplace& inplace,
|
||||
}
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void GenericOutputBlackoilModule<FluidSystem>::
|
||||
accumulateRftDataParallel(const Parallel::Communication& comm) {
|
||||
if (comm.size() > 1) {
|
||||
collectRftMapOnRoot(oilConnectionPressures_, comm);
|
||||
collectRftMapOnRoot(waterConnectionSaturations_, comm);
|
||||
collectRftMapOnRoot(gasConnectionSaturations_, comm);
|
||||
}
|
||||
}
|
||||
|
||||
template<class FluidSystem>
|
||||
void GenericOutputBlackoilModule<FluidSystem>::
|
||||
collectRftMapOnRoot(std::map<std::size_t, Scalar>& local_map, const Parallel::Communication& comm) {
|
||||
|
||||
const auto mapsize = local_map.size();
|
||||
std::vector<int> keys;
|
||||
std::vector<Scalar> values;
|
||||
keys.reserve(mapsize);
|
||||
values.reserve(mapsize);
|
||||
for (const auto& [key, value] : local_map) {
|
||||
keys.push_back(key);
|
||||
values.push_back(value);
|
||||
}
|
||||
|
||||
std::vector<int> all_keys;
|
||||
std::vector<Scalar> all_values;
|
||||
std::vector<int> offsets;
|
||||
|
||||
std::tie(all_keys, offsets) = Opm::gatherv(keys, comm, 0);
|
||||
std::tie(all_values, std::ignore) = Opm::gatherv(values, comm, 0);
|
||||
assert(all_keys.size() == all_values.size());
|
||||
|
||||
// Insert/update map values on root
|
||||
if (comm.rank() == 0) {
|
||||
for (auto i=static_cast<std::size_t>(offsets[1]); i<all_keys.size(); ++i) {
|
||||
const auto index = all_keys[i];
|
||||
if (local_map.count(index)>0) {
|
||||
const Scalar prev_value = local_map[index];
|
||||
local_map[index] = std::max(prev_value, all_values[i]);
|
||||
} else {
|
||||
local_map[index] = all_values[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class FluidSystem>
|
||||
void GenericOutputBlackoilModule<FluidSystem>::
|
||||
addRftDataToWells(data::Wells& wellDatas, std::size_t reportStepNum)
|
||||
|
@ -109,6 +109,8 @@ public:
|
||||
|
||||
void outputErrorLog(const Parallel::Communication& comm) const;
|
||||
|
||||
void accumulateRftDataParallel(const Parallel::Communication& comm);
|
||||
|
||||
void addRftDataToWells(data::Wells& wellDatas,
|
||||
std::size_t reportStepNum);
|
||||
|
||||
@ -381,6 +383,8 @@ protected:
|
||||
|
||||
virtual bool isDefunctParallelWell(std::string wname) const = 0;
|
||||
|
||||
void collectRftMapOnRoot(std::map<std::size_t, Scalar>& local_map, const Parallel::Communication& comm);
|
||||
|
||||
const EclipseState& eclState_;
|
||||
const Schedule& schedule_;
|
||||
const SummaryState& summaryState_;
|
||||
|
Loading…
Reference in New Issue
Block a user