TimeStepControl.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_TIMESTEPCONTROL_HEADER_INCLUDED
22 #define OPM_TIMESTEPCONTROL_HEADER_INCLUDED
23 
24 #include <vector>
25 
26 #include <boost/any.hpp>
27 #include <boost/range/iterator_range.hpp>
28 #include <opm/simulators/timestepping/TimeStepControlInterface.hpp>
29 
30 namespace Opm
31 {
35  //
38  {
39  public:
42  // \param decayrate decayrate of time step when target iterations are not met (should be <= 1)
43  // \param growthrate growthrate of time step when target iterations are not met (should be >= 1)
45  SimpleIterationCountTimeStepControl( const int target_iterations,
46  const double decayrate,
47  const double growthrate,
48  const bool verbose = false);
49 
51  double computeTimeStepSize( const double dt, const int iterations, const RelativeChangeInterface& /* relativeChange */, const double /*simulationTimeElapsed */ ) const;
52 
53  protected:
54  const int target_iterations_;
55  const double decayrate_;
56  const double growthrate_;
57  const bool verbose_;
58  };
59 
75  {
76  public:
81  PIDTimeStepControl( const double tol = 1e-3,
82  const bool verbose = false );
83 
85  double computeTimeStepSize( const double dt, const int /* iterations */, const RelativeChangeInterface& relativeChange, const double /*simulationTimeElapsed */ ) const;
86 
87  protected:
88  const double tol_;
89  mutable std::vector< double > errors_;
90 
91  const bool verbose_;
92  };
93 
98  //
101  {
103  public:
109  PIDAndIterationCountTimeStepControl( const int target_iterations = 20,
110  const double tol = 1e-3,
111  const bool verbose = false);
112 
114  double computeTimeStepSize( const double dt, const int iterations, const RelativeChangeInterface& relativeChange, const double /*simulationTimeElapsed */ ) const;
115 
116  protected:
117  const int target_iterations_;
118  };
119 
130  {
131  public:
134  explicit HardcodedTimeStepControl( const std::string& filename);
135 
137  double computeTimeStepSize( const double dt, const int /* iterations */, const RelativeChangeInterface& /*relativeChange */, const double simulationTimeElapsed) const;
138 
139  protected:
140  // store the time (in days) of the substeps the simulator should use
141  std::vector<double> subStepTime_;
142  };
143 
144 
145 } // end namespace Opm
146 #endif
147 
PIDAndIterationCountTimeStepControl(const int target_iterations=20, const double tol=1e-3, const bool verbose=false)
constructor
Definition: TimeStepControl.cpp:170
HardcodedTimeStepControl Input generated from summary file using the ert application: ...
Definition: TimeStepControl.hpp:129
HardcodedTimeStepControl(const std::string &filename)
constructor
Definition: TimeStepControl.cpp:87
SimpleIterationCountTimeStepControl(const int target_iterations, const double decayrate, const double growthrate, const bool verbose=false)
constructor
Definition: TimeStepControl.cpp:43
double computeTimeStepSize(const double dt, const int iterations, const RelativeChangeInterface &, const double) const
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:61
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: AdditionalObjectDeleter.hpp:22
double computeTimeStepSize(const double dt, const int iterations, const RelativeChangeInterface &relativeChange, const double) const
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:178
PID controller based adaptive time step control as above that also takes an target iteration into acc...
Definition: TimeStepControl.hpp:100
double computeTimeStepSize(const double dt, const int, const RelativeChangeInterface &, const double simulationTimeElapsed) const
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:105
A simple iteration count based adaptive time step control.
Definition: TimeStepControl.hpp:37
double computeTimeStepSize(const double dt, const int, const RelativeChangeInterface &relativeChange, const double) const
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:127
PIDTimeStepControl(const double tol=1e-3, const bool verbose=false)
constructor
Definition: TimeStepControl.cpp:119
RelativeChangeInterface.
Definition: TimeStepControlInterface.hpp:31
PID controller based adaptive time step control as suggested in: Turek and Kuzmin.
Definition: TimeStepControl.hpp:74
TimeStepControlInterface.
Definition: TimeStepControlInterface.hpp:48