Propagate initial state to the writer as well

The writeTimeStep method is called *after* each timestep and does
not include the initial state of the reservoir. If the writer wants
to dump the initial state of the reservoir, this must be done in
writeInit, which is called before the simulator is run, but after
the initial state has been set up.
This commit is contained in:
Roland Kaufmann 2013-11-26 22:20:55 +01:00
parent 1c0051b40e
commit 7e349636c1
5 changed files with 26 additions and 14 deletions

View File

@ -25,9 +25,11 @@ struct MultiWriter : public OutputWriter {
MultiWriter (ptr_t writers) : writers_ (std::move (writers)) { }
/// Forward the call to all writers
virtual void writeInit(const SimulatorTimer &timer) {
virtual void writeInit(const SimulatorTimer &timer,
const SimulatorState& reservoirState,
const WellState& wellState) {
for (it_t it = writers_->begin (); it != writers_->end (); ++it) {
(*it)->writeInit (timer);
(*it)->writeInit (timer, reservoirState, wellState);
}
}

View File

@ -66,10 +66,13 @@ public:
/// scope).
virtual ~OutputWriter () { }
/*!
* \brief Write the static eclipse data (grid, PVT curves, etc) to disk
/**
* Write the static eclipse data (grid, PVT curves, etc) as well as the
* initial state to disk.
*/
virtual void writeInit(const SimulatorTimer &timer) = 0;
virtual void writeInit(const SimulatorTimer &timer,
const SimulatorState& reservoirState,
const WellState& wellState) = 0;
/*!
* \brief Write a blackoil reservoir state to disk for later inspection with

View File

@ -878,7 +878,9 @@ static const char* SAT_NAMES[] = { "SWAT", "SOIL", "SGAS" };
namespace Opm {
void EclipseWriter::writeInit(const SimulatorTimer &timer) {
void EclipseWriter::writeInit(const SimulatorTimer &timer,
const SimulatorState& reservoirState,
const WellState& wellState) {
/* Grid files */
const int timeStep = ECL_INIT_SOL;
EclipseGrid ecl_grid = EclipseGrid::make (*parser_, *grid_);
@ -955,15 +957,17 @@ void EclipseWriter::writeTimeStep(const SimulatorTimer& timer,
#else
namespace Opm {
void EclipseWriter::writeInit(const SimulatorTimer &timer) {
void EclipseWriter::writeInit(const SimulatorTimer&,
const SimulatorState&,
const WellState&) {
OPM_THROW(std::runtime_error,
"The ERT libraries are required to write ECLIPSE output files.");
}
void EclipseWriter::writeTimeStep(
const SimulatorTimer& timer,
const SimulatorState& reservoirState,
const WellState& wellState) {
const SimulatorTimer&,
const SimulatorState&,
const WellState&) {
OPM_THROW(std::runtime_error,
"The ERT libraries are required to write ECLIPSE output files.");
}

View File

@ -65,10 +65,13 @@ public:
*/
virtual ~EclipseWriter ();
/*!
* \brief Write the static eclipse data (grid, PVT curves, etc) to disk
/**
* Write the static eclipse data (grid, PVT curves, etc) as well as the
* initial state to disk.
*/
virtual void writeInit(const SimulatorTimer &timer);
virtual void writeInit(const SimulatorTimer &timer,
const SimulatorState& reservoirState,
const WellState& wellState);
/*!
* \brief Write a blackoil reservoir state to disk for later inspection with

View File

@ -58,7 +58,7 @@ SimulatorOutputBase::SimulatorOutputBase (
std::partial_sum (tstep.begin(), tstep.end(), times_.begin() + 1);
// write the static initialization files, even before simulation starts
writer_->writeInit (*timer);
writer_->writeInit (*timer, *state, *wellState);
}
// default destructor is OK, just need to be defined