Exemple #1
0
    void AdaptiveTimeStepping::
    init(const parameter::ParameterGroup& param)
    {
        // valid are "pid" and "pid+iteration"
        std::string control = param.getDefault("timestep.control", std::string("pid") );
        // iterations is the accumulation of all linear iterations over all newton steops per time step
        const int defaultTargetIterations = 30;

        const double tol = param.getDefault("timestep.control.tol", double(1e-1) );
        if( control == "pid" ) {
            timeStepControl_ = TimeStepControlType( new PIDTimeStepControl( tol ) );
        }
        else if ( control == "pid+iteration" )
        {
            const int iterations   = param.getDefault("timestep.control.targetiteration", defaultTargetIterations );
            timeStepControl_ = TimeStepControlType( new PIDAndIterationCountTimeStepControl( iterations, tol ) );
        }
        else if ( control == "iterationcount" )
        {
            const int iterations    = param.getDefault("timestep.control.targetiteration", defaultTargetIterations );
            const double decayrate  = param.getDefault("timestep.control.decayrate",  double(0.75) );
            const double growthrate = param.getDefault("timestep.control.growthrate", double(1.25) );
            timeStepControl_ = TimeStepControlType( new SimpleIterationCountTimeStepControl( iterations, decayrate, growthrate ) );
        } else if ( control == "hardcoded") {
            const std::string filename    = param.getDefault("timestep.control.filename", std::string("timesteps"));
            timeStepControl_ = TimeStepControlType( new HardcodedTimeStepControl( filename ) );

        }
        else
            OPM_THROW(std::runtime_error,"Unsupported time step control selected "<< control );

        // make sure growth factor is something reasonable
        assert( growth_factor_ >= 1.0 );
    }
AdaptiveTimeStepping::AdaptiveTimeStepping( const parameter::ParameterGroup& param )
    : timeStepControl_()
    , restart_factor_( param.getDefault("solver.restartfactor", double(0.1) ) )
    , growth_factor_( param.getDefault("solver.growthfactor", double(1.25) ) )
      // default is 1 year, convert to seconds
    , max_time_step_( unit::convert::from(param.getDefault("timestep.max_timestep_in_days", 365.0 ), unit::day) )
    , solver_restart_max_( param.getDefault("solver.restart", int(3) ) )
    , solver_verbose_( param.getDefault("solver.verbose", bool(false) ) )
    , timestep_verbose_( param.getDefault("timestep.verbose", bool(false) ) )
    , last_timestep_( -1.0 )
{
    // valid are "pid" and "pid+iteration"
    std::string control = param.getDefault("timestep.control", std::string("pid+iteration") );
    // iterations is the accumulation of all linear iterations over all newton steops per time step
    const int defaultTargetIterations = 30;

    const double tol = param.getDefault("timestep.control.tol", double(1e-3) );
    if( control == "pid" ) {
        timeStepControl_ = TimeStepControlType( new PIDTimeStepControl( tol ) );
    }
    else if ( control == "pid+iteration" )
    {
        const int iterations   = param.getDefault("timestep.control.targetiteration", defaultTargetIterations );
        const double maxgrowth = param.getDefault("timestep.control.maxgrowth", double(3.0) );
        timeStepControl_ = TimeStepControlType( new PIDAndIterationCountTimeStepControl( iterations, tol, maxgrowth ) );
    }
    else if ( control == "iterationcount" )
    {
        const int iterations    = param.getDefault("timestep.control.targetiteration", defaultTargetIterations );
        const double decayrate  = param.getDefault("timestep.control.decayrate",  double(0.75) );
        const double growthrate = param.getDefault("timestep.control.growthrate", double(1.25) );
        timeStepControl_ = TimeStepControlType( new SimpleIterationCountTimeStepControl( iterations, decayrate, growthrate ) );
    }
    else
        OPM_THROW(std::runtime_error,"Unsupported time step control selected "<< control );

    // make sure growth factor is something reasonable
    assert( growth_factor_ >= 1.0 );
}