Add initalizer for adaptiveTimeStepper that uses values from TUNING

Some of the tuning values from the TUNING keywords is used to tune the
timestepping.
This commit is contained in:
Tor Harald Sandve 2016-09-28 09:59:50 +02:00
parent 815480d052
commit e034bbc7ad
2 changed files with 42 additions and 0 deletions

View File

@ -45,6 +45,17 @@ namespace Opm {
AdaptiveTimeStepping( const parameter::ParameterGroup& param,
const bool terminal_output = true );
//! \brief contructor taking parameter object
//! \param tuning Pointer to ecl TUNING keyword
//! \param time_step current report step
//! \param param The parameter object
//! \param pinfo The information about the data distribution
//! and communication for a parallel run.
AdaptiveTimeStepping( const Tuning& tuning,
size_t time_step,
const parameter::ParameterGroup& param,
const bool terminal_output = true );
/** \brief step method that acts like the solver::step method
in a sub cycle of time steps
@ -77,6 +88,8 @@ namespace Opm {
Solver& solver, State& state, WellState& well_state,
Output* outputWriter);
void init(const parameter::ParameterGroup& param);
typedef std::unique_ptr< TimeStepControlInterface > TimeStepControlType;
TimeStepControlType timeStepControl_; //!< time step control object

View File

@ -30,6 +30,7 @@
#include <opm/common/OpmLog/OpmLog.hpp>
#include <dune/istl/istlexception.hh>
#include <dune/istl/ilu.hh> // For MatrixBlockException
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
namespace Opm {
@ -61,6 +62,26 @@ namespace Opm {
// AdaptiveTimeStepping
//---------------------
AdaptiveTimeStepping::AdaptiveTimeStepping( const Tuning& tuning,
size_t time_step,
const parameter::ParameterGroup& param,
const bool terminal_output )
: timeStepControl_()
, restart_factor_( tuning.getTSFCNV(time_step) )
, growth_factor_(tuning.getTFDIFF(time_step) )
, max_growth_( tuning.getTSFMAX(time_step) )
// default is 1 year, convert to seconds
, max_time_step_( tuning.getTSMAXZ(time_step) )
, solver_restart_max_( param.getDefault("solver.restart", int(10) ) )
, solver_verbose_( param.getDefault("solver.verbose", bool(true) ) && terminal_output )
, timestep_verbose_( param.getDefault("timestep.verbose", bool(true) ) && terminal_output )
, suggested_next_timestep_( tuning.getTSINIT(time_step) )
, full_timestep_initially_( param.getDefault("full_timestep_initially", bool(false) ) )
{
init(param);
}
AdaptiveTimeStepping::AdaptiveTimeStepping( const parameter::ParameterGroup& param,
const bool terminal_output )
: timeStepControl_()
@ -74,6 +95,12 @@ namespace Opm {
, timestep_verbose_( param.getDefault("timestep.verbose", bool(true) ) && terminal_output )
, suggested_next_timestep_( -1.0 )
, full_timestep_initially_( param.getDefault("full_timestep_initially", bool(false) ) )
{
init(param);
}
void AdaptiveTimeStepping::
init(const parameter::ParameterGroup& param)
{
// valid are "pid" and "pid+iteration"
std::string control = param.getDefault("timestep.control", std::string("pid") );
@ -108,6 +135,7 @@ namespace Opm {
}
template <class Solver, class State, class WellState>
void AdaptiveTimeStepping::
step( const SimulatorTimer& simulatorTimer, Solver& solver, State& state, WellState& well_state )
@ -123,6 +151,7 @@ namespace Opm {
stepImpl( simulatorTimer, solver, state, well_state, &outputWriter );
}
// implementation of the step method
template <class Solver, class State, class WState, class Output >
void AdaptiveTimeStepping::