My Project
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 <opm/simulators/timestepping/TimeStepControlInterface.hpp>
27
28namespace Opm
29{
33 //
36 {
37 public:
40 // \param decayrate decayrate of time step when target iterations are not met (should be <= 1)
41 // \param growthrate growthrate of time step when target iterations are not met (should be >= 1)
43 SimpleIterationCountTimeStepControl( const int target_iterations,
44 const double decayrate,
45 const double growthrate,
46 const bool verbose = false);
47
49 double computeTimeStepSize( const double dt, const int iterations, const RelativeChangeInterface& /* relativeChange */, const double /*simulationTimeElapsed */ ) const;
50
51 protected:
52 const int target_iterations_;
53 const double decayrate_;
54 const double growthrate_;
55 const bool verbose_;
56 };
57
73 {
74 public:
79 PIDTimeStepControl( const double tol = 1e-3,
80 const bool verbose = false );
81
83 double computeTimeStepSize( const double dt, const int /* iterations */, const RelativeChangeInterface& relativeChange, const double /*simulationTimeElapsed */ ) const;
84
85 protected:
86 const double tol_;
87 mutable std::vector< double > errors_;
88
89 const bool verbose_;
90 };
91
96 //
99 {
101 public:
107 PIDAndIterationCountTimeStepControl( const int target_iterations = 20,
108 const double decayDampingFactor = 1.0,
109 const double growthDampingFactor = 1.0/1.2,
110 const double tol = 1e-3,
111 const double minTimeStepBasedOnIterations = 0.,
112 const bool verbose = false);
113
115 double computeTimeStepSize( const double dt, const int iterations, const RelativeChangeInterface& relativeChange, const double /*simulationTimeElapsed */ ) const;
116
117 protected:
118 const int target_iterations_;
119 const double decayDampingFactor_;
120 const double growthDampingFactor_;
121 const double minTimeStepBasedOnIterations_;
122 };
123
134 {
135 public:
138 explicit HardcodedTimeStepControl( const std::string& filename);
139
141 double computeTimeStepSize( const double dt, const int /* iterations */, const RelativeChangeInterface& /*relativeChange */, const double simulationTimeElapsed) const;
142
143 protected:
144 // store the time (in days) of the substeps the simulator should use
145 std::vector<double> subStepTime_;
146 };
147
148
149} // end namespace Opm
150#endif
151
HardcodedTimeStepControl Input generated from summary file using the ert application:
Definition: TimeStepControl.hpp:134
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:106
HardcodedTimeStepControl(const std::string &filename)
constructor
Definition: TimeStepControl.cpp:88
PID controller based adaptive time step control as above that also takes an target iteration into acc...
Definition: TimeStepControl.hpp:99
PIDAndIterationCountTimeStepControl(const int target_iterations=20, const double decayDampingFactor=1.0, const double growthDampingFactor=1.0/1.2, const double tol=1e-3, const double minTimeStepBasedOnIterations=0., const bool verbose=false)
constructor
Definition: TimeStepControl.cpp:175
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:189
PID controller based adaptive time step control as suggested in: Turek and Kuzmin.
Definition: TimeStepControl.hpp:73
PIDTimeStepControl(const double tol=1e-3, const bool verbose=false)
constructor
Definition: TimeStepControl.cpp:120
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:128
RelativeChangeInterface.
Definition: TimeStepControlInterface.hpp:32
A simple iteration count based adaptive time step control.
Definition: TimeStepControl.hpp:36
SimpleIterationCountTimeStepControl(const int target_iterations, const double decayrate, const double growthrate, const bool verbose=false)
constructor
Definition: TimeStepControl.cpp:44
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:62
TimeStepControlInterface.
Definition: TimeStepControlInterface.hpp:49
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27