mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Main: move code for reading deck to compile unit
This commit is contained in:
parent
1729c1a414
commit
82d2146c90
@ -23,6 +23,8 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <opm/simulators/flow/Main.hpp>
|
#include <opm/simulators/flow/Main.hpp>
|
||||||
|
|
||||||
|
#include <opm/simulators/utils/readDeck.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
Main::Main(int argc, char** argv)
|
Main::Main(int argc, char** argv)
|
||||||
@ -154,4 +156,46 @@ void Main::handleTestSplitCommunicatorCmdLine_()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Main::readDeck(const std::string& deckFilename,
|
||||||
|
const std::string& outputDir,
|
||||||
|
const std::string& outputMode,
|
||||||
|
const bool init_from_restart_file,
|
||||||
|
const bool allRanksDbgPrtLog,
|
||||||
|
const bool strictParsing,
|
||||||
|
const int mpiRank,
|
||||||
|
const int output_param)
|
||||||
|
{
|
||||||
|
auto omode = setupLogging(mpiRank,
|
||||||
|
deckFilename,
|
||||||
|
outputDir,
|
||||||
|
outputMode,
|
||||||
|
outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog);
|
||||||
|
|
||||||
|
if (outputCout_) {
|
||||||
|
OpmLog::info("Reading deck file '" + deckFilename + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<int> outputInterval;
|
||||||
|
if (output_param >= 0)
|
||||||
|
outputInterval = output_param;
|
||||||
|
|
||||||
|
Opm::readDeck(EclGenericVanguard::comm(),
|
||||||
|
deckFilename,
|
||||||
|
eclipseState_,
|
||||||
|
schedule_,
|
||||||
|
udqState_,
|
||||||
|
actionState_,
|
||||||
|
wtestState_,
|
||||||
|
summaryConfig_,
|
||||||
|
std::make_shared<Python>(),
|
||||||
|
strictParsing,
|
||||||
|
init_from_restart_file,
|
||||||
|
outputCout_,
|
||||||
|
outputInterval);
|
||||||
|
|
||||||
|
verifyValidCellGeometry(EclGenericVanguard::comm(), *this->eclipseState_);
|
||||||
|
|
||||||
|
outputFiles_ = (omode != FileOutputMode::OUTPUT_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
#include <opm/models/utils/parametersystem.hh>
|
#include <opm/models/utils/parametersystem.hh>
|
||||||
|
|
||||||
#include <opm/simulators/flow/FlowMainEbos.hpp>
|
#include <opm/simulators/flow/FlowMainEbos.hpp>
|
||||||
#include <opm/simulators/utils/readDeck.hpp>
|
|
||||||
|
|
||||||
#if HAVE_DUNE_FEM
|
#if HAVE_DUNE_FEM
|
||||||
#include <dune/fem/misc/mpimanager.hh>
|
#include <dune/fem/misc/mpimanager.hh>
|
||||||
@ -369,7 +368,6 @@ private:
|
|||||||
#endif // HAVE_DAMARIS
|
#endif // HAVE_DAMARIS
|
||||||
|
|
||||||
int mpiRank = EclGenericVanguard::comm().rank();
|
int mpiRank = EclGenericVanguard::comm().rank();
|
||||||
FileOutputMode outputMode = FileOutputMode::OUTPUT_NONE;
|
|
||||||
outputCout_ = false;
|
outputCout_ = false;
|
||||||
if (mpiRank == 0)
|
if (mpiRank == 0)
|
||||||
outputCout_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableTerminalOutput);
|
outputCout_ = EWOMS_GET_PARAM(PreTypeTag, bool, EnableTerminalOutput);
|
||||||
@ -400,39 +398,18 @@ private:
|
|||||||
if (outputCout_) {
|
if (outputCout_) {
|
||||||
FlowMainEbos<PreTypeTag>::printBanner(EclGenericVanguard::comm());
|
FlowMainEbos<PreTypeTag>::printBanner(EclGenericVanguard::comm());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Deck and EclipseState.
|
// Create Deck and EclipseState.
|
||||||
try {
|
try {
|
||||||
auto python = std::make_shared<Python>();
|
this->readDeck(deckFilename,
|
||||||
const bool init_from_restart_file = !EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart);
|
outputDir,
|
||||||
const bool allRanksDbgPrtLog = EWOMS_GET_PARAM(PreTypeTag, bool,
|
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
|
||||||
EnableLoggingFalloutWarning);
|
!EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart),
|
||||||
outputMode = setupLogging(mpiRank,
|
EWOMS_GET_PARAM(PreTypeTag, bool, EnableLoggingFalloutWarning),
|
||||||
deckFilename,
|
EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing),
|
||||||
outputDir,
|
mpiRank,
|
||||||
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
|
EWOMS_GET_PARAM(PreTypeTag, int, EclOutputInterval));
|
||||||
outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog);
|
|
||||||
const bool strictParsing = EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing);
|
|
||||||
|
|
||||||
FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout_);
|
|
||||||
|
|
||||||
if (outputCout_) {
|
|
||||||
OpmLog::info("Reading deck file '" + deckFilename + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<int> outputInterval;
|
|
||||||
int output_param = EWOMS_GET_PARAM(PreTypeTag, int, EclOutputInterval);
|
|
||||||
if (output_param >= 0)
|
|
||||||
outputInterval = output_param;
|
|
||||||
|
|
||||||
readDeck(EclGenericVanguard::comm(), deckFilename, eclipseState_,
|
|
||||||
schedule_, udqState_, actionState_, wtestState_,
|
|
||||||
summaryConfig_, python, strictParsing,
|
|
||||||
init_from_restart_file, outputCout_, outputInterval);
|
|
||||||
|
|
||||||
verifyValidCellGeometry(EclGenericVanguard::comm(), *this->eclipseState_);
|
|
||||||
|
|
||||||
setupTime_ = externalSetupTimer.elapsed();
|
setupTime_ = externalSetupTimer.elapsed();
|
||||||
outputFiles_ = (outputMode != FileOutputMode::OUTPUT_NONE);
|
|
||||||
}
|
}
|
||||||
catch (const std::invalid_argument& e)
|
catch (const std::invalid_argument& e)
|
||||||
{
|
{
|
||||||
@ -667,6 +644,15 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void readDeck(const std::string& deckFilename,
|
||||||
|
const std::string& outputDir,
|
||||||
|
const std::string& outputMode,
|
||||||
|
const bool init_from_restart_file,
|
||||||
|
const bool allRanksDbgPrtLog,
|
||||||
|
const bool strictParsing,
|
||||||
|
const int mpiRank,
|
||||||
|
const int output_param);
|
||||||
|
|
||||||
int argc_{0};
|
int argc_{0};
|
||||||
char** argv_{nullptr};
|
char** argv_{nullptr};
|
||||||
bool outputCout_{false};
|
bool outputCout_{false};
|
||||||
|
Loading…
Reference in New Issue
Block a user