00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef OPM_SUBSTEPPING_HEADER_INCLUDED
00022 #define OPM_SUBSTEPPING_HEADER_INCLUDED
00023
00024 #include <iostream>
00025 #include <utility>
00026
00027 #include <opm/core/utility/parameters/ParameterGroup.hpp>
00028 #include <opm/common/ErrorMacros.hpp>
00029 #include <opm/simulators/timestepping/SimulatorTimer.hpp>
00030 #include <opm/simulators/timestepping/TimeStepControlInterface.hpp>
00031
00032 namespace Opm {
00033
00034
00035
00036
00037
00038 class AdaptiveTimeStepping
00039 {
00040 public:
00045 AdaptiveTimeStepping( const ParameterGroup& param,
00046 const bool terminal_output = true );
00047
00054 AdaptiveTimeStepping( const Tuning& tuning,
00055 size_t time_step,
00056 const ParameterGroup& param,
00057 const bool terminal_output = true );
00058
00068 template <class Solver, class State, class WellState>
00069 SimulatorReport step( const SimulatorTimer& timer,
00070 Solver& solver, State& state, WellState& well_state,
00071 const bool event);
00072
00084 template <class Solver, class State, class WellState, class Output>
00085 SimulatorReport step( const SimulatorTimer& timer,
00086 Solver& solver, State& state, WellState& well_state,
00087 const bool event,
00088 Output& outputWriter,
00089 const std::vector<int>* fipnum = nullptr);
00090
00094 const SimulatorReport& failureReport() const { return failureReport_; };
00095
00096 double suggestedNextStep() const { return suggested_next_timestep_; }
00097
00098 void setSuggestedNextStep(const double x) { suggested_next_timestep_ = x; }
00099
00100 protected:
00101 template <class Solver, class State, class WellState, class Output>
00102 SimulatorReport stepImpl( const SimulatorTimer& timer,
00103 Solver& solver, State& state, WellState& well_state,
00104 const bool event,
00105 Output* outputWriter,
00106 const std::vector<int>* fipnum);
00107
00108 void init(const ParameterGroup& param);
00109
00110 typedef std::unique_ptr< TimeStepControlInterface > TimeStepControlType;
00111
00112 SimulatorReport failureReport_;
00113 TimeStepControlType timeStepControl_;
00114 const double restart_factor_;
00115 const double growth_factor_;
00116 const double max_growth_;
00117 const double max_time_step_;
00118 const int solver_restart_max_;
00119 const bool solver_verbose_;
00120 const bool timestep_verbose_;
00121 double suggested_next_timestep_;
00122 bool full_timestep_initially_;
00123 const double timestep_after_event_;
00124 bool use_newton_iteration_;
00125 };
00126 }
00127
00128 #include <opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp>
00129 #endif