All Classes Namespaces Files Functions Variables Typedefs Enumerator Pages
AdaptiveTimeStepping.hpp
1 /*
2  Copyright 2014 IRIS AS
3  Copyright 2015 Dr. Blatt - HPC-Simulation-Software & Services
4  Copyright 2015 Statoil AS
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #ifndef OPM_SUBSTEPPING_HEADER_INCLUDED
22 #define OPM_SUBSTEPPING_HEADER_INCLUDED
23 
24 #include <iostream>
25 #include <utility>
26 
27 #include <opm/core/utility/parameters/ParameterGroup.hpp>
28 #include <opm/common/ErrorMacros.hpp>
29 #include <opm/simulators/timestepping/SimulatorTimer.hpp>
30 #include <opm/simulators/timestepping/TimeStepControlInterface.hpp>
31 
32 namespace Opm {
33 
34 
35  // AdaptiveTimeStepping
36  //---------------------
37 
39  {
40  public:
45  AdaptiveTimeStepping( const ParameterGroup& param,
46  const bool terminal_output = true );
47 
54  AdaptiveTimeStepping( const Tuning& tuning,
55  size_t time_step,
56  const ParameterGroup& param,
57  const bool terminal_output = true );
58 
68  template <class Solver, class State, class WellState>
69  SimulatorReport step( const SimulatorTimer& timer,
70  Solver& solver, State& state, WellState& well_state,
71  const bool event);
72 
84  template <class Solver, class State, class WellState, class Output>
85  SimulatorReport step( const SimulatorTimer& timer,
86  Solver& solver, State& state, WellState& well_state,
87  const bool event,
88  Output& outputWriter,
89  const std::vector<int>* fipnum = nullptr);
90 
94  const SimulatorReport& failureReport() const { return failureReport_; };
95 
96  double suggestedNextStep() const { return suggested_next_timestep_; }
97 
98  void setSuggestedNextStep(const double x) { suggested_next_timestep_ = x; }
99 
100  protected:
101  template <class Solver, class State, class WellState, class Output>
102  SimulatorReport stepImpl( const SimulatorTimer& timer,
103  Solver& solver, State& state, WellState& well_state,
104  const bool event,
105  Output* outputWriter,
106  const std::vector<int>* fipnum);
107 
108  void init(const ParameterGroup& param);
109 
110  typedef std::unique_ptr< TimeStepControlInterface > TimeStepControlType;
111 
112  SimulatorReport failureReport_;
113  TimeStepControlType timeStepControl_;
114  const double restart_factor_;
115  const double growth_factor_;
116  const double max_growth_;
117  const double max_time_step_;
119  const bool solver_verbose_;
120  const bool timestep_verbose_;
123  const double timestep_after_event_;
125  };
126 }
127 
128 #include <opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp>
129 #endif
TimeStepControlType timeStepControl_
time step control object
Definition: AdaptiveTimeStepping.hpp:113
double suggested_next_timestep_
suggested size of next timestep
Definition: AdaptiveTimeStepping.hpp:121
const double max_time_step_
maximal allowed time step size
Definition: AdaptiveTimeStepping.hpp:117
Definition: AdaptiveTimeStepping.hpp:38
SimulatorReport step(const SimulatorTimer &timer, Solver &solver, State &state, WellState &well_state, const bool event)
step method that acts like the solver::step method in a sub cycle of time steps
Definition: AdaptiveTimeStepping_impl.hpp:164
SimulatorReport failureReport_
statistics for the failed substeps of the last timestep
Definition: AdaptiveTimeStepping.hpp:112
const double restart_factor_
factor to multiply time step with when solver fails to converge
Definition: AdaptiveTimeStepping.hpp:114
const double max_growth_
factor that limits the maximum growth of a time step
Definition: AdaptiveTimeStepping.hpp:116
const double growth_factor_
factor to multiply time step when solver recovered from failed convergence
Definition: AdaptiveTimeStepping.hpp:115
AdaptiveTimeStepping(const ParameterGroup &param, const bool terminal_output=true)
contructor taking parameter object
Definition: AdaptiveTimeStepping_impl.hpp:99
const int solver_restart_max_
how many restart of solver are allowed
Definition: AdaptiveTimeStepping.hpp:118
const SimulatorReport & failureReport() const
Returns the simulator report for the failed substeps of the last report step.
Definition: AdaptiveTimeStepping.hpp:94
const double timestep_after_event_
suggested size of timestep after an event
Definition: AdaptiveTimeStepping.hpp:123
const bool timestep_verbose_
timestep verbosity
Definition: AdaptiveTimeStepping.hpp:120
const bool solver_verbose_
solver verbosity
Definition: AdaptiveTimeStepping.hpp:119
Definition: SimulatorTimer.hpp:34
bool use_newton_iteration_
use newton iteration count for adaptive time step control
Definition: AdaptiveTimeStepping.hpp:124
bool full_timestep_initially_
beginning with the size of the time step from data file
Definition: AdaptiveTimeStepping.hpp:122