From bdfafbd5cdc15307eee790f3e6a765d68929a365 Mon Sep 17 00:00:00 2001 From: Antonella Ritorto Date: Wed, 7 May 2025 16:50:31 +0200 Subject: [PATCH] Move the if-serial run into CpGridVanguard::addLgrs(), warn if parallel --- opm/models/utils/simulator.hh | 10 ++++------ opm/simulators/flow/CpGridVanguard.hpp | 5 ++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index 12dc7b63e5..c6353c5f51 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -139,17 +139,15 @@ public: OPM_END_PARALLEL_TRY_CATCH("Could not distribute the vanguard data: ", comm); } - // Only relevant for CpGrid + // Only relevant for CpGrid and serial runs. if (verbose_) { std::cout << "Adding LGRs, if any, in serial run\n" << std::flush; } { - if ( comm.size() == 1 ) { // serial run - OPM_BEGIN_PARALLEL_TRY_CATCH(); - vanguard_->addLgrs(); - OPM_END_PARALLEL_TRY_CATCH("Adding LGRs to the simulation vanguard in serial run failed: ", comm); - } + OPM_BEGIN_PARALLEL_TRY_CATCH(); + vanguard_->addLgrs(); + OPM_END_PARALLEL_TRY_CATCH("Adding LGRs to the simulation vanguard in serial run failed: ", comm); } if (verbose_) { diff --git a/opm/simulators/flow/CpGridVanguard.hpp b/opm/simulators/flow/CpGridVanguard.hpp index 8769e7b9b1..daf0e7d118 100644 --- a/opm/simulators/flow/CpGridVanguard.hpp +++ b/opm/simulators/flow/CpGridVanguard.hpp @@ -255,7 +255,7 @@ public: // Check if input file contains Lgrs. // // If there are lgrs, create the grid with them, and update the leaf grid view. - if (const auto& lgrs = this->eclState().getLgrs(); lgrs.size() > 0) { + if (const auto& lgrs = this->eclState().getLgrs(); (lgrs.size() > 0) && (this->grid_->comm().size() == 1)) { OpmLog::info("\nAdding LGRs to the grid and updating its leaf grid view"); this->addLgrsUpdateLeafView(lgrs, lgrs.size(), *this->grid_); @@ -263,6 +263,9 @@ public: this->updateCellDepths_(); this->updateCellThickness_(); } + else { + Opm::OpmLog::warning("Adding LGRs in parallel run is not supported yet.\n"); + } } unsigned int gridEquilIdxToGridIdx(unsigned int elemIndex) const {