00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef OPM_TIMESTEPCONTROL_HEADER_INCLUDED
00022 #define OPM_TIMESTEPCONTROL_HEADER_INCLUDED
00023
00024 #include <vector>
00025
00026 #include <boost/any.hpp>
00027 #include <boost/range/iterator_range.hpp>
00028 #include <opm/simulators/timestepping/TimeStepControlInterface.hpp>
00029
00030 namespace Opm
00031 {
00035
00037 class SimpleIterationCountTimeStepControl : public TimeStepControlInterface
00038 {
00039 public:
00042
00043
00045 SimpleIterationCountTimeStepControl( const int target_iterations,
00046 const double decayrate,
00047 const double growthrate,
00048 const bool verbose = false);
00049
00051 double computeTimeStepSize( const double dt, const int iterations, const RelativeChangeInterface& , const double ) const;
00052
00053 protected:
00054 const int target_iterations_;
00055 const double decayrate_;
00056 const double growthrate_;
00057 const bool verbose_;
00058 };
00059
00074 class PIDTimeStepControl : public TimeStepControlInterface
00075 {
00076 public:
00081 PIDTimeStepControl( const double tol = 1e-3,
00082 const bool verbose = false );
00083
00085 double computeTimeStepSize( const double dt, const int , const RelativeChangeInterface& relativeChange, const double ) const;
00086
00087 protected:
00088 const double tol_;
00089 mutable std::vector< double > errors_;
00090
00091 const bool verbose_;
00092 };
00093
00098
00100 class PIDAndIterationCountTimeStepControl : public PIDTimeStepControl
00101 {
00102 typedef PIDTimeStepControl BaseType;
00103 public:
00109 PIDAndIterationCountTimeStepControl( const int target_iterations = 20,
00110 const double tol = 1e-3,
00111 const bool verbose = false);
00112
00114 double computeTimeStepSize( const double dt, const int iterations, const RelativeChangeInterface& relativeChange, const double ) const;
00115
00116 protected:
00117 const int target_iterations_;
00118 };
00119
00129 class HardcodedTimeStepControl : public TimeStepControlInterface
00130 {
00131 public:
00134 explicit HardcodedTimeStepControl( const std::string& filename);
00135
00137 double computeTimeStepSize( const double dt, const int , const RelativeChangeInterface& , const double simulationTimeElapsed) const;
00138
00139 protected:
00140
00141 std::vector<double> subStepTime_;
00142 };
00143
00144
00145 }
00146 #endif
00147