diff --git a/opm/simulators/utils/ParallelEclipseState.cpp b/opm/simulators/utils/ParallelEclipseState.cpp index b7db316d1..8b88182ca 100644 --- a/opm/simulators/utils/ParallelEclipseState.cpp +++ b/opm/simulators/utils/ParallelEclipseState.cpp @@ -74,8 +74,26 @@ const std::vector& ParallelFieldPropsManager::get_int(const std::string& ke std::vector ParallelFieldPropsManager::get_global_int(const std::string& keyword) const { std::vector result; + int exceptionThrown{}; + if (m_comm.rank() == 0) - result = m_manager.get_global_int(keyword); + { + try + { + result = m_manager.get_global_int(keyword); + }catch(std::exception& e) { + exceptionThrown = 1; + OpmLog::error("No integer property field: " + keyword + " ("+e.what()+")"); + m_comm.broadcast(&exceptionThrown, 1, 0); + throw e; + } + } + + m_comm.broadcast(&exceptionThrown, 1, 0); + + if (exceptionThrown) + OPM_THROW_NOLOG(std::runtime_error, "No integer property field: " + keyword); + size_t size = result.size(); m_comm.broadcast(&size, 1, 0); result.resize(size); @@ -98,8 +116,26 @@ const std::vector& ParallelFieldPropsManager::get_double(const std::stri std::vector ParallelFieldPropsManager::get_global_double(const std::string& keyword) const { std::vector result; + int exceptionThrown{}; + if (m_comm.rank() == 0) - result = m_manager.get_global_double(keyword); + { + try + { + result = m_manager.get_global_double(keyword); + }catch(std::exception& e) { + exceptionThrown = 1; + OpmLog::error("No double property field: " + keyword + " ("+e.what()+")"); + m_comm.broadcast(&exceptionThrown, 1, 0); + throw e; + } + } + + m_comm.broadcast(&exceptionThrown, 1, 0); + + if (exceptionThrown) + OPM_THROW_NOLOG(std::runtime_error, "No double property field: " + keyword); + size_t size = result.size(); m_comm.broadcast(&size, 1, 0); result.resize(size);