20#ifndef OPM_ADAPTIVE_TIME_STEPPING_IMPL_HPP
21#define OPM_ADAPTIVE_TIME_STEPPING_IMPL_HPP
24#ifndef OPM_ADAPTIVE_TIME_STEPPING_HPP
26#include <opm/simulators/timestepping/AdaptiveTimeStepping.hpp>
27#include <opm/simulators/timestepping/AdaptiveSimulatorTimer.hpp>
30#include <dune/istl/istlexception.hh>
32#include <opm/common/Exceptions.hpp>
33#include <opm/common/ErrorMacros.hpp>
34#include <opm/common/OpmLog/OpmLog.hpp>
36#include <opm/grid/utility/StopWatch.hpp>
38#include <opm/input/eclipse/Schedule/Tuning.hpp>
40#include <opm/input/eclipse/Units/Units.hpp>
41#include <opm/input/eclipse/Units/UnitSystem.hpp>
45#include <opm/simulators/timestepping/EclTimeSteppingParams.hpp>
53#include <boost/date_time/posix_time/posix_time.hpp>
54#include <fmt/format.h>
55#include <fmt/ranges.h>
63template<
class TypeTag>
64AdaptiveTimeStepping<TypeTag>::
65AdaptiveTimeStepping(
const UnitSystem& unit_system,
67 const double max_next_tstep,
68 const bool terminal_output
71 ,
restart_factor_{Parameters::Get<Parameters::SolverRestartFactor<Scalar>>()}
72 ,
growth_factor_{Parameters::Get<Parameters::SolverGrowthFactor<Scalar>>()}
73 ,
max_growth_{Parameters::Get<Parameters::SolverMaxGrowth<Scalar>>()}
75 Parameters::Get<Parameters::SolverMaxTimeStepInDays<Scalar>>() * 24 * 60 * 60}
77 unit_system.to_si(UnitSystem::measure::time,
78 Parameters::Get<Parameters::SolverMinTimeStep<Scalar>>())}
80 Parameters::Get<Parameters::SolverContinueOnConvergenceFailure>()}
82 ,
solver_verbose_{Parameters::Get<Parameters::SolverVerbosity>() > 0 && terminal_output}
83 ,
timestep_verbose_{Parameters::Get<Parameters::TimeStepVerbosity>() > 0 && terminal_output}
85 (max_next_tstep <= 0 ? Parameters::Get<Parameters::InitialTimeStepInDays>()
86 : max_next_tstep) * 24 * 60 * 60}
89 Parameters::Get<Parameters::TimeStepAfterEventInDays<Scalar>>() * 24 * 60 * 60}
92 Parameters::Get<Parameters::MinTimeStepBeforeShuttingProblematicWellsInDays>() * unit::day}
104template<
class TypeTag>
105AdaptiveTimeStepping<TypeTag>::
106AdaptiveTimeStepping(
double max_next_tstep,
107 const Tuning& tuning,
108 const UnitSystem& unit_system,
110 const bool terminal_output
120 ,
solver_verbose_{Parameters::Get<Parameters::SolverVerbosity>() > 0 && terminal_output}
121 ,
timestep_verbose_{Parameters::Get<Parameters::TimeStepVerbosity>() > 0 && terminal_output}
123 max_next_tstep <= 0 ? Parameters::Get<Parameters::InitialTimeStepInDays>() * 24 * 60 * 60
129 Parameters::Get<Parameters::MinTimeStepBeforeShuttingProblematicWellsInDays>() * unit::day}
135template<
class TypeTag>
147 switch (this->time_step_control_type_) {
148 case TimeStepControlType::HardCodedTimeStep:
149 result = castAndComp<HardcodedTimeStepControl>(rhs);
151 case TimeStepControlType::PIDAndIterationCount:
152 result = castAndComp<PIDAndIterationCountTimeStepControl>(rhs);
154 case TimeStepControlType::SimpleIterationCount:
155 result = castAndComp<SimpleIterationCountTimeStepControl>(rhs);
157 case TimeStepControlType::PID:
158 result = castAndComp<PIDTimeStepControl>(rhs);
160 case TimeStepControlType::General3rdOrder:
161 result = castAndComp<General3rdOrderController>(rhs);
177 this->min_time_step_before_shutting_problematic_wells_ ==
181template<
class TypeTag>
186 registerEclTimeSteppingParameters<Scalar>();
187 detail::registerAdaptiveParameters();
198template<
class TypeTag>
199template <
class Solver>
205 const TuningUpdateCallback& tuning_updater)
207 SubStepper<Solver> sub_stepper{
208 *
this, simulator_timer, solver, is_event, tuning_updater,
210 return sub_stepper.run();
213template<
class TypeTag>
214template<
class Serializer>
219 serializer(this->time_step_control_type_);
220 switch (this->time_step_control_type_) {
221 case TimeStepControlType::HardCodedTimeStep:
222 allocAndSerialize<HardcodedTimeStepControl>(serializer);
224 case TimeStepControlType::PIDAndIterationCount:
225 allocAndSerialize<PIDAndIterationCountTimeStepControl>(serializer);
227 case TimeStepControlType::SimpleIterationCount:
228 allocAndSerialize<SimpleIterationCountTimeStepControl>(serializer);
230 case TimeStepControlType::PID:
231 allocAndSerialize<PIDTimeStepControl>(serializer);
233 case TimeStepControlType::General3rdOrder:
234 allocAndSerialize<General3rdOrderController>(serializer);
237 serializer(this->restart_factor_);
238 serializer(this->growth_factor_);
239 serializer(this->max_growth_);
240 serializer(this->max_time_step_);
241 serializer(this->min_time_step_);
242 serializer(this->ignore_convergence_failure_);
243 serializer(this->solver_restart_max_);
244 serializer(this->solver_verbose_);
245 serializer(this->timestep_verbose_);
246 serializer(this->suggested_next_timestep_);
247 serializer(this->full_timestep_initially_);
248 serializer(this->timestep_after_event_);
249 serializer(this->use_newton_iteration_);
250 serializer(this->min_time_step_before_shutting_problematic_wells_);
253template<
class TypeTag>
261template<
class TypeTag>
266 return serializationTestObject_<HardcodedTimeStepControl>();
269template<
class TypeTag>
274 return serializationTestObject_<PIDTimeStepControl>();
277template<
class TypeTag>
282 return serializationTestObject_<PIDAndIterationCountTimeStepControl>();
285template<
class TypeTag>
290 return serializationTestObject_<SimpleIterationCountTimeStepControl>();
293template<
class TypeTag>
298 return serializationTestObject_<General3rdOrderController>();
302template<
class TypeTag>
307 this->suggested_next_timestep_ = x;
310template<
class TypeTag>
315 return this->suggested_next_timestep_;
318template<
class TypeTag>
323 return *this->time_step_control_;
327template<
class TypeTag>
334 if (max_next_tstep > 0) {
335 this->suggested_next_timestep_ = max_next_tstep;
339template<
class TypeTag>
342updateTUNING(
double max_next_tstep,
const Tuning& tuning)
344 this->restart_factor_ = tuning.TSFCNV;
345 this->growth_factor_ = tuning.TFDIFF;
346 this->max_growth_ = tuning.TSFMAX;
347 this->max_time_step_ = tuning.TSMAXZ;
348 updateNEXTSTEP(max_next_tstep);
349 this->timestep_after_event_ = tuning.TMAXWC;
356template<
class TypeTag>
357template<
class T,
class Serializer>
362 if (!serializer.isSerializing()) {
363 this->time_step_control_ = std::make_unique<T>();
365 serializer(*
static_cast<T*
>(this->time_step_control_.get()));
368template<
class TypeTag>
374 const T* lhs =
static_cast<const T*
>(this->time_step_control_.get());
375 const T* rhs =
static_cast<const T*
>(Rhs.time_step_control_.get());
379template<
class TypeTag>
386 if (this->suggested_next_timestep_ < 0) {
387 this->suggested_next_timestep_ = this->restart_factor_ * original_time_step;
390 if (this->full_timestep_initially_) {
391 this->suggested_next_timestep_ = original_time_step;
395 if (is_event && this->timestep_after_event_ > 0) {
396 this->suggested_next_timestep_ = this->timestep_after_event_;
400template<
class TypeTag>
401template<
class Controller>
409 result.growth_factor_ = 2.0;
410 result.max_growth_ = 3.0;
411 result.max_time_step_ = 4.0;
412 result.min_time_step_ = 5.0;
413 result.ignore_convergence_failure_ =
true;
414 result.solver_restart_max_ = 6;
415 result.solver_verbose_ =
true;
416 result.timestep_verbose_ =
true;
417 result.suggested_next_timestep_ = 7.0;
418 result.full_timestep_initially_ =
true;
419 result.use_newton_iteration_ =
true;
420 result.min_time_step_before_shutting_problematic_wells_ = 9.0;
421 result.time_step_control_type_ = Controller::Type;
422 result.time_step_control_ =
423 std::make_unique<Controller>(Controller::serializationTestObject());
432template<
class TypeTag>
434init_(
const UnitSystem& unitSystem)
436 std::tie(time_step_control_type_,
438 use_newton_iteration_) = detail::createController(unitSystem);
440 if (this->growth_factor_ < 1.0) {
441 OPM_THROW(std::runtime_error,
442 "Growth factor cannot be less than 1.");
452template<
class TypeTag>
453template<
class Solver>
459 const TuningUpdateCallback& tuning_updater)
460 : adaptive_time_stepping_{adaptive_time_stepping}
461 , simulator_timer_{simulator_timer}
463 , is_event_{is_event}
464 , tuning_updater_{tuning_updater}
468template<
class TypeTag>
469template<
class Solver>
474 return adaptive_time_stepping_;
477template<
class TypeTag>
478template<
class Solver>
483#ifdef RESERVOIR_COUPLING_ENABLED
484 if (isReservoirCouplingSlave_() && reservoirCouplingSlave_().activated()) {
485 return runStepReservoirCouplingSlave_();
487 else if (isReservoirCouplingMaster_() && reservoirCouplingMaster_().activated()) {
488 return runStepReservoirCouplingMaster_();
491 return runStepOriginal_();
494 return runStepOriginal_();
502#ifdef RESERVOIR_COUPLING_ENABLED
503template<
class TypeTag>
504template<
class Solver>
509 return this->solver_.model().simulator().reservoirCouplingMaster() !=
nullptr;
512template<
class TypeTag>
513template<
class Solver>
518 return this->solver_.model().simulator().reservoirCouplingSlave() !=
nullptr;
522template<
class TypeTag>
523template<
class Solver>
528 this->adaptive_time_stepping_.maybeModifySuggestedTimeStepAtBeginningOfReportStep_(
529 original_time_step, this->is_event_
536template<
class TypeTag>
537template<
class Solver>
542 return this->tuning_updater_(elapsed, dt, sub_step_number);
545template<
class TypeTag>
546template<
class Solver>
554template <
class TypeTag>
555template <
class Solver>
560 const auto elapsed = this->simulator_timer_.simulationTimeElapsed();
561 const auto original_time_step = this->simulator_timer_.currentStepLength();
562 const auto report_step = this->simulator_timer_.reportStepNum();
563 maybeUpdateTuning_(elapsed, original_time_step, report_step);
564 maybeModifySuggestedTimeStepAtBeginningOfReportStep_(original_time_step);
567 this->simulator_timer_.startDateTime(),
570 suggestedNextTimestep_(),
574 SubStepIteration<Solver> substepIteration{*
this, substep_timer, original_time_step,
true};
575 return substepIteration.run();
578#ifdef RESERVOIR_COUPLING_ENABLED
579template <
class TypeTag>
580template <
class Solver>
585 return *(this->solver_.model().simulator().reservoirCouplingMaster());
589#ifdef RESERVOIR_COUPLING_ENABLED
590template <
class TypeTag>
591template <
class Solver>
596 return *(this->solver_.model().simulator().reservoirCouplingSlave());
600#ifdef RESERVOIR_COUPLING_ENABLED
631template <
class TypeTag>
632template <
class Solver>
638 const double original_time_step = this->simulator_timer_.currentStepLength();
639 double current_time{this->simulator_timer_.simulationTimeElapsed()};
640 double step_end_time = current_time + original_time_step;
641 auto current_step_length = original_time_step;
644 reservoirCouplingMaster_().maybeReceiveActivationHandshakeFromSlaves(current_time);
646 reservoirCouplingMaster_().receiveNextReportDateFromSlaves();
647 if (iteration == 0) {
648 maybeUpdateTuning_(current_time, current_step_length, 0);
650 current_step_length = reservoirCouplingMaster_().maybeChopSubStep(
651 current_step_length, current_time);
652 reservoirCouplingMaster_().sendNextTimeStepToSlaves(current_step_length);
653 if (iteration == 0) {
654 maybeModifySuggestedTimeStepAtBeginningOfReportStep_(current_step_length);
657 this->simulator_timer_.startDateTime(),
660 suggestedNextTimestep_(),
661 this->simulator_timer_.reportStepNum(),
665 current_time + current_step_length, step_end_time
667 SubStepIteration<Solver> substepIteration{*
this, substep_timer, current_step_length, final_step};
668 const auto sub_steps_report = substepIteration.run();
669 report += sub_steps_report;
670 current_time += current_step_length;
680#ifdef RESERVOIR_COUPLING_ENABLED
681template <
class TypeTag>
682template <
class Solver>
688 const double original_time_step = this->simulator_timer_.currentStepLength();
689 double current_time{this->simulator_timer_.simulationTimeElapsed()};
690 double step_end_time = current_time + original_time_step;
693 reservoirCouplingSlave_().sendNextReportDateToMasterProcess();
694 const auto timestep = reservoirCouplingSlave_().receiveNextTimeStepFromMaster();
695 if (iteration == 0) {
696 maybeUpdateTuning_(current_time, original_time_step, 0);
697 maybeModifySuggestedTimeStepAtBeginningOfReportStep_(timestep);
700 this->simulator_timer_.startDateTime(),
703 suggestedNextTimestep_(),
704 this->simulator_timer_.reportStepNum(),
708 current_time + timestep, step_end_time
710 SubStepIteration<Solver> substepIteration{*
this, substep_timer, timestep, final_step};
711 const auto sub_steps_report = substepIteration.run();
712 report += sub_steps_report;
713 current_time += timestep;
724template <
class TypeTag>
725template <
class Solver>
730 return this->adaptive_time_stepping_.suggestedNextStep();
739template<
class TypeTag>
740template<
class Solver>
744 const double original_time_step,
746 : substepper_{substepper}
747 , substep_timer_{substep_timer}
748 , original_time_step_{original_time_step}
749 , final_step_{final_step}
750 , adaptive_time_stepping_{substepper.getAdaptiveTimerStepper()}
754template <
class TypeTag>
755template <
class Solver>
760 auto& simulator = solver_().model().simulator();
761 auto& problem = simulator.problem();
767 while (!this->substep_timer_.done()) {
771 maybeUpdateTuningAndTimeStep_();
773 const double dt = this->substep_timer_.currentStepLength();
774 if (timeStepVerbose_()) {
775 detail::logTimer(this->substep_timer_);
778 const auto substep_report = runSubStep_();
781 problem.setSubStepReport(substep_report);
782 auto& full_report = adaptive_time_stepping_.report();
783 full_report += substep_report;
784 problem.setSimulationReport(full_report);
786 report += substep_report;
788 if (substep_report.converged || checkContinueOnUnconvergedSolution_(dt)) {
789 ++this->substep_timer_;
791 const int iterations = getNumIterations_(substep_report);
792 auto dt_estimate = timeStepControlComputeEstimate_(
793 dt, iterations, this->substep_timer_);
795 assert(dt_estimate > 0);
796 dt_estimate = maybeRestrictTimeStepGrowth_(dt, dt_estimate, restarts);
799 maybeReportSubStep_(substep_report);
800 if (this->final_step_ && this->substep_timer_.done()) {
805 report.success.output_write_time += writeOutput_();
809 setTimeStep_(dt_estimate);
811 report.success.converged = this->substep_timer_.done();
812 this->substep_timer_.setLastStepFailed(
false);
815 this->substep_timer_.setLastStepFailed(
true);
816 checkTimeStepMaxRestartLimit_(restarts);
818 double new_time_step = restartFactor_() * dt;
819 if (substep_report.time_step_rejected) {
822 const double temp_time_step = std::sqrt(safetyFactor * tol / solver_().model().relativeChange()) * dt;
823 if (temp_time_step < dt) {
824 new_time_step = temp_time_step;
827 checkTimeStepMinLimit_(new_time_step);
828 bool wells_shut =
false;
829 if (new_time_step > minTimeStepBeforeClosingWells_()) {
830 chopTimeStep_(new_time_step);
832 wells_shut = chopTimeStepOrCloseFailingWells_(new_time_step);
841 problem.setNextTimeStepSize(this->substep_timer_.currentStepLength());
843 updateSuggestedNextStep_();
853template<
class TypeTag>
854template<
class Solver>
859 const bool continue_on_uncoverged_solution = ignoreConvergenceFailure_() && dt <= minTimeStep_();
860 if (continue_on_uncoverged_solution && solverVerbose_()) {
862 const auto msg = fmt::format(
863 "Solver failed to converge but timestep {} is smaller or equal to {}\n"
864 "which is the minimum threshold given by option --solver-min-time-step\n",
867 OpmLog::problem(msg);
869 return continue_on_uncoverged_solution;
872template<
class TypeTag>
873template<
class Solver>
880 if (restarts >= solverRestartMax_()) {
881 const auto msg = fmt::format(
882 "Solver failed to converge after cutting timestep {} times.", restarts
884 if (solverVerbose_()) {
888 throw TimeSteppingBreakdown{msg};
892template<
class TypeTag>
893template<
class Solver>
898 using Meas = UnitSystem::measure;
901 if (new_time_step < minTimeStep_()) {
902 auto msg = fmt::format(
"Solver failed to converge after cutting timestep to ");
904 const UnitSystem& unit_system = solver_().model().simulator().vanguard().eclState().getDeckUnitSystem();
906 "{:.3E} {}\nwhich is the minimum threshold given by the TUNING keyword\n",
907 unit_system.from_si(Meas::time, minTimeStep_()),
908 unit_system.name(Meas::time)
913 "{:.3E} DAYS\nwhich is the minimum threshold given by option --solver-min-time-step\n",
914 minTimeStep_() / 86400.0
917 if (solverVerbose_()) {
921 throw TimeSteppingBreakdown{msg};
925template<
class TypeTag>
926template<
class Solver>
931 setTimeStep_(new_time_step);
932 if (solverVerbose_()) {
933 const auto msg = fmt::format(
"{}\nTimestep chopped to {} days\n",
934 this->cause_of_failure_,
935 unit::convert::to(this->substep_timer_.currentStepLength(), unit::day));
936 OpmLog::problem(msg);
940template<
class TypeTag>
941template<
class Solver>
946 bool wells_shut =
false;
953 const bool requireRepeatedFailures =
954 new_time_step > (minTimeStepBeforeClosingWells_() * restartFactor_() * restartFactor_());
955 const std::set<std::string> failing_wells =
956 detail::consistentlyFailingWells(solver_().model().stepReports(), requireRepeatedFailures);
958 if (failing_wells.empty()) {
960 chopTimeStep_(new_time_step);
963 std::vector<std::string> shut_wells;
964 for (
const auto& well : failing_wells) {
965 const bool was_shut =
966 solver_().model().wellModel().forceShutWellByName(well,
967 this->substep_timer_.simulationTimeElapsed(),
970 shut_wells.push_back(well);
974 if (shut_wells.empty()) {
975 for (
const auto& well : failing_wells) {
976 const bool was_shut =
977 solver_().model().wellModel().forceShutWellByName(well,
978 this->substep_timer_.simulationTimeElapsed(),
981 shut_wells.push_back(well);
986 if (shut_wells.empty()) {
987 chopTimeStep_(new_time_step);
990 if (solverVerbose_()) {
991 const std::string msg =
992 fmt::format(
"\nProblematic well(s) were shut: {}"
993 "(retrying timestep)\n",
994 fmt::join(shut_wells,
" "));
995 OpmLog::problem(msg);
1002template<
class TypeTag>
1003template<
class Solver>
1004boost::posix_time::ptime
1008 return simulatorTimer_().currentDateTime();
1011template<
class TypeTag>
1012template<
class Solver>
1017 if (useNewtonIteration_()) {
1018 return substep_report.total_newton_iterations;
1021 return substep_report.total_linear_iterations;
1025template<
class TypeTag>
1026template<
class Solver>
1034template<
class TypeTag>
1035template<
class Solver>
1043template<
class TypeTag>
1044template<
class Solver>
1052template<
class TypeTag>
1053template<
class Solver>
1058 if (timeStepVerbose_()) {
1059 std::ostringstream ss;
1060 substep_report.reportStep(ss);
1061 OpmLog::info(ss.str());
1065template<
class TypeTag>
1066template<
class Solver>
1072 dt_estimate = std::min(dt_estimate,
double(maxGrowth_() * dt));
1073 assert(dt_estimate > 0);
1076 dt_estimate = std::min(growthFactor_() * dt, dt_estimate);
1085template<
class TypeTag>
1086template<
class Solver>
1097 const auto old_value = suggestedNextTimestep_();
1098 if (this->substepper_.maybeUpdateTuning_(this->substep_timer_.simulationTimeElapsed(),
1099 this->substep_timer_.currentStepLength(),
1100 this->substep_timer_.currentStepNum()))
1107 setTimeStep_(suggestedNextTimestep_());
1108 setSuggestedNextStep_(old_value);
1112template<
class TypeTag>
1113template<
class Solver>
1121template<
class TypeTag>
1122template<
class Solver>
1130template<
class TypeTag>
1131template<
class Solver>
1139template<
class TypeTag>
1140template<
class Solver>
1147 auto handleFailure = [
this, &substep_report]
1148 (
const std::string& failure_reason,
const std::exception& e,
bool log_exception =
true)
1150 substep_report = solver_().failureReport();
1151 this->cause_of_failure_ = failure_reason;
1152 if (log_exception && solverVerbose_()) {
1153 OpmLog::debug(std::string(
"Caught Exception: ") + e.what());
1158 substep_report = solver_().step(this->substep_timer_, &this->adaptive_time_stepping_.timeStepControl());
1159 if (solverVerbose_()) {
1161 OpmLog::debug(
"Overall linear iterations used: "
1162 + std::to_string(substep_report.total_linear_iterations));
1165 catch (
const TooManyIterations& e) {
1166 handleFailure(
"Solver convergence failure - Iteration limit reached", e);
1168 catch (
const TimeSteppingBreakdown& e) {
1169 handleFailure(e.what(), e);
1171 catch (
const ConvergenceMonitorFailure& e) {
1172 handleFailure(
"Convergence monitor failure", e,
false);
1174 catch (
const LinearSolverProblem& e) {
1175 handleFailure(
"Linear solver convergence failure", e);
1177 catch (
const NumericalProblem& e) {
1178 handleFailure(
"Solver convergence failure - Numerical problem encountered", e);
1180 catch (
const std::runtime_error& e) {
1181 handleFailure(
"Runtime error encountered", e);
1183 catch (
const Dune::ISTLError& e) {
1184 handleFailure(
"ISTL error - Time step too large", e);
1186 catch (
const Dune::MatrixBlockError& e) {
1187 handleFailure(
"Matrix block error", e);
1190 return substep_report;
1193template<
class TypeTag>
1194template<
class Solver>
1199 this->substep_timer_.provideTimeStepEstimate(dt_estimate);
1202template<
class TypeTag>
1203template<
class Solver>
1208 return this->substepper_.solver_;
1212template<
class TypeTag>
1213template<
class Solver>
1221template<
class TypeTag>
1222template<
class Solver>
1227 this->adaptive_time_stepping_.setSuggestedNextStep(step);
1230template <
class TypeTag>
1231template <
class Solver>
1236 return this->substepper_.simulator_timer_;
1239template <
class TypeTag>
1240template <
class Solver>
1248template<
class TypeTag>
1249template<
class Solver>
1250boost::posix_time::ptime
1254 return simulatorTimer_().startDateTime();
1257template <
class TypeTag>
1258template <
class Solver>
1263 return this->adaptive_time_stepping_.suggestedNextStep();
1266template <
class TypeTag>
1267template <
class Solver>
1274 const SolutionTimeErrorSolverWrapper<Solver> relative_change{solver_()};
1276 dt, iterations, relative_change, substepTimer);
1279template <
class TypeTag>
1280template <
class Solver>
1295template <
class TypeTag>
1296template <
class Solver>
1301 auto suggested_next_step = this->substep_timer_.currentStepLength();
1302 if (! std::isfinite(suggested_next_step)) {
1303 suggested_next_step = this->original_time_step_;
1305 if (timeStepVerbose_()) {
1306 std::ostringstream ss;
1307 this->substep_timer_.report(ss);
1308 ss <<
"Suggested next step size = "
1309 << unit::convert::to(suggested_next_step, unit::day) <<
" (days)" << std::endl;
1310 OpmLog::debug(ss.str());
1312 setSuggestedNextStep_(suggested_next_step);
1315template <
class TypeTag>
1316template <
class Solver>
1324template <
class TypeTag>
1325template <
class Solver>
1330 time::StopWatch perf_timer;
1332 auto& problem = solver_().model().simulator().problem();
1333 problem.writeOutput(
true);
1334 return perf_timer.secsSinceStart();
1341template<
class TypeTag>
1342template<
class Solver>
1349template<
class TypeTag>
1350template<
class Solver>
1351double AdaptiveTimeStepping<TypeTag>::SolutionTimeErrorSolverWrapper<Solver>::relativeChange()
const
1354 return solver_.model().relativeChange();
Simulation timer for adaptive time stepping.
Definition AdaptiveSimulatorTimer.hpp:41
Definition AdaptiveTimeStepping.hpp:78
double max_growth_
factor that limits the maximum growth of a time step
Definition AdaptiveTimeStepping.hpp:252
double max_time_step_
maximal allowed time step size in days
Definition AdaptiveTimeStepping.hpp:253
bool solver_verbose_
solver verbosity
Definition AdaptiveTimeStepping.hpp:257
int solver_restart_max_
how many restart of solver are allowed
Definition AdaptiveTimeStepping.hpp:256
double timestep_after_event_
suggested size of timestep after an event
Definition AdaptiveTimeStepping.hpp:261
bool ignore_convergence_failure_
continue instead of stop when minimum time step is reached
Definition AdaptiveTimeStepping.hpp:255
double suggested_next_timestep_
suggested size of next timestep
Definition AdaptiveTimeStepping.hpp:259
TimeStepControlType time_step_control_type_
type of time step control object
Definition AdaptiveTimeStepping.hpp:248
bool full_timestep_initially_
beginning with the size of the time step from data file
Definition AdaptiveTimeStepping.hpp:260
SimulatorReport step(const SimulatorTimer &simulator_timer, Solver &solver, const bool is_event, const TuningUpdateCallback &tuning_updater)
step method that acts like the solver::step method in a sub cycle of time steps
Definition AdaptiveTimeStepping_impl.hpp:202
double growth_factor_
factor to multiply time step when solver recovered from failed convergence
Definition AdaptiveTimeStepping.hpp:251
double restart_factor_
factor to multiply time step with when solver fails to converge
Definition AdaptiveTimeStepping.hpp:250
double min_time_step_
minimal allowed time step size before throwing
Definition AdaptiveTimeStepping.hpp:254
TimeStepController time_step_control_
time step control object
Definition AdaptiveTimeStepping.hpp:249
double min_time_step_before_shutting_problematic_wells_
< shut problematic wells when time step size in days are less than this
Definition AdaptiveTimeStepping.hpp:265
bool timestep_verbose_
timestep verbosity
Definition AdaptiveTimeStepping.hpp:258
bool use_newton_iteration_
use newton iteration count for adaptive time step control
Definition AdaptiveTimeStepping.hpp:262
Definition ReservoirCouplingMaster.hpp:35
Definition ReservoirCouplingSlave.hpp:35
Definition SimulatorTimer.hpp:39
TimeStepControlInterface.
Definition TimeStepControlInterface.hpp:51
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
This file provides the infrastructure to retrieve run-time parameters.
auto Get(bool errorIfNotRegistered=true)
Retrieve a runtime parameter.
Definition parametersystem.hpp:187
static bool compare_gt_or_eq(double a, double b)
Determines if a is greater than b within the specified tolerance.
Definition ReservoirCoupling.cpp:120
A struct for returning timing data from a simulator to its caller.
Definition SimulatorReport.hpp:34
Definition SimulatorReport.hpp:122