2020-08-17 09:10:18 -05:00
|
|
|
/*
|
|
|
|
Copyright 2013, 2014, 2015 SINTEF ICT, Applied Mathematics.
|
|
|
|
Copyright 2014 Dr. Blatt - HPC-Simulation-Software & Services
|
|
|
|
Copyright 2015 IRIS AS
|
|
|
|
Copyright 2014 STATOIL ASA.
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#if HAVE_MPI
|
|
|
|
#include "mpi.h"
|
|
|
|
#endif
|
|
|
|
#include "readDeck.hpp"
|
|
|
|
|
2021-05-28 03:20:10 -05:00
|
|
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
2021-04-29 02:56:14 -05:00
|
|
|
#include <opm/common/OpmLog/EclipsePRTLog.hpp>
|
2020-08-17 09:10:18 -05:00
|
|
|
#include <opm/common/utility/String.hpp>
|
2020-09-25 04:59:05 -05:00
|
|
|
#include <opm/common/utility/OpmInputError.hpp>
|
2021-04-26 15:39:32 -05:00
|
|
|
#include <opm/common/ErrorMacros.hpp>
|
2021-04-29 02:56:14 -05:00
|
|
|
#include <opm/common/utility/FileSystem.hpp>
|
2020-08-17 09:10:18 -05:00
|
|
|
|
|
|
|
#include <opm/io/eclipse/EclIOdata.hpp>
|
|
|
|
|
|
|
|
#include <opm/output/eclipse/RestartIO.hpp>
|
2021-06-25 02:11:09 -05:00
|
|
|
#include <opm/io/eclipse/ERst.hpp>
|
|
|
|
#include <opm/io/eclipse/RestartFileView.hpp>
|
2021-06-22 09:23:43 -05:00
|
|
|
#include <opm/io/eclipse/rst/aquifer.hpp>
|
2020-08-17 09:10:18 -05:00
|
|
|
#include <opm/io/eclipse/rst/state.hpp>
|
|
|
|
|
2021-04-29 03:14:04 -05:00
|
|
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
2020-08-17 09:10:18 -05:00
|
|
|
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
2021-04-29 02:56:14 -05:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
2021-07-01 01:24:59 -05:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
|
2021-09-19 03:17:58 -05:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
|
2021-04-29 02:56:14 -05:00
|
|
|
|
|
|
|
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
2020-08-17 09:10:18 -05:00
|
|
|
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
|
|
|
|
2021-04-09 15:20:38 -05:00
|
|
|
#include "UnsupportedFlowKeywords.hpp"
|
|
|
|
#include "PartiallySupportedFlowKeywords.hpp"
|
|
|
|
#include <opm/simulators/flow/KeywordValidation.hpp>
|
2021-07-23 02:58:52 -05:00
|
|
|
#include <opm/simulators/flow/ValidationFunctions.hpp>
|
2021-04-09 15:20:38 -05:00
|
|
|
|
2020-08-17 09:10:18 -05:00
|
|
|
#include <opm/simulators/utils/ParallelEclipseState.hpp>
|
|
|
|
#include <opm/simulators/utils/ParallelSerialization.hpp>
|
|
|
|
|
2020-09-28 04:01:13 -05:00
|
|
|
#include <fmt/format.h>
|
|
|
|
|
2020-09-14 12:17:55 -05:00
|
|
|
#include <cstdlib>
|
2021-07-23 02:58:52 -05:00
|
|
|
#include <functional>
|
2021-06-25 02:11:09 -05:00
|
|
|
#include <memory>
|
2021-07-23 02:58:52 -05:00
|
|
|
#include <unordered_map>
|
2021-06-25 02:11:09 -05:00
|
|
|
#include <utility>
|
2020-09-14 12:17:55 -05:00
|
|
|
|
2020-08-17 09:10:18 -05:00
|
|
|
namespace Opm
|
|
|
|
{
|
|
|
|
|
|
|
|
void ensureOutputDirExists_(const std::string& cmdline_output_dir)
|
|
|
|
{
|
|
|
|
if (!Opm::filesystem::is_directory(cmdline_output_dir)) {
|
|
|
|
try {
|
|
|
|
Opm::filesystem::create_directories(cmdline_output_dir);
|
|
|
|
}
|
|
|
|
catch (...) {
|
2020-09-28 04:01:13 -05:00
|
|
|
throw std::runtime_error(fmt::format("Creation of output directory '{}' failed\n", cmdline_output_dir));
|
2020-08-17 09:10:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup the OpmLog backends
|
|
|
|
FileOutputMode setupLogging(int mpi_rank_, const std::string& deck_filename, const std::string& cmdline_output_dir, const std::string& cmdline_output, bool output_cout_, const std::string& stdout_log_id) {
|
|
|
|
|
|
|
|
if (!cmdline_output_dir.empty()) {
|
|
|
|
ensureOutputDirExists_(cmdline_output_dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
// create logFile
|
|
|
|
using Opm::filesystem::path;
|
|
|
|
path fpath(deck_filename);
|
|
|
|
std::string baseName;
|
|
|
|
std::ostringstream debugFileStream;
|
|
|
|
std::ostringstream logFileStream;
|
|
|
|
|
|
|
|
// Strip extension "." or ".DATA"
|
|
|
|
std::string extension = uppercase(fpath.extension().string());
|
|
|
|
if (extension == ".DATA" || extension == ".") {
|
|
|
|
baseName = uppercase(fpath.stem().string());
|
|
|
|
} else {
|
|
|
|
baseName = uppercase(fpath.filename().string());
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string output_dir = cmdline_output_dir;
|
|
|
|
if (output_dir.empty()) {
|
|
|
|
output_dir = fpath.has_parent_path()
|
|
|
|
? absolute(fpath.parent_path()).generic_string()
|
|
|
|
: Opm::filesystem::current_path().generic_string();
|
|
|
|
}
|
|
|
|
|
|
|
|
logFileStream << output_dir << "/" << baseName;
|
|
|
|
debugFileStream << output_dir << "/" << baseName;
|
|
|
|
|
|
|
|
if (mpi_rank_ != 0) {
|
|
|
|
// Added rank to log file for non-zero ranks.
|
|
|
|
// This prevents message loss.
|
|
|
|
debugFileStream << "." << mpi_rank_;
|
|
|
|
// If the following file appears then there is a bug.
|
|
|
|
logFileStream << "." << mpi_rank_;
|
|
|
|
}
|
|
|
|
logFileStream << ".PRT";
|
|
|
|
debugFileStream << ".DBG";
|
|
|
|
|
|
|
|
FileOutputMode output;
|
|
|
|
{
|
|
|
|
static std::map<std::string, FileOutputMode> stringToOutputMode =
|
|
|
|
{ {"none", FileOutputMode::OUTPUT_NONE },
|
|
|
|
{"false", FileOutputMode::OUTPUT_LOG_ONLY },
|
|
|
|
{"log", FileOutputMode::OUTPUT_LOG_ONLY },
|
|
|
|
{"all" , FileOutputMode::OUTPUT_ALL },
|
|
|
|
{"true" , FileOutputMode::OUTPUT_ALL }};
|
|
|
|
auto outputModeIt = stringToOutputMode.find(cmdline_output);
|
|
|
|
if (outputModeIt != stringToOutputMode.end()) {
|
|
|
|
output = outputModeIt->second;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
output = FileOutputMode::OUTPUT_ALL;
|
|
|
|
std::cerr << "Value " << cmdline_output <<
|
|
|
|
" is not a recognized output mode. Using \"all\" instead."
|
|
|
|
<< std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (output > FileOutputMode::OUTPUT_NONE) {
|
|
|
|
std::shared_ptr<Opm::EclipsePRTLog> prtLog = std::make_shared<Opm::EclipsePRTLog>(logFileStream.str(), Opm::Log::NoDebugMessageTypes, false, output_cout_);
|
|
|
|
Opm::OpmLog::addBackend("ECLIPSEPRTLOG", prtLog);
|
|
|
|
prtLog->setMessageLimiter(std::make_shared<Opm::MessageLimiter>());
|
|
|
|
prtLog->setMessageFormatter(std::make_shared<Opm::SimpleMessageFormatter>(false));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (output >= FileOutputMode::OUTPUT_LOG_ONLY) {
|
|
|
|
std::string debugFile = debugFileStream.str();
|
|
|
|
std::shared_ptr<Opm::StreamLog> debugLog = std::make_shared<Opm::EclipsePRTLog>(debugFileStream.str(), Opm::Log::DefaultMessageTypes, false, output_cout_);
|
|
|
|
Opm::OpmLog::addBackend("DEBUGLOG", debugLog);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mpi_rank_ == 0) {
|
|
|
|
std::shared_ptr<Opm::StreamLog> streamLog = std::make_shared<Opm::StreamLog>(std::cout, Opm::Log::StdoutMessageTypes);
|
|
|
|
Opm::OpmLog::addBackend(stdout_log_id, streamLog);
|
2021-05-28 03:20:10 -05:00
|
|
|
|
|
|
|
bool use_color_coding = OpmLog::stdoutIsTerminal();
|
|
|
|
streamLog->setMessageFormatter(std::make_shared<Opm::SimpleMessageFormatter>(use_color_coding));
|
2020-08-17 09:10:18 -05:00
|
|
|
}
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-15 02:49:22 -05:00
|
|
|
namespace {
|
2020-08-17 09:10:18 -05:00
|
|
|
void setupMessageLimiter(const Opm::MessageLimits msgLimits, const std::string& stdout_log_id) {
|
|
|
|
std::shared_ptr<Opm::StreamLog> stream_log = Opm::OpmLog::getBackend<Opm::StreamLog>(stdout_log_id);
|
|
|
|
|
|
|
|
const std::map<int64_t, int> limits = {{Opm::Log::MessageType::Note,
|
2021-01-11 10:52:39 -06:00
|
|
|
msgLimits.getCommentPrintLimit()},
|
2020-08-17 09:10:18 -05:00
|
|
|
{Opm::Log::MessageType::Info,
|
2021-01-11 10:52:39 -06:00
|
|
|
msgLimits.getMessagePrintLimit()},
|
2020-08-17 09:10:18 -05:00
|
|
|
{Opm::Log::MessageType::Warning,
|
2021-01-11 10:52:39 -06:00
|
|
|
msgLimits.getWarningPrintLimit()},
|
2020-08-17 09:10:18 -05:00
|
|
|
{Opm::Log::MessageType::Error,
|
2021-01-11 10:52:39 -06:00
|
|
|
msgLimits.getErrorPrintLimit()},
|
2020-08-17 09:10:18 -05:00
|
|
|
{Opm::Log::MessageType::Problem,
|
2021-01-11 10:52:39 -06:00
|
|
|
msgLimits.getProblemPrintLimit()},
|
2020-08-17 09:10:18 -05:00
|
|
|
{Opm::Log::MessageType::Bug,
|
2021-01-11 10:52:39 -06:00
|
|
|
msgLimits.getBugPrintLimit()}};
|
2020-08-17 09:10:18 -05:00
|
|
|
stream_log->setMessageLimiter(std::make_shared<Opm::MessageLimiter>(10, limits));
|
|
|
|
}
|
2020-09-15 02:49:22 -05:00
|
|
|
}
|
2020-08-17 09:10:18 -05:00
|
|
|
|
|
|
|
|
2021-05-25 05:57:11 -05:00
|
|
|
void readDeck(Opm::Parallel::Communication comm, std::string& deckFilename, std::shared_ptr<Opm::Deck>& deck, std::shared_ptr<Opm::EclipseState>& eclipseState,
|
2021-09-20 18:13:39 -05:00
|
|
|
std::shared_ptr<Opm::Schedule>& schedule, std::unique_ptr<UDQState>& udqState, std::unique_ptr<Action::State>& actionState, std::shared_ptr<Opm::SummaryConfig>& summaryConfig,
|
2020-08-18 05:35:55 -05:00
|
|
|
std::unique_ptr<ErrorGuard> errorGuard, std::shared_ptr<Opm::Python>& python, std::unique_ptr<ParseContext> parseContext,
|
2021-03-08 10:17:09 -06:00
|
|
|
bool initFromRestart, bool checkDeck, const std::optional<int>& outputInterval)
|
2020-08-17 09:10:18 -05:00
|
|
|
{
|
2020-08-18 05:35:55 -05:00
|
|
|
if (!errorGuard)
|
|
|
|
{
|
|
|
|
errorGuard = std::make_unique<ErrorGuard>();
|
|
|
|
}
|
2020-08-17 09:10:18 -05:00
|
|
|
|
2020-09-14 05:53:02 -05:00
|
|
|
int parseSuccess = 1; // > 0 is success
|
2020-08-17 09:10:18 -05:00
|
|
|
std::string failureMessage;
|
2021-05-25 05:57:11 -05:00
|
|
|
int rank = comm.rank();
|
2020-08-17 09:10:18 -05:00
|
|
|
|
|
|
|
if (rank==0) {
|
|
|
|
try
|
|
|
|
{
|
2021-09-09 04:14:52 -05:00
|
|
|
Opm::Parser parser;
|
2020-08-18 05:35:55 -05:00
|
|
|
if ( (!deck || !schedule || !summaryConfig ) && !parseContext)
|
|
|
|
{
|
|
|
|
OPM_THROW(std::logic_error, "We need a parse context if deck, schedule, or summaryConfig are not initialized");
|
|
|
|
}
|
|
|
|
|
2020-08-17 09:10:18 -05:00
|
|
|
if (!deck)
|
2020-08-18 05:35:55 -05:00
|
|
|
{
|
2021-07-23 02:58:52 -05:00
|
|
|
|
2021-05-25 05:57:11 -05:00
|
|
|
|
2020-08-18 09:27:51 -05:00
|
|
|
deck = std::make_unique<Opm::Deck>( parser.parseFile(deckFilename , *parseContext, *errorGuard));
|
2021-04-09 15:20:38 -05:00
|
|
|
|
|
|
|
Opm::KeywordValidation::KeywordValidator keyword_validator(
|
2021-05-12 06:22:09 -05:00
|
|
|
Opm::FlowKeywordValidation::unsupportedKeywords(),
|
2021-05-12 06:22:09 -05:00
|
|
|
Opm::FlowKeywordValidation::partiallySupported<std::string>(),
|
2021-06-11 11:22:29 -05:00
|
|
|
Opm::FlowKeywordValidation::partiallySupported<int>(),
|
2021-07-23 02:58:52 -05:00
|
|
|
Opm::FlowKeywordValidation::partiallySupported<double>(),
|
|
|
|
Opm::KeywordValidation::specialValidation());
|
|
|
|
|
2021-04-09 15:20:38 -05:00
|
|
|
keyword_validator.validateDeck(*deck, *parseContext, *errorGuard);
|
|
|
|
|
2020-08-18 05:35:55 -05:00
|
|
|
if ( checkDeck )
|
|
|
|
Opm::checkDeck(*deck, parser, *parseContext, *errorGuard);
|
|
|
|
}
|
2020-08-17 09:10:18 -05:00
|
|
|
|
|
|
|
if (!eclipseState) {
|
2020-08-18 05:35:55 -05:00
|
|
|
#if HAVE_MPI
|
2021-05-25 05:57:11 -05:00
|
|
|
eclipseState = std::make_unique<Opm::ParallelEclipseState>(*deck, comm);
|
2020-08-17 09:10:18 -05:00
|
|
|
#else
|
2020-08-18 09:27:51 -05:00
|
|
|
eclipseState = std::make_unique<Opm::EclipseState>(*deck);
|
2020-08-17 09:10:18 -05:00
|
|
|
#endif
|
|
|
|
}
|
2021-06-22 09:23:43 -05:00
|
|
|
|
2020-08-17 09:10:18 -05:00
|
|
|
const auto& init_config = eclipseState->getInitConfig();
|
2021-06-22 09:23:43 -05:00
|
|
|
if (init_config.restartRequested()) {
|
|
|
|
// Analytic aquifers must always be loaded from the restart
|
|
|
|
// file in restarted runs and the corresponding keywords
|
|
|
|
// (e.g., AQUANCON and AQUCT) do not exist in the input deck
|
|
|
|
// in this case. In other words, there's no way to check if
|
|
|
|
// there really are analytic aquifers in the run until we
|
|
|
|
// attempt to read the specifications from the restart file.
|
|
|
|
// If the loader determines that there are no analytic
|
|
|
|
// aquifers, then 'EclipseState::loadRestartAquifers()' does
|
|
|
|
// nothing.
|
2021-06-25 02:11:09 -05:00
|
|
|
const int report_step = init_config.getRestartStep();
|
|
|
|
const auto rst_filename = eclipseState->getIOConfig().getRestartFileName( init_config.getRestartRootName(), report_step, false );
|
|
|
|
auto rst_file = std::make_shared<EclIO::ERst>(rst_filename);
|
|
|
|
auto rst_view = std::make_shared<EclIO::RestartFileView>(std::move(rst_file), report_step);
|
2021-06-22 09:23:43 -05:00
|
|
|
|
|
|
|
// Note: RstState::load() will just *read* from the grid
|
|
|
|
// structure, and only do so if the case actually includes
|
|
|
|
// analytic aquifers. The pointer to the input grid is just
|
|
|
|
// to allow 'nullptr' to signify "don't load aquifers" in
|
|
|
|
// certain unit tests. Passing an optional<EclipseGrid> is
|
|
|
|
// too expensive however since doing so will create a copy
|
|
|
|
// of the grid inside the optional<>.
|
|
|
|
const auto rst_state = RestartIO::RstState::
|
2021-09-09 04:14:52 -05:00
|
|
|
load(std::move(rst_view), eclipseState->runspec(), parser, &eclipseState->getInputGrid());
|
2021-06-22 09:23:43 -05:00
|
|
|
|
|
|
|
eclipseState->loadRestartAquifers(rst_state.aquifers);
|
|
|
|
|
|
|
|
// For the time being initializing wells and groups from the
|
|
|
|
// restart file is not possible. Work is underway and the
|
|
|
|
// ability is included here contingent on user-level switch
|
|
|
|
// 'initFromRestart' (i.e., setting "--sched-restart=false"
|
|
|
|
// as a command line invocation parameter).
|
|
|
|
const auto* init_state = initFromRestart ? &rst_state : nullptr;
|
|
|
|
if (!schedule) {
|
|
|
|
schedule = std::make_unique<Schedule>(*deck, *eclipseState,
|
|
|
|
*parseContext, *errorGuard,
|
|
|
|
python, outputInterval, init_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
udqState = std::make_unique<UDQState>((*schedule)[0].udq().params().undefinedValue());
|
2021-09-19 03:17:58 -05:00
|
|
|
actionState = std::make_unique<Action::State>();
|
2021-09-24 07:42:15 -05:00
|
|
|
udqState->load_rst(rst_state);
|
2021-09-22 05:39:40 -05:00
|
|
|
actionState->load_rst(schedule->operator[](report_step).actions(), rst_state);
|
2020-08-17 09:10:18 -05:00
|
|
|
}
|
|
|
|
else {
|
2021-06-22 09:23:43 -05:00
|
|
|
if (!schedule) {
|
|
|
|
schedule = std::make_unique<Schedule>(*deck, *eclipseState,
|
|
|
|
*parseContext, *errorGuard,
|
|
|
|
python);
|
|
|
|
}
|
|
|
|
udqState = std::make_unique<UDQState>((*schedule)[0].udq().params().undefinedValue());
|
2021-09-19 03:17:58 -05:00
|
|
|
actionState = std::make_unique<Action::State>();
|
2020-08-17 09:10:18 -05:00
|
|
|
}
|
2021-07-01 01:24:59 -05:00
|
|
|
|
2021-06-22 09:23:43 -05:00
|
|
|
|
|
|
|
if (Opm::OpmLog::hasBackend("STDOUT_LOGGER")) {
|
|
|
|
// loggers might not be set up!
|
|
|
|
setupMessageLimiter((*schedule)[0].message_limits(), "STDOUT_LOGGER");
|
2020-08-18 12:28:53 -05:00
|
|
|
}
|
2021-06-22 09:23:43 -05:00
|
|
|
|
|
|
|
if (!summaryConfig) {
|
|
|
|
summaryConfig = std::make_unique<Opm::SummaryConfig>(*deck, *schedule, eclipseState->fieldProps(),
|
2020-09-28 08:04:29 -05:00
|
|
|
eclipseState->aquifer(), *parseContext, *errorGuard);
|
2021-06-22 09:23:43 -05:00
|
|
|
}
|
2020-09-14 05:53:02 -05:00
|
|
|
|
2020-09-15 01:26:23 -05:00
|
|
|
Opm::checkConsistentArrayDimensions(*eclipseState, *schedule, *parseContext, *errorGuard);
|
2020-08-17 09:10:18 -05:00
|
|
|
}
|
2020-09-25 04:59:05 -05:00
|
|
|
catch(const OpmInputError& input_error) {
|
|
|
|
failureMessage = input_error.what();
|
|
|
|
parseSuccess = 0;
|
|
|
|
}
|
|
|
|
catch(const std::exception& std_error)
|
2020-08-17 09:10:18 -05:00
|
|
|
{
|
2020-09-25 04:59:05 -05:00
|
|
|
failureMessage = std_error.what();
|
2020-09-14 05:53:02 -05:00
|
|
|
parseSuccess = 0;
|
2020-08-17 09:10:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#if HAVE_MPI
|
|
|
|
else {
|
|
|
|
if (!summaryConfig)
|
2020-08-18 09:27:51 -05:00
|
|
|
summaryConfig = std::make_unique<Opm::SummaryConfig>();
|
2020-08-17 09:10:18 -05:00
|
|
|
if (!schedule)
|
2020-08-18 09:27:51 -05:00
|
|
|
schedule = std::make_unique<Opm::Schedule>(python);
|
2020-08-17 09:10:18 -05:00
|
|
|
if (!eclipseState)
|
2021-05-25 05:57:11 -05:00
|
|
|
eclipseState = std::make_unique<Opm::ParallelEclipseState>(comm);
|
2021-09-24 07:42:15 -05:00
|
|
|
if (!udqState)
|
|
|
|
udqState = std::make_unique<UDQState>(0);
|
|
|
|
if (!actionState)
|
|
|
|
actionState = std::make_unique<Action::State>();
|
2020-08-17 09:10:18 -05:00
|
|
|
}
|
2020-09-14 05:53:02 -05:00
|
|
|
|
2021-09-01 10:08:38 -05:00
|
|
|
// In case of parse errors eclipseState/schedule might be null
|
|
|
|
// and trigger segmentation faults in parallel during broadcast
|
|
|
|
// (e.g. when serializing the non-existent TableManager)
|
|
|
|
parseSuccess = comm.min(parseSuccess);
|
2020-09-14 05:53:02 -05:00
|
|
|
try
|
|
|
|
{
|
2021-09-01 10:08:38 -05:00
|
|
|
if (parseSuccess)
|
|
|
|
{
|
2021-05-25 05:57:11 -05:00
|
|
|
Opm::eclStateBroadcast(comm, *eclipseState, *schedule, *summaryConfig, *udqState, *actionState);
|
2021-09-01 10:08:38 -05:00
|
|
|
}
|
2020-09-14 05:53:02 -05:00
|
|
|
}
|
2020-09-25 04:59:05 -05:00
|
|
|
catch(const std::exception& broadcast_error)
|
2020-09-14 05:53:02 -05:00
|
|
|
{
|
2020-09-25 04:59:05 -05:00
|
|
|
failureMessage = broadcast_error.what();
|
2020-09-25 05:01:01 -05:00
|
|
|
OpmLog::error(fmt::format("Distributing properties to all processes failed\n"
|
|
|
|
"Internal error message: {}", broadcast_error.what()));
|
2020-09-14 05:53:02 -05:00
|
|
|
parseSuccess = 0;
|
|
|
|
}
|
|
|
|
|
2020-09-15 01:27:04 -05:00
|
|
|
#endif
|
|
|
|
|
2020-09-14 05:53:02 -05:00
|
|
|
if (*errorGuard) { // errors encountered
|
|
|
|
parseSuccess = 0;
|
2020-09-25 05:01:01 -05:00
|
|
|
errorGuard->dump();
|
|
|
|
errorGuard->clear();
|
2020-09-14 05:53:02 -05:00
|
|
|
}
|
2020-08-17 09:10:18 -05:00
|
|
|
|
2021-05-25 05:57:11 -05:00
|
|
|
parseSuccess = comm.min(parseSuccess);
|
2020-08-17 09:10:18 -05:00
|
|
|
|
2020-09-14 05:53:02 -05:00
|
|
|
if (!parseSuccess)
|
|
|
|
{
|
|
|
|
if (rank == 0)
|
|
|
|
{
|
2020-09-25 05:01:01 -05:00
|
|
|
OpmLog::error("Unrecoverable errors were encountered while loading input");
|
2020-09-14 05:53:02 -05:00
|
|
|
}
|
|
|
|
#if HAVE_MPI
|
|
|
|
MPI_Finalize();
|
|
|
|
#endif
|
2020-09-15 01:36:20 -05:00
|
|
|
std::exit(EXIT_FAILURE);
|
2020-08-17 09:10:18 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // end namespace Opm
|