From 3ce9d6b3b1a39f0b9dcd571c7ba32c94e19e4c8b Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 2 Apr 2014 16:38:53 +0200 Subject: [PATCH] output writers: remove the state parameters from writeInit() because as discussed with Atgeirr, this function should no longer write the initial solution, it also does no longer need to know the initial simulator state... --- opm/core/io/OutputWriter.cpp | 6 ++---- opm/core/io/OutputWriter.hpp | 11 ++++------- opm/core/io/eclipse/EclipseWriter.cpp | 13 ++++--------- opm/core/io/eclipse/EclipseWriter.hpp | 18 +++++++++++------- opm/core/simulator/SimulatorOutput.cpp | 2 +- 5 files changed, 22 insertions(+), 28 deletions(-) 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..f7f26141 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,9 +1074,6 @@ 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_)); @@ -1169,14 +1164,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..304d4dc4 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 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