mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
allow to specify the ECL output directory
by default, it is the current directory.
This commit is contained in:
parent
8b7c14c4db
commit
9e7857ec1c
@ -113,6 +113,9 @@ NEW_PROP_TAG(EnableWriteAllSolutions);
|
||||
// The number of time steps skipped between writing two consequtive restart files
|
||||
NEW_PROP_TAG(RestartWritingInterval);
|
||||
|
||||
// The default location for the ECL output files
|
||||
NEW_PROP_TAG(EclOutputDir);
|
||||
|
||||
// Disable well treatment (for users which do this externally)
|
||||
NEW_PROP_TAG(DisableWells);
|
||||
|
||||
@ -220,8 +223,8 @@ SET_TYPE_PROP(EclBaseProblem, FluxModule, Ewoms::EclTransFluxModule<TypeTag>);
|
||||
// Use the dummy gradient calculator in order not to do unnecessary work.
|
||||
SET_TYPE_PROP(EclBaseProblem, GradientCalculator, Ewoms::EclDummyGradientCalculator<TypeTag>);
|
||||
|
||||
// The default name of the data file to load
|
||||
SET_STRING_PROP(EclBaseProblem, GridFile, "data/ecl.DATA");
|
||||
// The default location for the ECL output files
|
||||
SET_STRING_PROP(EclBaseProblem, EclOutputDir, ".");
|
||||
|
||||
// The frequency of writing restart (*.ers) files. This is the number of time steps
|
||||
// between writing restart files
|
||||
@ -317,6 +320,8 @@ public:
|
||||
EWOMS_REGISTER_PARAM(TypeTag, bool, EnableEclOutput,
|
||||
"Write binary output which is compatible with the commercial "
|
||||
"Eclipse simulator");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, std::string, EclOutputDir,
|
||||
"The directory to which the ECL result files are written");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, unsigned, RestartWritingInterval,
|
||||
"The frequencies of which time steps are serialized to disk");
|
||||
}
|
||||
@ -329,8 +334,6 @@ public:
|
||||
, transmissibilities_(simulator.gridManager())
|
||||
, thresholdPressures_(simulator)
|
||||
, wellManager_(simulator)
|
||||
, eclWriter_( EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput)
|
||||
? new EclWriterType(simulator) : nullptr )
|
||||
, pffDofData_(simulator.gridView(), this->elementMapper())
|
||||
{
|
||||
// Tell the extra modules to initialize its internal data structures
|
||||
@ -338,6 +341,32 @@ public:
|
||||
SolventModule::initFromDeck(gridManager.deck(), gridManager.eclState());
|
||||
PolymerModule::initFromDeck(gridManager.deck(), gridManager.eclState());
|
||||
|
||||
if (EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput)) {
|
||||
// retrieve the location where the output is supposed to go
|
||||
const auto& outputDir = EWOMS_GET_PARAM(TypeTag, std::string, EclOutputDir);
|
||||
|
||||
// ensure that the output directory exists and that it is a directory
|
||||
if (outputDir != ".") { // Do not try to create the current directory.
|
||||
if (!boost::filesystem::is_directory(outputDir)) {
|
||||
try {
|
||||
boost::filesystem::create_directories(outputDir);
|
||||
}
|
||||
catch (...) {
|
||||
OPM_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.
|
||||
auto& eclState = this->simulator().gridManager().eclState();
|
||||
auto& ioConfig = eclState.getIOConfig();
|
||||
ioConfig.setOutputDir(outputDir);
|
||||
|
||||
// create the actual ECL writer
|
||||
eclWriter_.reset(new EclWriterType(simulator));
|
||||
}
|
||||
|
||||
// Hack to compute the initial thpressure values for restarts
|
||||
restartApplied = false;
|
||||
}
|
||||
@ -684,12 +713,10 @@ public:
|
||||
ParentType::writeOutput(verbose);
|
||||
|
||||
// output using eclWriter if enabled
|
||||
if ( eclWriter_ ) {
|
||||
if (eclWriter_)
|
||||
eclWriter_->writeOutput(dw, t, substep, totalSolverTime, nextstep, fip);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* \copydoc FvBaseMultiPhaseProblem::intrinsicPermeability
|
||||
*/
|
||||
@ -1139,9 +1166,8 @@ public:
|
||||
return initialFluidStates_[globalDofIdx];
|
||||
}
|
||||
|
||||
void setEclIO(std::unique_ptr<Opm::EclipseIO>&& eclIO) {
|
||||
eclWriter_->setEclIO(std::move(eclIO));
|
||||
}
|
||||
void setEclIO(std::unique_ptr<Opm::EclipseIO>&& eclIO)
|
||||
{ eclWriter_->setEclIO(std::move(eclIO)); }
|
||||
|
||||
const Opm::EclipseIO& eclIO() const
|
||||
{ return eclWriter_->eclIO(); }
|
||||
|
@ -28,13 +28,12 @@
|
||||
#ifndef EWOMS_ECL_WRITER_HH
|
||||
#define EWOMS_ECL_WRITER_HH
|
||||
|
||||
#include <opm/material/densead/Evaluation.hpp>
|
||||
|
||||
#include "collecttoiorank.hh"
|
||||
#include "ecloutputblackoilmodule.hh"
|
||||
|
||||
#include <ewoms/disc/ecfv/ecfvdiscretization.hh>
|
||||
#include <ewoms/io/baseoutputwriter.hh>
|
||||
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
|
||||
#include <opm/common/Valgrind.hpp>
|
||||
@ -59,7 +58,6 @@ NEW_PROP_TAG(EnableEclOutput);
|
||||
template <class TypeTag>
|
||||
class EclWriter;
|
||||
|
||||
|
||||
/*!
|
||||
* \ingroup EclBlackOilSimulator
|
||||
*
|
||||
@ -87,12 +85,10 @@ class EclWriter
|
||||
typedef typename GridView::template Codim<0>::Entity Element;
|
||||
typedef typename GridView::template Codim<0>::Iterator ElementIterator;
|
||||
|
||||
|
||||
typedef CollectDataToIORank< GridManager > CollectDataToIORankType;
|
||||
|
||||
typedef std::vector<Scalar> ScalarBuffer;
|
||||
|
||||
|
||||
public:
|
||||
EclWriter(const Simulator& simulator)
|
||||
: simulator_(simulator)
|
||||
@ -110,9 +106,8 @@ public:
|
||||
~EclWriter()
|
||||
{ }
|
||||
|
||||
void setEclIO(std::unique_ptr<Opm::EclipseIO>&& eclIO) {
|
||||
eclIO_ = std::move(eclIO);
|
||||
}
|
||||
void setEclIO(std::unique_ptr<Opm::EclipseIO>&& eclIO)
|
||||
{ eclIO_ = std::move(eclIO); }
|
||||
|
||||
const Opm::EclipseIO& eclIO() const
|
||||
{ return *eclIO_; }
|
||||
@ -122,7 +117,6 @@ public:
|
||||
*/
|
||||
void writeOutput(const Opm::data::Wells& dw, Scalar t, bool substep, Scalar totalSolverTime, Scalar nextstep, const Opm::data::Solution& fip)
|
||||
{
|
||||
|
||||
#if !HAVE_OPM_OUTPUT
|
||||
OPM_THROW(std::runtime_error,
|
||||
"Opm-output must be available to write ECL output!");
|
||||
@ -179,7 +173,8 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void restartBegin() {
|
||||
void restartBegin()
|
||||
{
|
||||
std::map<std::string, Opm::RestartKey> solution_keys {{"PRESSURE" , Opm::RestartKey(Opm::UnitSystem::measure::pressure)},
|
||||
{"SWAT" , Opm::RestartKey(Opm::UnitSystem::measure::identity)},
|
||||
{"SGAS" , Opm::RestartKey(Opm::UnitSystem::measure::identity)},
|
||||
|
Loading…
Reference in New Issue
Block a user