diff --git a/ebos/equil/initstateequil.hh b/ebos/equil/initstateequil.hh index e7d03b6ef..6c200ac55 100644 --- a/ebos/equil/initstateequil.hh +++ b/ebos/equil/initstateequil.hh @@ -1713,7 +1713,7 @@ public: // Compute pressures, saturations, rs and rv factors. const auto& comm = gridView.comm(); - calcPressSatRsRv(eqlmap, rec, materialLawManager, gridView, num_aquifers, comm, grav); + calcPressSatRsRv(eqlmap, rec, materialLawManager, num_aquifers, comm, grav); // Modify oil pressure in no-oil regions so that the pressures of present phases can // be recovered from the oil pressure and capillary relations. @@ -1824,9 +1824,8 @@ private: template void calcPressSatRsRv(const RMap& reg, - const std::vector< Opm::EquilRecord >& rec, + const std::vector& rec, MaterialLawManager& materialLawManager, - const GridView& gridView, const NumericalAquifers& aquifer, const Comm& comm, const double grav) @@ -1864,7 +1863,7 @@ private: const auto acc = eqreg.equilibrationAccuracy(); if (acc == 0) { // Centre-point method - this->equilibrateCellCentres(cells, eqreg, ptable, gridView, aquifer, psat); + this->equilibrateCellCentres(cells, eqreg, ptable, aquifer, psat); } else if (acc < 0) { // Horizontal subdivision @@ -1925,12 +1924,11 @@ private: } template - void equilibrateCellCentres(const CellRange& cells, - const EquilReg& eqreg, - const PressTable& ptable, - const GridView& gridView, + void equilibrateCellCentres(const CellRange& cells, + const EquilReg& eqreg, + const PressTable& ptable, const NumericalAquifers& aquifer, - PhaseSat& psat) + PhaseSat& psat) { using CellPos = typename PhaseSat::Position; using CellID = std::remove_cv_tcell_to_aquifer_cell_idx_[cell_idx] = idx; + const auto search = cartesian_to_compressed.find(global_idx); + // Due to parallelisation, the cell might not exist in the current process + if (search != cartesian_to_compressed.end()) { + const int cell_idx = cartesian_to_compressed.at(global_idx); + this->cell_to_aquifer_cell_idx_[cell_idx] = idx; + } } } - void initFromRestart(const std::vector& aquiferSoln) + void initFromRestart([[maybe_unused]]const std::vector& aquiferSoln) { // NOT handling Restart for now } @@ -148,6 +152,9 @@ private: sum_watervolume += water_volume; } + const auto& comm = this->ebos_simulator_.vanguard().grid().comm(); + comm.sum(&sum_pressure_watervolume, 1); + comm.sum(&sum_watervolume, 1); return sum_pressure_watervolume / sum_watervolume; } @@ -208,6 +215,8 @@ private: break; } + const auto& comm = this->ebos_simulator_.vanguard().grid().comm(); + comm.sum(&aquifer_flux, 1); return aquifer_flux; } };