Opm::ReservoirCouplingTimeStepper< Scalar > Class Template Reference

Manages time stepping coordination between master and slave processes. More...

#include <ReservoirCouplingTimeStepper.hpp>

Inheritance diagram for Opm::ReservoirCouplingTimeStepper< Scalar >:
Inheritance graph

Public Types

using MessageTag = ReservoirCoupling::MessageTag
 
using Potentials = ReservoirCoupling::Potentials< Scalar >
 
using Seconds = ReservoirCoupling::Seconds
 

Public Member Functions

 ReservoirCouplingTimeStepper (ReservoirCouplingMaster< Scalar > &master)
 Construct a time stepper for coordinating master-slave time stepping. More...
 
const Parallel::Communicationcomm () const
 Get the MPI communicator for master-to-master communication. More...
 
MPI_Comm getSlaveComm (int index) const
 Get the MPI communicator for a specific slave process. More...
 
std::size_t numSlaves () const
 Get the total number of active slave processes. More...
 
ReservoirCoupling::Loggerlogger () const
 Get the logger for reservoir coupling operations. More...
 
double maybeChopSubStep (double suggested_timestep_original, double elapsed_time) const
 Potentially adjust time step to align with slave report boundaries. More...
 
void receiveNextReportDateFromSlaves ()
 Receive next report dates from all active slave processes. More...
 
void resizeNextReportDates (int size)
 Resize the internal storage for slave next report times. More...
 
const Schedule & schedule () const
 Get the simulation schedule. More...
 
bool slaveIsActivated (int index) const
 Check if a specific slave process has been activated. More...
 
const std::string & slaveName (int index) const
 Get the name of a specific slave process. More...
 
double slaveStartDate (int index) const
 Get the simulation start date for a specific slave. More...
 
double slaveActivationDate (int index) const
 Get the activation date for a specific slave. More...
 
void sendNextTimeStepToSlaves (double timestep)
 Send the next time step size to all active slave processes. More...
 
void setSlaveNextReportTimeOffset (int index, double offset)
 Set the next report time offset for a specific slave. More...
 

Detailed Description

template<class Scalar>
class Opm::ReservoirCouplingTimeStepper< Scalar >

Manages time stepping coordination between master and slave processes.

This class handles the synchronization of time steps and report dates between the master and slave processes in reservoir coupling simulations. It is responsible for:

  • Coordinating time step sizes across master and slave processes
  • Receiving next report dates from slave processes
  • Sending time step information to slaves
  • Adjusting time steps to align with slave report boundaries
  • Managing slave activation dates and simulation start dates

The class ensures that the master and all slaves advance through simulation time in a coordinated manner, respecting individual slave report schedules while maintaining overall simulation consistency.

Template Parameters
ScalarFloating-point type for time and rate values (typically double or float)
Note
This class holds a reference to the parent ReservoirCouplingMaster object and should only be used within the scope of that object's lifetime
See also
ReservoirCouplingMaster

Member Typedef Documentation

◆ MessageTag

template<class Scalar >
using Opm::ReservoirCouplingTimeStepper< Scalar >::MessageTag = ReservoirCoupling::MessageTag

◆ Potentials

template<class Scalar >
using Opm::ReservoirCouplingTimeStepper< Scalar >::Potentials = ReservoirCoupling::Potentials<Scalar>

◆ Seconds

template<class Scalar >
using Opm::ReservoirCouplingTimeStepper< Scalar >::Seconds = ReservoirCoupling::Seconds

Constructor & Destructor Documentation

◆ ReservoirCouplingTimeStepper()

template<class Scalar >
Opm::ReservoirCouplingTimeStepper< Scalar >::ReservoirCouplingTimeStepper ( ReservoirCouplingMaster< Scalar > &  master)

Construct a time stepper for coordinating master-slave time stepping.

Parameters
masterReference to the parent ReservoirCouplingMaster object

Member Function Documentation

◆ comm()

template<class Scalar >
const Parallel::Communication & Opm::ReservoirCouplingTimeStepper< Scalar >::comm ( ) const
inline

Get the MPI communicator for master-to-master communication.

Returns
Reference to the parallel communication object

◆ getSlaveComm()

template<class Scalar >
MPI_Comm Opm::ReservoirCouplingTimeStepper< Scalar >::getSlaveComm ( int  index) const
inline

Get the MPI communicator for a specific slave process.

Parameters
indexIndex of the slave process
Returns
MPI communicator handle for communication with the specified slave

◆ logger()

template<class Scalar >
ReservoirCoupling::Logger & Opm::ReservoirCouplingTimeStepper< Scalar >::logger ( ) const
inline

Get the logger for reservoir coupling operations.

Returns
Reference to the logger object for this coupling session

◆ maybeChopSubStep()

template<class Scalar >
double Opm::ReservoirCouplingTimeStepper< Scalar >::maybeChopSubStep ( double  suggested_timestep_original,
double  elapsed_time 
) const

Potentially adjust time step to align with slave report boundaries.

This method checks if the suggested time step would cause the master simulation to advance past any slave's next report time. If so, it "chops" the time step to ensure the master stops at the slave's report boundary, allowing for proper synchronization between master and slave processes.

Parameters
suggested_timestep_originalThe original suggested time step size (in seconds)
elapsed_timeElapsed time from the beginning of the simulation (in seconds)
Returns
Adjusted time step that respects slave report boundaries
Note
This is crucial for maintaining time step synchronization in coupled simulations

◆ numSlaves()

template<class Scalar >
std::size_t Opm::ReservoirCouplingTimeStepper< Scalar >::numSlaves ( ) const
inline

Get the total number of active slave processes.

Returns
Number of slaves that have been started

◆ receiveNextReportDateFromSlaves()

template<class Scalar >
void Opm::ReservoirCouplingTimeStepper< Scalar >::receiveNextReportDateFromSlaves ( )

Receive next report dates from all active slave processes.

This method receives the next report time from each slave process via MPI communication. The times are stored as offsets from the simulation start time and used to coordinate time stepping between master and slaves.

Note
This is a blocking operation that waits for all slaves to send their data
Must be called after slaves have determined their next report times

◆ resizeNextReportDates()

template<class Scalar >
void Opm::ReservoirCouplingTimeStepper< Scalar >::resizeNextReportDates ( int  size)
inline

Resize the internal storage for slave next report times.

Parameters
sizeNumber of slave processes to allocate storage for

◆ schedule()

template<class Scalar >
const Schedule & Opm::ReservoirCouplingTimeStepper< Scalar >::schedule ( ) const
inline

Get the simulation schedule.

Returns
Reference to the Schedule object containing timing and control information

◆ sendNextTimeStepToSlaves()

template<class Scalar >
void Opm::ReservoirCouplingTimeStepper< Scalar >::sendNextTimeStepToSlaves ( double  timestep)

Send the next time step size to all active slave processes.

This method broadcasts the time step size that slaves should use for their next simulation step via MPI communication. This ensures all processes advance through simulation time in a coordinated manner.

Parameters
timestepTime step size to send to slaves (in seconds)
Note
This is a blocking operation that waits for all slaves to receive the data

◆ setSlaveNextReportTimeOffset()

template<class Scalar >
void Opm::ReservoirCouplingTimeStepper< Scalar >::setSlaveNextReportTimeOffset ( int  index,
double  offset 
)
inline

Set the next report time offset for a specific slave.

Parameters
indexIndex of the slave process
offsetTime offset from simulation start to the slave's next report time (in seconds)

◆ slaveActivationDate()

template<class Scalar >
double Opm::ReservoirCouplingTimeStepper< Scalar >::slaveActivationDate ( int  index) const
inline

Get the activation date for a specific slave.

Parameters
indexIndex of the slave process
Returns
Activation date as time offset (in seconds)

◆ slaveIsActivated()

template<class Scalar >
bool Opm::ReservoirCouplingTimeStepper< Scalar >::slaveIsActivated ( int  index) const
inline

Check if a specific slave process has been activated.

Parameters
indexIndex of the slave process
Returns
true if the slave is activated, false otherwise

◆ slaveName()

template<class Scalar >
const std::string & Opm::ReservoirCouplingTimeStepper< Scalar >::slaveName ( int  index) const
inline

Get the name of a specific slave process.

Parameters
indexIndex of the slave process
Returns
Reference to the name string for the specified slave

◆ slaveStartDate()

template<class Scalar >
double Opm::ReservoirCouplingTimeStepper< Scalar >::slaveStartDate ( int  index) const
inline

Get the simulation start date for a specific slave.

Parameters
indexIndex of the slave process
Returns
Simulation start date as time offset (in seconds)

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