From e7e63e198938eb30590a78c75b935656595369f8 Mon Sep 17 00:00:00 2001 From: Robert K Date: Tue, 6 Jan 2015 10:45:15 +0100 Subject: [PATCH] make writing of substeps work --- .../SimulatorFullyImplicitBlackoil_impl.hpp | 12 +++++++---- .../WellStateFullyImplicitBlackoil.hpp | 21 +++++-------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp index ea140bdee..eb602bd79 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoil_impl.hpp @@ -337,7 +337,8 @@ namespace Opm if (timer.currentStepNum() == 0) { output_writer_.writeInit(timer); } - output_writer_.writeTimeStep(timer, state, well_state.basicWellState()); + if( ! adaptiveTimeStepping ) + output_writer_.writeTimeStep(timer, state, well_state); } // Max oil saturation (for VPPARS), hysteresis update. @@ -361,8 +362,9 @@ namespace Opm // \Note: The report steps are met in any case // \Note: The sub stepping will require a copy of the state variables if( adaptiveTimeStepping ) { - adaptiveTimeStepping->step( solver, state, well_state, - timer.simulationTimeElapsed(), timer.currentStepLength() ); + //adaptiveTimeStepping->step( solver, state, well_state, + // timer.simulationTimeElapsed(), timer.currentStepLength() ); + adaptiveTimeStepping->step( timer, solver, state, well_state, output_writer_ ); } else { // solve for complete report step @@ -395,7 +397,9 @@ namespace Opm } outputStateMatlab(grid_, state, timer.currentStepNum(), output_dir_); outputWellStateMatlab(prev_well_state, timer.currentStepNum(), output_dir_); - output_writer_.writeTimeStep(timer, state, prev_well_state.basicWellState()); + if( ! adaptiveTimeStepping ) + //std::cout << "Write last step" << std::endl; + output_writer_.writeTimeStep(timer, state, prev_well_state); } // Stop timer and create timing report diff --git a/opm/autodiff/WellStateFullyImplicitBlackoil.hpp b/opm/autodiff/WellStateFullyImplicitBlackoil.hpp index be31b263f..677a4aece 100644 --- a/opm/autodiff/WellStateFullyImplicitBlackoil.hpp +++ b/opm/autodiff/WellStateFullyImplicitBlackoil.hpp @@ -39,11 +39,15 @@ namespace Opm /// The state of a set of wells, tailored for use by the fully /// implicit blackoil simulator. class WellStateFullyImplicitBlackoil + : public WellState { + typedef WellState BaseType; public: typedef std::array< int, 2 > mapentry_t; typedef std::map< std::string, mapentry_t > WellMapType; + using BaseType :: wellRates; + using BaseType :: bhp; /// Allocate and initialize if wells is non-null. Also tries /// to give useful initial values to the bhp(), wellRates() @@ -60,7 +64,7 @@ namespace Opm // We use the WellState::init() function to do bhp and well rates init. // The alternative would be to copy that function wholesale. - basic_well_state_.init(wells, state); + BaseType :: init(wells, state); // Initialize perfphaserates_, which must be done here. const int nw = wells->number_of_wells; @@ -135,14 +139,6 @@ namespace Opm } } - /// One bhp pressure per well. - std::vector& bhp() { return basic_well_state_.bhp(); } - const std::vector& bhp() const { return basic_well_state_.bhp(); } - - /// One rate per well and phase. - std::vector& wellRates() { return basic_well_state_.wellRates(); } - const std::vector& wellRates() const { return basic_well_state_.wellRates(); } - /// One rate per phase and well connection. std::vector& perfPhaseRates() { return perfphaserates_; } const std::vector& perfPhaseRates() const { return perfphaserates_; } @@ -151,12 +147,6 @@ namespace Opm std::vector& currentControls() { return current_controls_; } const std::vector& currentControls() const { return current_controls_; } - /// For interfacing with functions that take a WellState. - const WellState& basicWellState() const - { - return basic_well_state_; - } - /// The number of wells present. int numWells() const { @@ -172,7 +162,6 @@ namespace Opm const WellMapType& wellMap() const { return wellMap_; } private: - WellState basic_well_state_; std::vector perfphaserates_; std::vector current_controls_; WellMapType wellMap_;