opm-simulators
Loading...
Searching...
No Matches
Opm::AdaptiveTimeStepping< TypeTag > Class Template Reference

Adaptive time-stepping coordinator for the black-oil simulator. More...

#include <AdaptiveTimeStepping.hpp>

Public Types

using TuningUpdateCallback
 Callback invoked at the start of each substep to apply TUNING, NEXTSTEP (via ACTIONX), and WCYCLE updates.

Public Member Functions

 AdaptiveTimeStepping (const UnitSystem &unitSystem, const SimulatorReport &full_report, const double max_next_tstep=-1.0, const bool terminalOutput=true)
 contructor taking parameter object
 AdaptiveTimeStepping (double max_next_tstep, const Tuning &tuning, const UnitSystem &unitSystem, const SimulatorReport &full_report, const bool terminalOutput=true)
 contructor
bool operator== (const AdaptiveTimeStepping< TypeTag > &rhs) const
void setSuggestedNextStep (const double x)
 Set the suggested length for the next substep [s].
double suggestedNextStep () const
 Current suggested length for the next substep [s].
const TimeStepControlInterfacetimeStepControl () const
template<class Solver>
SimulatorReport step (const SimulatorTimer &simulator_timer, Solver &solver, const bool is_event, const TuningUpdateCallback &tuning_updater)
 Run one report step by orchestrating adaptive substepping.
void updateTUNING (double max_next_tstep, const Tuning &tuning)
 Apply TUNING keyword parameters.
void updateNEXTSTEP (double max_next_tstep)
 Set suggested_next_timestep_ to max_next_tstep iff max_next_tstep > 0.
template<class Serializer>
void serializeOp (Serializer &serializer)
SimulatorReportreport ()

Static Public Member Functions

static void registerParameters ()
static AdaptiveTimeStepping< TypeTag > serializationTestObjectHardcoded ()
static AdaptiveTimeStepping< TypeTag > serializationTestObjectPID ()
static AdaptiveTimeStepping< TypeTag > serializationTestObjectPIDIt ()
static AdaptiveTimeStepping< TypeTag > serializationTestObjectSimple ()
static AdaptiveTimeStepping< TypeTag > serializationTestObject3rdOrder ()

Protected Types

using TimeStepController = std::unique_ptr<TimeStepControlInterface>

Protected Member Functions

void init_ (const UnitSystem &unitSystem)

Protected Attributes

TimeStepControlType time_step_control_type_ {TimeStepControlType::PIDAndIterationCount}
 type of time step control object
TimeStepController time_step_control_ {}
 time step control object
double restart_factor_ {}
 factor to multiply time step with when solver fails to converge
double growth_factor_ {}
 factor to multiply time step when solver recovered from failed convergence
double max_growth_ {}
 factor that limits the maximum growth of a time step
double max_time_step_ {}
 maximal allowed time step size in days
double min_time_step_ {}
 minimal allowed time step size before throwing
bool ignore_convergence_failure_ {false}
 continue instead of stop when minimum time step is reached
int solver_restart_max_ {}
 how many restart of solver are allowed
bool solver_verbose_ {false}
 solver verbosity
bool timestep_verbose_ {false}
 timestep verbosity
double suggested_next_timestep_ {}
 suggested size of next timestep
bool full_timestep_initially_ {false}
 beginning with the size of the time step from data file
double timestep_after_event_ {}
 suggested size of timestep after an event
bool use_newton_iteration_ {false}
 use newton iteration count for adaptive time step control
double min_time_step_before_shutting_problematic_wells_ {}
 < shut problematic wells when time step size in days are less than this
SimulatorReport report_ {}

Detailed Description

template<class TypeTag>
class Opm::AdaptiveTimeStepping< TypeTag >

Adaptive time-stepping coordinator for the black-oil simulator.

Drives the substep loop inside each report step. A report step is the time interval between dates defined in the deck SCHEDULE. Within a report step, this class chooses a sequence of smaller substeps whose lengths are adjusted to honour:

  • the solver's convergence behaviour (chop on failure, grow on success);
  • TUNING keywords and ACTIONX-driven NEXTSTEP updates;
  • WCYCLE well-cycling schedules;
  • (when reservoir coupling is enabled) master/slave sync dates.

The user-facing entry point is step(). The substep loop itself is split across the nested helpers SubStepper (which selects between the original loop and the two reservoir-coupling variants) and SubStepIteration (which runs the inner per-substep logic).

Member Typedef Documentation

◆ TuningUpdateCallback

template<class TypeTag>
using Opm::AdaptiveTimeStepping< TypeTag >::TuningUpdateCallback
Initial value:
std::function<bool(double elapsed,
double substep_length,
int sub_step_number)>

Callback invoked at the start of each substep to apply TUNING, NEXTSTEP (via ACTIONX), and WCYCLE updates.

Called once by SimulatorFullyImplicitBlackoil::runStep at the start of a report step, and once per substep inside SubStepIteration::maybeUpdateTuningAndTimeStep_ (plus equivalent sites in the reservoir-coupling loops). The callback may adjust the simulator's suggested next substep via updateNEXTSTEP() or updateTUNING().

Parameters
elapsedSimulation time elapsed at the call point [s].
substep_lengthCandidate length of the substep about to run [s]. This is the look-ahead horizon the callback uses internally, e.g. WCYCLE chops the substep if a well switching event falls inside [elapsed, elapsed + substep_length].
sub_step_numberIndex of the substep within its report step; 0 means "first substep". WCYCLE's REQUEST_OPEN_WELL handling is only consulted when this is 0.
Returns
true if the callback modified suggested_next_timestep_.

Constructor & Destructor Documentation

◆ AdaptiveTimeStepping()

template<class TypeTag>
Opm::AdaptiveTimeStepping< TypeTag >::AdaptiveTimeStepping ( double max_next_tstep,
const Tuning & tuning,
const UnitSystem & unit_system,
const SimulatorReport & report,
const bool terminal_output = true )

contructor

Parameters
max_next_tstepMaximum next time step allowed
tuningPointer to ecl TUNING keyword
unit_systemUnit system to use
reportSimulator report to use
terminal_outputTrue to print to terminal

Member Function Documentation

◆ step()

template<class TypeTag>
template<class Solver>
SimulatorReport Opm::AdaptiveTimeStepping< TypeTag >::step ( const SimulatorTimer & simulator_timer,
Solver & solver,
const bool is_event,
const TuningUpdateCallback & tuning_updater )

Run one report step by orchestrating adaptive substepping.

Splits the report step into a sequence of smaller substeps whose lengths are chosen adaptively, invoking solver once per substep. Called from SimulatorFullyImplicitBlackoil::runStep in place of a direct Solver::step() call on the non-adaptive path. The actual substep loop lives one layer down in SubStepper::run(); this method just constructs a SubStepper and delegates.

Parameters
simulator_timerOuter report-step timer.
solverNewton solver invoked once per substep.
is_eventTrue if this report step carries an event (NEW_WELL, INJECTION_UPDATE, etc.); affects SubStepper::maybeModifySuggestedTimeStepAtBeginningOfReportStep_.
tuning_updaterCallback invoked to apply TUNING / NEXTSTEP / WCYCLE updates; see TuningUpdateCallback.

◆ suggestedNextStep()

template<class TypeTag>
double Opm::AdaptiveTimeStepping< TypeTag >::suggestedNextStep ( ) const

Current suggested length for the next substep [s].

Updated by the time-step controller, by TUNING/NEXTSTEP application, and by WCYCLE chopping.

◆ updateNEXTSTEP()

template<class TypeTag>
void Opm::AdaptiveTimeStepping< TypeTag >::updateNEXTSTEP ( double max_next_tstep)

Set suggested_next_timestep_ to max_next_tstep iff max_next_tstep > 0.

Used by both the TUNING path and the WCYCLE path in the tuning-update callback. A non-positive value is interpreted as "no suggestion" and is silently ignored.

◆ updateTUNING()

template<class TypeTag>
void Opm::AdaptiveTimeStepping< TypeTag >::updateTUNING ( double max_next_tstep,
const Tuning & tuning )

Apply TUNING keyword parameters.

Overwrites restart_factor_, growth_factor_, max_growth_, max_time_step_, and timestep_after_event_ from tuning, then forwards max_next_tstep to updateNEXTSTEP().

Parameters
max_next_tstepNext-step suggestion [s]; ignored if <= 0.
tuningSource of the new TUNING parameters.

The documentation for this class was generated from the following files: