21 #ifndef OPM_TIMESTEPCONTROL_HEADER_INCLUDED 22 #define OPM_TIMESTEPCONTROL_HEADER_INCLUDED 24 #include <opm/simulators/timestepping/TimeStepControlInterface.hpp> 25 #include <opm/simulators/timestepping/AdaptiveSimulatorTimer.hpp> 32 enum class TimeStepControlType {
40 enum class ToleranceTestVersions {
42 ControlErrorFiltering,
45 enum class InternalControlVersions {
58 static constexpr TimeStepControlType Type = TimeStepControlType::SimpleIterationCount;
68 const double decayrate,
69 const double growthrate,
81 const double )
const override {
return true; }
83 template<
class Serializer>
84 void serializeOp(Serializer& serializer)
86 serializer(target_iterations_);
87 serializer(decayrate_);
88 serializer(growthrate_);
92 bool operator==(
const SimpleIterationCountTimeStepControl&)
const;
95 const int target_iterations_ = 0;
96 const double decayrate_ = 0.0;
97 const double growthrate_ = 0.0;
98 const bool verbose_ =
false;
118 static constexpr TimeStepControlType Type = TimeStepControlType::PID;
140 const double )
const override {
return true; }
142 template<
class Serializer>
143 void serializeOp(Serializer& serializer)
147 serializer(verbose_);
150 bool operator==(
const PIDTimeStepControl&)
const;
153 const double tol_ = 0.1;
154 mutable std::vector< double > errors_{};
155 const bool verbose_ =
false;
168 static constexpr TimeStepControlType Type = TimeStepControlType::PIDAndIterationCount;
181 const double decayDampingFactor,
182 const double growthDampingFactor,
184 const double minTimeStepBasedOnIterations,
194 const int iterations,
199 const double )
const override {
return true; }
201 template<
class Serializer>
202 void serializeOp(Serializer& serializer)
204 serializer(static_cast<PIDTimeStepControl&>(*
this));
205 serializer(target_iterations_);
206 serializer(decayDampingFactor_);
207 serializer(growthDampingFactor_);
208 serializer(minTimeStepBasedOnIterations_);
209 serializer(verbose_);
212 bool operator==(
const PIDAndIterationCountTimeStepControl&)
const;
215 const int target_iterations_ = 8;
216 const double decayDampingFactor_ = 1.0;
217 const double growthDampingFactor_ = 3.2;
218 const double minTimeStepBasedOnIterations_ = 0.0;
219 const bool verbose_ =
false;
230 static constexpr TimeStepControlType Type = TimeStepControlType::General3rdOrder;
245 const double safetyFactor,
246 const bool rejectCompletedStep,
247 const std::string& toleranceTestVersion,
248 const double maxReductionTimeStep,
249 const std::string& parameters,
259 double timeStepFactor(
const std::array<double, 3>& errors,
const std::array<double, 3>& timeSteps)
const;
262 const double timeStepJustCompleted)
const override;
264 template<
class Serializer>
265 void serializeOp(Serializer& serializer)
267 serializer(tolerance_);
268 serializer(safetyFactor_);
269 serializer(rejectCompletedStep_);
271 serializer(timeSteps_);
274 serializer(controllerVersion_);
275 serializer(toleranceTestVersion_);
276 serializer(maxReductionTimeStep_);
277 serializer(verbose_);
284 const double tolerance_ = 0.1;
285 const double safetyFactor_ = 0.8;
286 const bool rejectCompletedStep_ =
false;
287 mutable std::array<double, 3> errors_{};
288 mutable std::array<double, 3> timeSteps_{};
289 mutable std::array<double, 3> beta_{0.125, 0.25, 0.125};
290 mutable std::array<double, 2> alpha_{0.75, 0.25};
291 mutable InternalControlVersions controllerVersion_{InternalControlVersions::IController};
292 ToleranceTestVersions toleranceTestVersion_{ToleranceTestVersions::Standard};
293 const double maxReductionTimeStep_ = 0.1;
294 const bool verbose_ =
false;
309 static constexpr TimeStepControlType Type = TimeStepControlType::HardCodedTimeStep;
328 const double )
const override {
return true; }
330 template<
class Serializer>
331 void serializeOp(Serializer& serializer)
333 serializer(subStepTime_);
336 bool operator==(
const HardcodedTimeStepControl&)
const;
340 std::vector<double> subStepTime_;
double computeTimeStepSize(const double dt, const int, const RelativeChangeInterface &, const AdaptiveSimulatorTimer &substepTimer) const override
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:148
bool timeStepAccepted(const double, const double) const override
For the general 3rd order controller, the internal shifting of errors and time steps happens here...
Definition: TimeStepControl.hpp:198
Simulation timer for adaptive time stepping.
Definition: AdaptiveSimulatorTimer.hpp:40
double computeTimeStepSize(const double dt, const int, const RelativeChangeInterface &, const AdaptiveSimulatorTimer &substepTimer) const override
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:373
bool timeStepAccepted(const double, const double) const override
For the general 3rd order controller, the internal shifting of errors and time steps happens here...
Definition: TimeStepControl.hpp:327
bool timeStepAccepted(const double error, const double timeStepJustCompleted) const override
For the general 3rd order controller, the internal shifting of errors and time steps happens here...
Definition: TimeStepControl.cpp:446
General 3rd order controller.
Definition: TimeStepControl.hpp:227
double computeTimeStepSize(const double dt, const int iterations, const RelativeChangeInterface &relativeChange, const AdaptiveSimulatorTimer &) const override
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:274
bool timeStepAccepted(const double, const double) const override
For the general 3rd order controller, the internal shifting of errors and time steps happens here...
Definition: TimeStepControl.hpp:80
HardcodedTimeStepControl Input generated from summary file using the ert application: ...
Definition: TimeStepControl.hpp:306
bool timeStepAccepted(const double, const double) const override
For the general 3rd order controller, the internal shifting of errors and time steps happens here...
Definition: TimeStepControl.hpp:139
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
PID controller based adaptive time step control as above that also takes target iterations into accou...
Definition: TimeStepControl.hpp:164
A simple iteration count based adaptive time step control.
Definition: TimeStepControl.hpp:55
RelativeChangeInterface.
Definition: TimeStepControlInterface.hpp:33
PID controller based adaptive time step control as suggested in: Turek and Kuzmin.
Definition: TimeStepControl.hpp:115
TimeStepControlInterface.
Definition: TimeStepControlInterface.hpp:50
double computeTimeStepSize(const double dt, const int, const RelativeChangeInterface &relativeChange, const AdaptiveSimulatorTimer &) const override
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:188
double computeTimeStepSize(const double dt, const int iterations, const RelativeChangeInterface &, const AdaptiveSimulatorTimer &) const override
compute new time step size suggestions based on the PID controller
Definition: TimeStepControl.cpp:79