From be0187d512e32a166cc601a859583d0d59cc67d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Fri, 20 May 2016 16:21:14 +0200 Subject: [PATCH] WellState::report() to make opm-output Well data --- opm/core/simulator/AdaptiveTimeStepping.hpp | 8 ++++---- opm/core/simulator/AdaptiveTimeStepping_impl.hpp | 8 ++++---- opm/core/simulator/BlackoilState.cpp | 2 ++ opm/core/simulator/WellState.hpp | 14 ++++++++++++++ opm/core/utility/Compat.hpp | 9 --------- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/opm/core/simulator/AdaptiveTimeStepping.hpp b/opm/core/simulator/AdaptiveTimeStepping.hpp index 3725ea7c..d722f9cf 100644 --- a/opm/core/simulator/AdaptiveTimeStepping.hpp +++ b/opm/core/simulator/AdaptiveTimeStepping.hpp @@ -66,16 +66,16 @@ namespace Opm { \param well_state additional well state object \param outputWriter writer object to write sub steps */ - template + template void step( const SimulatorTimer& timer, Solver& solver, State& state, WellState& well_state, - OutputWriter& outputWriter ); + Output& outputWriter ); protected: - template + template void stepImpl( const SimulatorTimer& timer, Solver& solver, State& state, WellState& well_state, - OutputWriter* outputWriter); + Output* outputWriter); typedef std::unique_ptr< TimeStepControlInterface > TimeStepControlType; diff --git a/opm/core/simulator/AdaptiveTimeStepping_impl.hpp b/opm/core/simulator/AdaptiveTimeStepping_impl.hpp index 67929604..c4d07457 100644 --- a/opm/core/simulator/AdaptiveTimeStepping_impl.hpp +++ b/opm/core/simulator/AdaptiveTimeStepping_impl.hpp @@ -110,20 +110,20 @@ namespace Opm { stepImpl( simulatorTimer, solver, state, well_state ); } - template + template void AdaptiveTimeStepping:: step( const SimulatorTimer& simulatorTimer, Solver& solver, State& state, WellState& well_state, - OutputWriter& outputWriter ) + Output& outputWriter ) { stepImpl( simulatorTimer, solver, state, well_state, &outputWriter ); } // implementation of the step method - template + template void AdaptiveTimeStepping:: stepImpl( const SimulatorTimer& simulatorTimer, Solver& solver, State& state, WState& well_state, - OutputWriter* outputWriter ) + Output* outputWriter ) { const double timestep = simulatorTimer.currentStepLength(); diff --git a/opm/core/simulator/BlackoilState.cpp b/opm/core/simulator/BlackoilState.cpp index 66d83938..97d39f72 100644 --- a/opm/core/simulator/BlackoilState.cpp +++ b/opm/core/simulator/BlackoilState.cpp @@ -1,6 +1,8 @@ #include "BlackoilState.hpp" #include #include +#include +#include using namespace Opm; diff --git a/opm/core/simulator/WellState.hpp b/opm/core/simulator/WellState.hpp index bbf0694b..999dfcff 100644 --- a/opm/core/simulator/WellState.hpp +++ b/opm/core/simulator/WellState.hpp @@ -22,6 +22,8 @@ #include #include +#include + #include #include #include @@ -208,6 +210,18 @@ namespace Opm return wellRates().size() / numWells(); } + virtual data::Wells report() const + { + return { { /* WellState offers no completion data, so that has to be added later */ }, + this->bhp(), + this->temperature(), + this->wellRates(), + this->perfPress(), + this->perfRates() }; + } + + virtual ~WellState() {} + private: std::vector bhp_; std::vector thp_; diff --git a/opm/core/utility/Compat.hpp b/opm/core/utility/Compat.hpp index 3eb1967c..1ab86061 100644 --- a/opm/core/utility/Compat.hpp +++ b/opm/core/utility/Compat.hpp @@ -117,15 +117,6 @@ inline void solution2sim( const data::Solution& sol, state.getCellData( "RV" ) = sol[ ds::RV ]; } -inline data::Wells state2wells( const WellState& ws ) { - return { {}, - ws.bhp(), - ws.temperature(), - ws.wellRates(), - ws.perfPress(), - ws.perfRates() }; -} - inline void wells2state( const data::Wells& wells, WellState& state ) { state.bhp() = wells.bhp; state.temperature() = wells.temperature;