mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-07 15:03:01 -06:00
make the "OutputDir" parameter apply universally
all disc output, i.e. VTK, restart files, ECL and -- in the future -- logfiles, goes to that directory. before this, only the ECL output could be directed to a different than the current working directory and the parameter for this was called "EclOutputDir". note that the Dune VTK writing infrastructure makes it harder than it needs to be: suddenly Dune::VTKWriter::write() does not work in parallel anymore, but Dune::VTKWriter::pwrite() must be called with the right arguments.
This commit is contained in:
parent
0d864f8e71
commit
6e7be50610
@ -62,11 +62,10 @@ NEW_PROP_TAG(Grid);
|
||||
NEW_PROP_TAG(EquilGrid);
|
||||
NEW_PROP_TAG(Scalar);
|
||||
NEW_PROP_TAG(EclDeckFileName);
|
||||
NEW_PROP_TAG(EclOutputDir);
|
||||
NEW_PROP_TAG(OutputDir);
|
||||
NEW_PROP_TAG(EclOutputInterval);
|
||||
|
||||
SET_STRING_PROP(EclBaseVanguard, EclDeckFileName, "");
|
||||
SET_STRING_PROP(EclBaseVanguard, EclOutputDir, ".");
|
||||
SET_INT_PROP(EclBaseVanguard, EclOutputInterval, -1); // use the deck-provided value
|
||||
|
||||
END_PROPERTIES
|
||||
@ -101,8 +100,6 @@ public:
|
||||
{
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, EclDeckFileName,
|
||||
"The name of the file which contains the ECL deck to be simulated");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, EclOutputDir,
|
||||
"The directory to which the ECL result files are written");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, EclOutputInterval,
|
||||
"The number of report steps that ought to be skipped between two writes of ECL results");
|
||||
}
|
||||
@ -243,31 +240,6 @@ public:
|
||||
summaryConfig_ = externalSummaryConfig_;
|
||||
}
|
||||
|
||||
// retrieve the location set by the user
|
||||
std::string outputDir = EWOMS_GET_PARAM(TypeTag, std::string, EclOutputDir);
|
||||
|
||||
// update the location for output
|
||||
auto& ioConfig = eclState_->getIOConfig();
|
||||
if (outputDir == "")
|
||||
// If no output directory parameter is specified, use the output directory
|
||||
// which Opm::IOConfig thinks that should be used. Normally this is the
|
||||
// directory in which the input files are located.
|
||||
outputDir = ioConfig.getOutputDir();
|
||||
|
||||
// ensure that the output directory exists and that it is a directory
|
||||
if (!boost::filesystem::is_directory(outputDir)) {
|
||||
try {
|
||||
boost::filesystem::create_directories(outputDir);
|
||||
}
|
||||
catch (...) {
|
||||
throw std::runtime_error("Creation of output directory '"+outputDir+"' failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
// specify the directory output. This is not a very nice mechanism because
|
||||
// the eclState is supposed to be immutable here, IMO.
|
||||
ioConfig.setOutputDir(outputDir);
|
||||
|
||||
// Possibly override IOConfig setting for how often RESTART files should get
|
||||
// written to disk (every N report step)
|
||||
int outputInterval = EWOMS_GET_PARAM(TypeTag, int, EclOutputInterval);
|
||||
@ -276,6 +248,7 @@ public:
|
||||
|
||||
asImp_().createGrids_();
|
||||
asImp_().filterConnections_();
|
||||
asImp_().updateOutputDir_();
|
||||
asImp_().finalizeInit_();
|
||||
}
|
||||
|
||||
@ -391,6 +364,32 @@ public:
|
||||
{ return std::unordered_set<std::string>(); }
|
||||
|
||||
private:
|
||||
void updateOutputDir_()
|
||||
{
|
||||
// update the location for output
|
||||
std::string outputDir = EWOMS_GET_PARAM(TypeTag, std::string, OutputDir);
|
||||
auto& ioConfig = eclState_->getIOConfig();
|
||||
if (outputDir == "")
|
||||
// If no output directory parameter is specified, use the output directory
|
||||
// which Opm::IOConfig thinks that should be used. Normally this is the
|
||||
// directory in which the input files are located.
|
||||
outputDir = ioConfig.getOutputDir();
|
||||
|
||||
// ensure that the output directory exists and that it is a directory
|
||||
if (!boost::filesystem::is_directory(outputDir)) {
|
||||
try {
|
||||
boost::filesystem::create_directories(outputDir);
|
||||
}
|
||||
catch (...) {
|
||||
throw std::runtime_error("Creation of output directory '"+outputDir+"' failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
// specify the directory output. This is not a very nice mechanism because
|
||||
// the eclState is supposed to be immutable here, IMO.
|
||||
ioConfig.setOutputDir(outputDir);
|
||||
}
|
||||
|
||||
Implementation& asImp_()
|
||||
{ return *static_cast<Implementation*>(this); }
|
||||
|
||||
|
@ -255,7 +255,7 @@ SET_BOOL_PROP(EclBaseProblem, EnableAsyncEclOutput, true);
|
||||
SET_BOOL_PROP(EclBaseProblem, EclOutputDoublePrecision, false);
|
||||
|
||||
// The default location for the ECL output files
|
||||
SET_STRING_PROP(EclBaseProblem, EclOutputDir, ".");
|
||||
SET_STRING_PROP(EclBaseProblem, OutputDir, ".");
|
||||
|
||||
// the cache for intensive quantities can be used for ECL problems and also yields a
|
||||
// decent speedup...
|
||||
@ -392,6 +392,12 @@ public:
|
||||
"The frequencies of which time steps are serialized to disk");
|
||||
}
|
||||
|
||||
/*!
|
||||
* \copydoc FvBaseProblem::prepareOutputDir
|
||||
*/
|
||||
std::string prepareOutputDir() const
|
||||
{ return this->simulator().vanguard().eclState().getIOConfig().getOutputDir(); }
|
||||
|
||||
/*!
|
||||
* \copydoc FvBaseProblem::handlePositionalParameter
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user