Opm::SimulatorFullyImplicitBlackoil< TypeTag > Class Template Reference

Top-level driver for a fully implicit black-oil simulation. More...

#include <SimulatorFullyImplicitBlackoil.hpp>

Inheritance diagram for Opm::SimulatorFullyImplicitBlackoil< TypeTag >:
Inheritance graph

Public Types

using Simulator = GetPropType< TypeTag, Properties::Simulator >
 
using Grid = GetPropType< TypeTag, Properties::Grid >
 
using FluidSystem = GetPropType< TypeTag, Properties::FluidSystem >
 
using ElementContext = GetPropType< TypeTag, Properties::ElementContext >
 
using BlackoilIndices = GetPropType< TypeTag, Properties::Indices >
 
using PrimaryVariables = GetPropType< TypeTag, Properties::PrimaryVariables >
 
using MaterialLaw = GetPropType< TypeTag, Properties::MaterialLaw >
 
using SolutionVector = GetPropType< TypeTag, Properties::SolutionVector >
 
using MaterialLawParams = GetPropType< TypeTag, Properties::MaterialLawParams >
 
using AquiferModel = GetPropType< TypeTag, Properties::AquiferModel >
 
using Model = GetPropType< TypeTag, Properties::NonlinearSystem >
 
using Scalar = GetPropType< TypeTag, Properties::Scalar >
 
using TimeStepper = AdaptiveTimeStepping< TypeTag >
 
using PolymerModule = BlackOilPolymerModule< TypeTag >
 
using BioeffectsModule = BlackOilBioeffectsModule< TypeTag >
 
using Solver = NonlinearSolver< TypeTag, Model >
 
using ModelParameters = typename Model::ModelParameters
 
using SolverParameters = typename Solver::SolverParameters
 
using WellModel = BlackoilWellModel< TypeTag >
 

Public Member Functions

 SimulatorFullyImplicitBlackoil (Simulator &simulator)
 Construct from the surrounding eWoms Simulator. More...
 
 ~SimulatorFullyImplicitBlackoil () override
 Ends the convergence-output thread cleanly on all ranks. More...
 
SimulatorReport run (SimulatorTimer &timer)
 Run the entire simulation to completion. More...
 
void init (const SimulatorTimer &timer)
 One-shot setup performed before the first runStep. More...
 
void updateTUNING (const Tuning &tuning)
 Apply a TUNING keyword to the cached model parameters. More...
 
void updateTUNINGDP (const TuningDp &tuning_dp)
 Apply a TUNINGDP keyword to the cached model parameters. More...
 
bool runStep (SimulatorTimer &timer)
 Advance the simulation by one report step. More...
 
SimulatorReport finalize ()
 Stop the timers and emit the final OPMRST output. More...
 
const Gridgrid () const
 
template<class Serializer >
void serializeOp (Serializer &serializer)
 
const Modelmodel () const
 

Static Public Member Functions

static void registerParameters ()
 Register all parameters consumed by this class and its major collaborators. More...
 

Protected Member Functions

void loadState (HDF5Serializer &serializer, const std::string &groupName) override
 Load this simulator's data block from an OPMRST file via HDF5. More...
 
void saveState (HDF5Serializer &serializer, const std::string &groupName) const override
 Save this simulator's data block to an OPMRST file via HDF5. More...
 
std::array< std::string, 5 > getHeader () const override
 
const std::vector< int > & getCellMapping () const override
 Local-to-global cell index mapping. More...
 
std::unique_ptr< SolvercreateSolver (WellModel &wellModel)
 Build the Solver used during the current report step. More...
 
const EclipseState & eclState () const
 
const Schedule & schedule () const
 
bool isRestart () const
 
WellModelwellModel_ ()
 
const WellModelwellModel_ () const
 

Protected Attributes

Simulatorsimulator_
 Surrounding eWoms simulator; observed, not owned. More...
 
ModelParameters modelParam_
 Cached model parameters; mutated by TUNING / TUNINGDP application. More...
 
SolverParameters solverParam_
 Cached nonlinear-solver parameters. More...
 
std::unique_ptr< Solversolver_
 Built lazily on the first runStep call; reused thereafter. More...
 
bool terminalOutput_
 Emit high-level progress to std::cout (rank 0 only). More...
 
SimulatorReport report_
 Aggregated report across the entire simulation. More...
 
std::unique_ptr< time::StopWatch > solverTimer_
 Wall-clock for the current report step's solve. More...
 
std::unique_ptr< time::StopWatch > totalTimer_
 Wall-clock for the entire simulation. More...
 
std::unique_ptr< TimeStepperadaptiveTimeStepping_
 Set iff adaptive time stepping is enabled. More...
 
SimulatorConvergenceOutput convergence_output_ {}
 Background thread for INFOSTEP / INFOITER files. More...
 
SimulatorSerializer serializer_
 OPMRST save / load. More...
 

Detailed Description

template<class TypeTag>
class Opm::SimulatorFullyImplicitBlackoil< TypeTag >

Top-level driver for a fully implicit black-oil simulation.

Owns the per-report-step loop: run repeatedly invokes runStep until timer.done() is reached. Each runStep covers one report step (the interval between dates in the deck SCHEDULE), either as a single Solver::step call or, when adaptive time stepping is enabled (the default), by delegating the substep loop to AdaptiveTimeStepping::step.

Beyond the report-step loop, this class owns:

  • the NonlinearSolver, constructed lazily on the first runStep call;
  • per-report-step TUNING / TUNINGDP application via updateTUNING and updateTUNINGDP;
  • the WCYCLE-aware tuning-update callback handed to AdaptiveTimeStepping;
  • simulation report aggregation and wall-clock timing;
  • the convergence-output thread lifecycle (INFOSTEP / INFOITER);
  • OPMRST save/load via SimulatorSerializer;
  • reservoir-coupling master/slave bring-up and shutdown when RESERVOIR_COUPLING_ENABLED is set.

The class is instantiated once per simulation process. Static configuration is registered via registerParameters during program startup.

Member Typedef Documentation

◆ AquiferModel

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::AquiferModel = GetPropType<TypeTag, Properties::AquiferModel>

◆ BioeffectsModule

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::BioeffectsModule = BlackOilBioeffectsModule<TypeTag>

◆ BlackoilIndices

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::BlackoilIndices = GetPropType<TypeTag, Properties::Indices>

◆ ElementContext

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::ElementContext = GetPropType<TypeTag, Properties::ElementContext>

◆ FluidSystem

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>

◆ Grid

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::Grid = GetPropType<TypeTag, Properties::Grid>

◆ MaterialLaw

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::MaterialLaw = GetPropType<TypeTag, Properties::MaterialLaw>

◆ MaterialLawParams

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::MaterialLawParams = GetPropType<TypeTag, Properties::MaterialLawParams>

◆ Model

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::Model = GetPropType<TypeTag, Properties::NonlinearSystem>

◆ ModelParameters

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::ModelParameters = typename Model::ModelParameters

◆ PolymerModule

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::PolymerModule = BlackOilPolymerModule<TypeTag>

◆ PrimaryVariables

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>

◆ Scalar

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::Scalar = GetPropType<TypeTag, Properties::Scalar>

◆ Simulator

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::Simulator = GetPropType<TypeTag, Properties::Simulator>

◆ SolutionVector

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>

◆ Solver

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::Solver = NonlinearSolver<TypeTag, Model>

◆ SolverParameters

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::SolverParameters = typename Solver::SolverParameters

◆ TimeStepper

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::TimeStepper = AdaptiveTimeStepping<TypeTag>

◆ WellModel

template<class TypeTag >
using Opm::SimulatorFullyImplicitBlackoil< TypeTag >::WellModel = BlackoilWellModel<TypeTag>

Constructor & Destructor Documentation

◆ SimulatorFullyImplicitBlackoil()

template<class TypeTag >
Opm::SimulatorFullyImplicitBlackoil< TypeTag >::SimulatorFullyImplicitBlackoil ( Simulator simulator)
explicit

Construct from the surrounding eWoms Simulator.

Initialises the OPMRST serializer from the SaveStep / LoadStep / SaveFile / LoadFile parameters and, on rank 0 with terminal output enabled, starts the background convergence-output thread that writes INFOSTEP / INFOITER files.

Parameters
simulatorThe surrounding eWoms simulator; observed, not owned.

References Opm::SimulatorFullyImplicitBlackoil< TypeTag >::convergence_output_, Opm::SimulatorFullyImplicitBlackoil< TypeTag >::grid(), Opm::SimulatorFullyImplicitBlackoil< TypeTag >::simulator_, and Opm::SimulatorFullyImplicitBlackoil< TypeTag >::terminalOutput_.

◆ ~SimulatorFullyImplicitBlackoil()

template<class TypeTag >
Opm::SimulatorFullyImplicitBlackoil< TypeTag >::~SimulatorFullyImplicitBlackoil
override

Ends the convergence-output thread cleanly on all ranks.

Member Function Documentation

◆ createSolver()

template<class TypeTag >
std::unique_ptr< typename SimulatorFullyImplicitBlackoil< TypeTag >::Solver > Opm::SimulatorFullyImplicitBlackoil< TypeTag >::createSolver ( WellModel wellModel)
protected

Build the Solver used during the current report step.

Wraps a freshly constructed Model in a Solver. Side effect: if write_partitions is set in the model parameters, the partition layout is written under <output_dir>/partition/<case> on the first call only — the flag is cleared after, so subsequent calls skip the dump.

◆ eclState()

template<class TypeTag >
const EclipseState & Opm::SimulatorFullyImplicitBlackoil< TypeTag >::eclState ( ) const
inlineprotected

◆ finalize()

template<class TypeTag >
SimulatorReport Opm::SimulatorFullyImplicitBlackoil< TypeTag >::finalize

Stop the timers and emit the final OPMRST output.

Called by run after the report-step loop finishes. Stops the total wall-clock timer and marks the report as converged.

Returns
The final aggregated simulation report.

References Opm::SimulatorReportSingle::output_write_time, and Opm::SimulatorReport::success.

◆ getCellMapping()

template<class TypeTag >
const std::vector< int > & Opm::SimulatorFullyImplicitBlackoil< TypeTag >::getCellMapping ( ) const
inlineoverrideprotectedvirtual

Local-to-global cell index mapping.

Implements Opm::SerializableSim.

References Opm::SimulatorFullyImplicitBlackoil< TypeTag >::simulator_.

◆ getHeader()

template<class TypeTag >
std::array< std::string, 5 > Opm::SimulatorFullyImplicitBlackoil< TypeTag >::getHeader
overrideprotectedvirtual

Return the OPMRST header tuple: product name, module version, compile timestamp, deck case name, and parameter dump.

Implements Opm::SerializableSim.

References Opm::compileTimestamp(), Opm::moduleVersion(), and Opm::Parameters::printValues().

◆ grid()

◆ init()

template<class TypeTag >
void Opm::SimulatorFullyImplicitBlackoil< TypeTag >::init ( const SimulatorTimer timer)

One-shot setup performed before the first runStep.

Constructs the wall-clock timers and the AdaptiveTimeStepping instance (if adaptive stepping is enabled). For restart runs, the suggested next step is seeded from Simulator::timeStepSize().

Parameters
timerReport-step timer; only its current step is read here.

References Opm::SimulatorTimer::currentStepNum().

◆ isRestart()

template<class TypeTag >
bool Opm::SimulatorFullyImplicitBlackoil< TypeTag >::isRestart ( ) const
inlineprotected

◆ loadState()

template<class TypeTag >
void Opm::SimulatorFullyImplicitBlackoil< TypeTag >::loadState ( HDF5Serializer serializer,
const std::string &  groupName 
)
overrideprotectedvirtual

Load this simulator's data block from an OPMRST file via HDF5.

Implements Opm::SerializableSim.

◆ model()

template<class TypeTag >
const Model & Opm::SimulatorFullyImplicitBlackoil< TypeTag >::model ( ) const
inline

◆ registerParameters()

template<class TypeTag >
void Opm::SimulatorFullyImplicitBlackoil< TypeTag >::registerParameters
static

Register all parameters consumed by this class and its major collaborators.

Forwards to ModelParameters::registerParameters, SolverParameters::registerParameters, AdaptiveTimeStepping::registerParameters, Opm::detail::registerSimulatorParameters, and the TPSA Newton-method / linear-solver parameter sets. Called once during program startup.

References Opm::TpsaNewtonMethodParams< Scalar >::registerParameters(), Opm::TpsaLinearSolverParameters::registerParameters(), and Opm::detail::registerSimulatorParameters().

◆ run()

template<class TypeTag >
SimulatorReport Opm::SimulatorFullyImplicitBlackoil< TypeTag >::run ( SimulatorTimer timer)

Run the entire simulation to completion.

Loops over report steps, calling runStep on each one. Stops early if the schedule triggers an EXIT keyword.

Parameters
timerOuter report-step timer; advanced once per report step.
Returns
Aggregated simulation report (timing + per-step data).

References Opm::SimulatorTimer::currentStepNum(), and Opm::SimulatorTimer::done().

◆ runStep()

template<class TypeTag >
bool Opm::SimulatorFullyImplicitBlackoil< TypeTag >::runStep ( SimulatorTimer timer)

Advance the simulation by one report step.

Called by run once per report step. Performs:

  • early exit if the schedule requested EXIT;
  • OPMRST state load on the chosen restart step;
  • first-step init-state output;
  • lazy construction of the Solver;
  • construction and dispatch of the WCYCLE / TUNING / TUNINGDP tuning-update callback consumed by AdaptiveTimeStepping;
  • the actual solve, either via AdaptiveTimeStepping::step (substep loop) or a single Solver::step call;
  • end-of-step report output and OPMRST save.
Parameters
timerReport-step timer; advanced by one report step on success.
Returns
false to terminate the outer run loop (e.g. EXIT keyword); true to continue with the next report step.

References Opm::SimulatorTimer::currentStepLength(), Opm::SimulatorTimer::currentStepNum(), Opm::SimulatorTimer::initialStep(), Opm::details::outputReportStep(), Opm::SimulatorTimer::report(), Opm::SimulatorTimer::simulationTimeElapsed(), and Opm::to_string().

◆ saveState()

template<class TypeTag >
void Opm::SimulatorFullyImplicitBlackoil< TypeTag >::saveState ( HDF5Serializer serializer,
const std::string &  groupName 
) const
overrideprotectedvirtual

Save this simulator's data block to an OPMRST file via HDF5.

Implements Opm::SerializableSim.

◆ schedule()

template<class TypeTag >
const Schedule & Opm::SimulatorFullyImplicitBlackoil< TypeTag >::schedule ( ) const
inlineprotected

◆ serializeOp()

template<class TypeTag >
template<class Serializer >
void Opm::SimulatorFullyImplicitBlackoil< TypeTag >::serializeOp ( Serializer &  serializer)

Serialize the parts of this class needed for OPMRST round-tripping (the surrounding simulator state, the report, and the adaptive time stepper).

◆ updateTUNING()

template<class TypeTag >
void Opm::SimulatorFullyImplicitBlackoil< TypeTag >::updateTUNING ( const Tuning &  tuning)

Apply a TUNING keyword to the cached model parameters.

Overwrites convergence tolerances (TRGCNV / XXXCNV / TRGMBE / XXXMBE) and Newton iteration limits (NEWTMX / NEWTMN) on the ModelParameters copy held by this class. Items that are recognised by the parser but not honoured by this simulator are logged at warning level on rank 0.

Note
This method only updates the copy held here. The same TUNING data is forwarded separately to the model held by the solver and to AdaptiveTimeStepping by the tuning-update callback in runStep.

References Opm::detail::logTuning().

◆ updateTUNINGDP()

template<class TypeTag >
void Opm::SimulatorFullyImplicitBlackoil< TypeTag >::updateTUNINGDP ( const TuningDp &  tuning_dp)

Apply a TUNINGDP keyword to the cached model parameters.

Overwrites the maximum allowed pressure (TRGDDP), saturation (TRGDDS), and dissolved-gas / vaporised-oil ratio (TRGDDRS, TRGDDRV) changes per Newton iteration. TRGLCV / XXXLCV are accepted by the parser but logged as unsupported on rank 0.

◆ wellModel_() [1/2]

template<class TypeTag >
WellModel & Opm::SimulatorFullyImplicitBlackoil< TypeTag >::wellModel_ ( )
inlineprotected

◆ wellModel_() [2/2]

template<class TypeTag >
const WellModel & Opm::SimulatorFullyImplicitBlackoil< TypeTag >::wellModel_ ( ) const
inlineprotected

Member Data Documentation

◆ adaptiveTimeStepping_

template<class TypeTag >
std::unique_ptr<TimeStepper> Opm::SimulatorFullyImplicitBlackoil< TypeTag >::adaptiveTimeStepping_
protected

Set iff adaptive time stepping is enabled.

◆ convergence_output_

template<class TypeTag >
SimulatorConvergenceOutput Opm::SimulatorFullyImplicitBlackoil< TypeTag >::convergence_output_ {}
protected

Background thread for INFOSTEP / INFOITER files.

Referenced by Opm::SimulatorFullyImplicitBlackoil< TypeTag >::SimulatorFullyImplicitBlackoil().

◆ modelParam_

template<class TypeTag >
ModelParameters Opm::SimulatorFullyImplicitBlackoil< TypeTag >::modelParam_
protected

Cached model parameters; mutated by TUNING / TUNINGDP application.

◆ report_

template<class TypeTag >
SimulatorReport Opm::SimulatorFullyImplicitBlackoil< TypeTag >::report_
protected

Aggregated report across the entire simulation.

◆ serializer_

template<class TypeTag >
SimulatorSerializer Opm::SimulatorFullyImplicitBlackoil< TypeTag >::serializer_
protected

OPMRST save / load.

◆ simulator_

◆ solver_

template<class TypeTag >
std::unique_ptr<Solver> Opm::SimulatorFullyImplicitBlackoil< TypeTag >::solver_
protected

Built lazily on the first runStep call; reused thereafter.

Referenced by Opm::SimulatorFullyImplicitBlackoil< TypeTag >::model().

◆ solverParam_

template<class TypeTag >
SolverParameters Opm::SimulatorFullyImplicitBlackoil< TypeTag >::solverParam_
protected

Cached nonlinear-solver parameters.

◆ solverTimer_

template<class TypeTag >
std::unique_ptr<time::StopWatch> Opm::SimulatorFullyImplicitBlackoil< TypeTag >::solverTimer_
protected

Wall-clock for the current report step's solve.

◆ terminalOutput_

template<class TypeTag >
bool Opm::SimulatorFullyImplicitBlackoil< TypeTag >::terminalOutput_
protected

Emit high-level progress to std::cout (rank 0 only).

Referenced by Opm::SimulatorFullyImplicitBlackoil< TypeTag >::SimulatorFullyImplicitBlackoil().

◆ totalTimer_

template<class TypeTag >
std::unique_ptr<time::StopWatch> Opm::SimulatorFullyImplicitBlackoil< TypeTag >::totalTimer_
protected

Wall-clock for the entire simulation.


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