diff --git a/opm/core/io/OutputWriter.cpp b/opm/core/io/OutputWriter.cpp index 4b66e2c4..da3c688a 100644 --- a/opm/core/io/OutputWriter.cpp +++ b/opm/core/io/OutputWriter.cpp @@ -25,11 +25,9 @@ struct MultiWriter : public OutputWriter { MultiWriter (ptr_t writers) : writers_ (std::move (writers)) { } /// Forward the call to all writers - virtual void writeInit(const SimulatorTimer &timer, - const SimulatorState& reservoirState, - const WellState& wellState) { + virtual void writeInit(const SimulatorTimer &timer) { for (it_t it = writers_->begin (); it != writers_->end (); ++it) { - (*it)->writeInit (timer, reservoirState, wellState); + (*it)->writeInit (timer); } } diff --git a/opm/core/io/OutputWriter.hpp b/opm/core/io/OutputWriter.hpp index 46bca77a..df3759bc 100644 --- a/opm/core/io/OutputWriter.hpp +++ b/opm/core/io/OutputWriter.hpp @@ -67,15 +67,12 @@ public: virtual ~OutputWriter () { } /** - * Write the static eclipse data (grid, PVT curves, etc) as well as the - * initial state to disk. + * Write the static data (grid, PVT curves, etc) to disk. * * This routine should be called before the first timestep (i.e. when * timer.currentStepNum () == 0) */ - virtual void writeInit(const SimulatorTimer &timer, - const SimulatorState& reservoirState, - const WellState& wellState) = 0; + virtual void writeInit(const SimulatorTimer &timer) = 0; /*! * \brief Write a blackoil reservoir state to disk for later inspection with @@ -88,8 +85,8 @@ public: * i.e. timer.currentStepNum () > 0. */ virtual void writeTimeStep(const SimulatorTimer& timer, - const SimulatorState& reservoirState, - const WellState& wellState) = 0; + const SimulatorState& reservoirState, + const WellState& wellState) = 0; /*! * Create a suitable set of output formats based on configuration. diff --git a/opm/core/io/eclipse/EclipseWriter.cpp b/opm/core/io/eclipse/EclipseWriter.cpp index 241ab953..88a599db 100644 --- a/opm/core/io/eclipse/EclipseWriter.cpp +++ b/opm/core/io/eclipse/EclipseWriter.cpp @@ -1035,9 +1035,7 @@ EclipseSummary::addWells (Opm::DeckConstPtr newParserDeck, namespace Opm { -void EclipseWriter::writeInit(const SimulatorTimer &timer, - const SimulatorState& reservoirState, - const WellState& wellState) +void EclipseWriter::writeInit(const SimulatorTimer &timer) { // if we don't want to write anything, this method becomes a // no-op... @@ -1076,34 +1074,27 @@ void EclipseWriter::writeInit(const SimulatorTimer &timer, fortio.writeKeyword ("PERMZ", data); } - /* Initial solution (pressure and saturation) */ - writeSolution_(timer, reservoirState); - /* Create summary object (could not do it at construction time, since it requires knowledge of the start time). */ summary_.reset(new EclipseSummary(outputDir_, baseName_, timer, newParserDeck_)); summary_->addWells (newParserDeck_, uses_); } -void EclipseWriter::activeToGlobalCellData_(std::vector &globalCellsBuf, - const std::vector &activeCellsBuf, - const std::vector &inactiveCellsBuf) const +void EclipseWriter::writeTimeStep(const SimulatorTimer& timer, + const SimulatorState& reservoirState, + const WellState& wellState) { - globalCellsBuf = inactiveCellsBuf; - - // overwrite the values of active cells - for (int activeCellIdx = 0; - activeCellIdx < grid_->number_of_cells; - ++activeCellIdx) - { - int globalCellIdx = grid_->global_cell[activeCellIdx]; - globalCellsBuf[globalCellIdx] = activeCellsBuf[activeCellIdx]; + // if we don't want to write anything, this method becomes a + // no-op... + if (!enableOutput_) { + return; + } + + // respected the output_interval parameter + if (outputTimeStepIdx_ % outputInterval_ != 0) { + return; } -} -void EclipseWriter::writeSolution_(const SimulatorTimer& timer, - const SimulatorState& reservoirState) -{ // start writing to files EclipseRestart rst(outputDir_, baseName_, timer, outputTimeStepIdx_); rst.writeHeader (timer, outputTimeStepIdx_, uses_, newParserDeck_, reservoirState.pressure().size ()); @@ -1133,27 +1124,6 @@ void EclipseWriter::writeSolution_(const SimulatorTimer& timer, } } - ++outputTimeStepIdx_; -} - -void EclipseWriter::writeTimeStep(const SimulatorTimer& timer, - const SimulatorState& reservoirState, - const WellState& wellState) -{ - // if we don't want to write anything, this method becomes a - // no-op... - if (!enableOutput_) { - return; - } - - // respected the output_interval parameter - if (timer.currentStepNum() % outputInterval_ != 0) { - return; - } - - /* Field variables (pressure, saturation) */ - writeSolution_(timer, reservoirState); - /* Summary variables (well reporting) */ // TODO: instead of writing the header (smspec) every time, it should // only be written when there is a change in the well configuration @@ -1169,14 +1139,14 @@ void EclipseWriter::writeTimeStep(const SimulatorTimer& timer, // will contain data from the whole simulation, instead of just // the last step. summary_->writeTimeStep(timer, wellState); + + ++outputTimeStepIdx_; } #else namespace Opm { -void EclipseWriter::writeInit(const SimulatorTimer&, - const SimulatorState&, - const WellState&) +void EclipseWriter::writeInit(const SimulatorTimer&) { // if we don't want to write anything, this method becomes a // no-op... diff --git a/opm/core/io/eclipse/EclipseWriter.hpp b/opm/core/io/eclipse/EclipseWriter.hpp index b2808372..1f0b8652 100644 --- a/opm/core/io/eclipse/EclipseWriter.hpp +++ b/opm/core/io/eclipse/EclipseWriter.hpp @@ -69,16 +69,20 @@ public: virtual ~EclipseWriter (); /** - * Write the static eclipse data (grid, PVT curves, etc) as well as the - * initial state to disk. + * Write the static eclipse data (grid, PVT curves, etc) to disk. */ - virtual void writeInit(const SimulatorTimer &timer, - const SimulatorState& reservoirState, - const WellState& wellState); + virtual void writeInit(const SimulatorTimer &timer); /*! - * \brief Write a blackoil reservoir state to disk for later inspection with - * visualization tools like ResInsight + * \brief Write a reservoir state and summary information to disk. + * + * + * The reservoir state can be inspected with visualization tools like + * ResInsight. + * + * The summary information can then be visualized using tools from + * ERT or ECLIPSE. Note that calling this method is only + * meaningful after the first time step has been completed. * * \param[in] reservoirState The thermodynamic state of the reservoir * \param[in] wellState The production/injection data for all wells @@ -97,14 +101,6 @@ private: std::string baseName_; PhaseUsage uses_; // active phases in the input deck std::shared_ptr summary_; - - void activeToGlobalCellData_(std::vector &globalCellsBuf, - const std::vector &activeCellsBuf, - const std::vector &inactiveCellsBuf) const; - - /// Write solution field variables (pressure and saturation) - void writeSolution_(const SimulatorTimer& timer, - const SimulatorState& reservoirState); }; } // namespace Opm diff --git a/opm/core/simulator/SimulatorOutput.cpp b/opm/core/simulator/SimulatorOutput.cpp index 67092c3f..250046da 100644 --- a/opm/core/simulator/SimulatorOutput.cpp +++ b/opm/core/simulator/SimulatorOutput.cpp @@ -53,7 +53,7 @@ SimulatorOutputBase::SimulatorOutputBase ( , next_ (0) { // write the static initialization files, even before simulation starts - writer_->writeInit (*timer, *state, *wellState); + writer_->writeInit (*timer); } // default destructor is OK, just need to be defined