Opm::BlackoilModelEbos< TypeTag > Class Template Reference

A model implementation for three-phase black oil. More...

#include <BlackoilModelEbos.hpp>

Classes

class  WellModelMatrixAdapter
 Adapter to turn a matrix into a linear operator. More...
 

Public Types

typedef BlackoilState ReservoirState
 
typedef WellStateFullyImplicitBlackoil WellState
 
typedef BlackoilModelParameters ModelParameters
 
typedef double Scalar
 
typedef Dune::FieldVector< Scalar, numEq > VectorBlockType
 
typedef Dune::FieldMatrix< Scalar, numEq, numEq > MatrixBlockType
 
typedef Dune::BCRSMatrix< MatrixBlockType > Mat
 
typedef Dune::BlockVector< VectorBlockType > BVector
 
typedef ISTLSolver< MatrixBlockType, VectorBlockType, Indices::pressureSwitchIdx > ISTLSolverType
 
using RateConverterType = RateConverter::SurfaceToReservoirVoidage< BlackoilPropsAdFromDeck::FluidSystem, std::vector< int > >
 
typedef Opm::FIPData FIPDataType
 

Public Member Functions

typedef GET_PROP_TYPE (TypeTag, Simulator) Simulator
 
typedef GET_PROP_TYPE (TypeTag, Grid) Grid
 
typedef GET_PROP_TYPE (TypeTag, ElementContext) ElementContext
 
typedef GET_PROP_TYPE (TypeTag, SolutionVector) SolutionVector
 
typedef GET_PROP_TYPE (TypeTag, PrimaryVariables) PrimaryVariables
 
typedef GET_PROP_TYPE (TypeTag, FluidSystem) FluidSystem
 
typedef GET_PROP_TYPE (TypeTag, Indices) Indices
 
typedef GET_PROP_TYPE (TypeTag, MaterialLaw) MaterialLaw
 
typedef GET_PROP_TYPE (TypeTag, MaterialLawParams) MaterialLawParams
 
 BlackoilModelEbos (Simulator &ebosSimulator, const ModelParameters &param, BlackoilWellModel< TypeTag > &well_model, RateConverterType &rate_converter, const NewtonIterationBlackoilInterface &linsolver, const bool terminal_output)
 Construct the model. More...
 
bool isParallel () const
 
const EclipseState & eclState () const
 
void prepareStep (const SimulatorTimerInterface &timer, const ReservoirState &, const WellState &)
 Called once before each time step. More...
 
template<class NonlinearSolverType >
SimulatorReport nonlinearIteration (const int iteration, const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver, ReservoirState &, WellState &well_state)
 Called once per nonlinear iteration. More...
 
void printIf (int c, double x, double y, double eps, std::string type)
 
void afterStep (const SimulatorTimerInterface &timer, const ReservoirState &reservoir_state, WellState &well_state)
 Called once after each time step. More...
 
SimulatorReport assemble (const SimulatorTimerInterface &timer, const int iterationIdx, WellState &well_state)
 Assemble the residual and Jacobian of the nonlinear system. More...
 
template<class Dummy >
double relativeChange (const Dummy &, const Dummy &) const
 
int sizeNonLinear () const
 The size (number of unknowns) of the nonlinear system of equations.
 
int linearIterationsLastSolve () const
 Number of linear iterations used in last call to solveJacobianSystem().
 
void solveJacobianSystem (BVector &x) const
 Solve the Jacobian system Jx = r where J is the Jacobian and r is the residual. More...
 
void updateState (const BVector &dx)
 Apply an update to the primary variables, chopped if appropriate. More...
 
bool terminalOutputEnabled () const
 Return true if output to cout is wanted.
 
template<class CollectiveCommunication >
double convergenceReduction (const CollectiveCommunication &comm, const double pvSumLocal, std::vector< Scalar > &R_sum, std::vector< Scalar > &maxCoeff, std::vector< Scalar > &B_avg)
 
bool getConvergence (const SimulatorTimerInterface &timer, const int iteration, std::vector< double > &residual_norms)
 Compute convergence based on total mass balance (tol_mb) and maximum residual mass balance (tol_cnv). More...
 
int numPhases () const
 The number of active fluid phases in the model.
 
int numComponents () const
 
template<class T >
std::vector< std::vector< double > > computeFluidInPlace (const T &, const std::vector< int > &fipnum) const
 Wrapper required due to not following generic API.
 
std::vector< std::vector< double > > computeFluidInPlace (const std::vector< int > &fipnum) const
 
SimulationDataContainer getSimulatorData (const SimulationDataContainer &localState) const
 
const FIPDataTypegetFIPData () const
 
const Simulator & ebosSimulator () const
 
const SimulatorReport & failureReport () const
 return the statistics if the nonlinearIteration() method failed
 
BlackoilWellModel< TypeTag > & wellModel ()
 return the StandardWells object
 
const BlackoilWellModel< TypeTag > & wellModel () const
 
int numWells () const
 
bool localWellsActive () const
 return true if wells are available on this process
 
int flowPhaseToEbosCompIdx (const int phaseIdx) const
 
int flowPhaseToEbosPhaseIdx (const int phaseIdx) const
 
void beginReportStep ()
 
void endReportStep ()
 

Public Attributes

bool isBeginReportStep_
 
std::vector< bool > wasSwitched_
 

Static Public Attributes

static const int numEq = Indices::numEq
 
static const int contiSolventEqIdx = Indices::contiSolventEqIdx
 
static const int contiPolymerEqIdx = Indices::contiPolymerEqIdx
 
static const int solventSaturationIdx = Indices::solventSaturationIdx
 
static const int polymerConcentrationIdx = Indices::polymerConcentrationIdx
 

Protected Member Functions

const ISTLSolverTypeistlSolver () const
 

Protected Attributes

Simulator & ebosSimulator_
 
const Grid & grid_
 
const ISTLSolverTypeistlSolver_
 
const PhaseUsage phaseUsage_
 
VFPProperties vfp_properties_
 
const std::vector< bool > active_
 
const std::vector< int > cells_
 
const bool has_disgas_
 
const bool has_vapoil_
 
const bool has_solvent_
 
const bool has_polymer_
 
ModelParameters param_
 
SimulatorReport failureReport_
 
BlackoilWellModel< TypeTag > & well_model_
 
bool terminal_output_
 Whether we print something to std::cout.
 
long int global_nc_
 The number of cells of the global grid.
 
RateConverterTyperate_converter_
 
std::vector< std::vector< double > > residual_norms_history_
 
double current_relaxation_
 
BVector dx_old_
 
FIPDataType fip_
 

Detailed Description

template<class TypeTag>
class Opm::BlackoilModelEbos< TypeTag >

A model implementation for three-phase black oil.

The simulator is capable of handling three-phase problems where gas can be dissolved in oil and vice versa. It uses an industry-standard TPFA discretization with per-phase upwind weighting of mobilities.

Constructor & Destructor Documentation

◆ BlackoilModelEbos()

template<class TypeTag >
Opm::BlackoilModelEbos< TypeTag >::BlackoilModelEbos ( Simulator &  ebosSimulator,
const ModelParameters param,
BlackoilWellModel< TypeTag > &  well_model,
RateConverterType rate_converter,
const NewtonIterationBlackoilInterface linsolver,
const bool  terminal_output 
)
inline

Construct the model.

It will retain references to the arguments of this functions, and they are expected to remain in scope for the lifetime of the solver.

Parameters
[in]paramparameters
[in]gridgrid data structure
[in]wellswell structure
[in]vfp_propertiesVertical flow performance tables
[in]linsolverlinear solver
[in]eclStateeclipse state
[in]terminal_outputrequest output to cout/cerr

Member Function Documentation

◆ afterStep()

template<class TypeTag >
void Opm::BlackoilModelEbos< TypeTag >::afterStep ( const SimulatorTimerInterface timer,
const ReservoirState &  reservoir_state,
WellState well_state 
)
inline

Called once after each time step.

In this class, this function does nothing.

Parameters
[in]timersimulation timer
[in,out]reservoir_statereservoir state variables
[in,out]well_statewell state variables

◆ assemble()

template<class TypeTag >
SimulatorReport Opm::BlackoilModelEbos< TypeTag >::assemble ( const SimulatorTimerInterface timer,
const int  iterationIdx,
WellState well_state 
)
inline

Assemble the residual and Jacobian of the nonlinear system.

Parameters
[in]reservoir_statereservoir state variables
[in,out]well_statewell state variables
[in]initial_assemblypass true if this is the first call to assemble() in this timestep

◆ getConvergence()

template<class TypeTag >
bool Opm::BlackoilModelEbos< TypeTag >::getConvergence ( const SimulatorTimerInterface timer,
const int  iteration,
std::vector< double > &  residual_norms 
)
inline

Compute convergence based on total mass balance (tol_mb) and maximum residual mass balance (tol_cnv).

Parameters
[in]timersimulation timer
[in]dttimestep length
[in]iterationcurrent iteration number

◆ nonlinearIteration()

template<class TypeTag >
template<class NonlinearSolverType >
SimulatorReport Opm::BlackoilModelEbos< TypeTag >::nonlinearIteration ( const int  iteration,
const SimulatorTimerInterface timer,
NonlinearSolverType &  nonlinear_solver,
ReservoirState &  ,
WellState well_state 
)
inline

Called once per nonlinear iteration.

This model will perform a Newton-Raphson update, changing reservoir_state and well_state. It will also use the nonlinear_solver to do relaxation of updates if necessary.

Parameters
[in]iterationshould be 0 for the first call of a new timestep
[in]timersimulation timer
[in]nonlinear_solvernonlinear solver used (for oscillation/relaxation control)
[in,out]reservoir_statereservoir state variables
[in,out]well_statewell state variables

◆ prepareStep()

template<class TypeTag >
void Opm::BlackoilModelEbos< TypeTag >::prepareStep ( const SimulatorTimerInterface timer,
const ReservoirState &  ,
const WellState  
)
inline

Called once before each time step.

Parameters
[in]timersimulation timer
[in,out]reservoir_statereservoir state variables
[in,out]well_statewell state variables

◆ solveJacobianSystem()

template<class TypeTag >
void Opm::BlackoilModelEbos< TypeTag >::solveJacobianSystem ( BVector &  x) const
inline

Solve the Jacobian system Jx = r where J is the Jacobian and r is the residual.

◆ updateState()

template<class TypeTag >
void Opm::BlackoilModelEbos< TypeTag >::updateState ( const BVector &  dx)
inline

Apply an update to the primary variables, chopped if appropriate.

Parameters
[in]dxupdates to apply to primary variables
[in,out]reservoir_statereservoir state variables
[in,out]well_statewell state variables

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