My Project
Opm::BlackoilModelEbos< TypeTag > Class Template Reference

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

#include <BlackoilModelEbos.hpp>

Classes

struct  StepReport
 

Public Types

typedef BlackoilModelParametersEbos< TypeTag > ModelParameters
 
using Simulator = GetPropType< TypeTag, Properties::Simulator >
 
using Grid = GetPropType< TypeTag, Properties::Grid >
 
using ElementContext = GetPropType< TypeTag, Properties::ElementContext >
 
using SparseMatrixAdapter = GetPropType< TypeTag, Properties::SparseMatrixAdapter >
 
using SolutionVector = GetPropType< TypeTag, Properties::SolutionVector >
 
using PrimaryVariables = GetPropType< TypeTag, Properties::PrimaryVariables >
 
using FluidSystem = GetPropType< TypeTag, Properties::FluidSystem >
 
using Indices = GetPropType< TypeTag, Properties::Indices >
 
using MaterialLaw = GetPropType< TypeTag, Properties::MaterialLaw >
 
using MaterialLawParams = GetPropType< TypeTag, Properties::MaterialLawParams >
 
typedef double Scalar
 
typedef Dune::FieldVector< Scalar, numEq > VectorBlockType
 
typedef SparseMatrixAdapter::MatrixBlock MatrixBlockType
 
typedef SparseMatrixAdapter::IstlMatrix Mat
 
typedef Dune::BlockVector< VectorBlockType > BVector
 
typedef ISTLSolverEbos< TypeTag > ISTLSolverType
 

Public Member Functions

 BlackoilModelEbos (Simulator &ebosSimulator, const ModelParameters &param, BlackoilWellModel< TypeTag > &well_model, const bool terminal_output)
 Construct the model. More...
 
bool isParallel () const
 
const EclipseState & eclState () const
 
SimulatorReportSingle prepareStep (const SimulatorTimerInterface &timer)
 Called once before each time step. More...
 
template<class NonlinearSolverType >
SimulatorReportSingle nonlinearIteration (const int iteration, const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
 Called once per nonlinear iteration. More...
 
void printIf (int c, double x, double y, double eps, std::string type)
 
SimulatorReportSingle afterStep (const SimulatorTimerInterface &)
 Called once after each time step. More...
 
SimulatorReportSingle assembleReservoir (const SimulatorTimerInterface &, const int iterationIdx)
 Assemble the residual and Jacobian of the nonlinear system. More...
 
double relativeChange () const
 
int linearIterationsLastSolve () const
 Number of linear iterations used in last call to solveJacobianSystem().
 
void solveJacobianSystem (BVector &x)
 Solve the Jacobian system Jx = r where J is the Jacobian and r is the residual.
 
void updateSolution (const BVector &dx)
 Apply an update to the primary variables.
 
bool terminalOutputEnabled () const
 Return true if output to cout is wanted.
 
template<class CollectiveCommunication >
std::tuple< double, double > convergenceReduction (const CollectiveCommunication &comm, const double pvSumLocal, const double numAquiferPvSumLocal, std::vector< Scalar > &R_sum, std::vector< Scalar > &maxCoeff, std::vector< Scalar > &B_avg)
 
std::tuple< double, double > localConvergenceData (std::vector< Scalar > &R_sum, std::vector< Scalar > &maxCoeff, std::vector< Scalar > &B_avg)
 Get reservoir quantities on this process needed for convergence calculations. More...
 
double computeCnvErrorPv (const std::vector< Scalar > &B_avg, double dt)
 Compute the total pore volume of cells violating CNV that are not part of a numerical aquifer.
 
ConvergenceReport getReservoirConvergence (const double dt, const int iteration, std::vector< Scalar > &B_avg, std::vector< Scalar > &residual_norms)
 
ConvergenceReport 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.
 
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 > &) const
 Should not be called.
 
const Simulator & ebosSimulator () const
 
Simulator & ebosSimulator ()
 
const SimulatorReportSinglefailureReport () const
 return the statistics if the nonlinearIteration() method failed
 
const std::vector< StepReport > & stepReports () const
 
BlackoilWellModel< TypeTag > & wellModel ()
 return the StandardWells object
 
const BlackoilWellModel< TypeTag > & wellModel () const
 
void beginReportStep ()
 
void endReportStep ()
 

Public Attributes

std::vector< bool > wasSwitched_
 

Static Public Attributes

static const int numEq = Indices::numEq
 
static const int contiSolventEqIdx = Indices::contiSolventEqIdx
 
static const int contiZfracEqIdx = Indices::contiZfracEqIdx
 
static const int contiPolymerEqIdx = Indices::contiPolymerEqIdx
 
static const int contiEnergyEqIdx = Indices::contiEnergyEqIdx
 
static const int contiPolymerMWEqIdx = Indices::contiPolymerMWEqIdx
 
static const int contiFoamEqIdx = Indices::contiFoamEqIdx
 
static const int contiBrineEqIdx = Indices::contiBrineEqIdx
 
static const int contiMicrobialEqIdx = Indices::contiMicrobialEqIdx
 
static const int contiOxygenEqIdx = Indices::contiOxygenEqIdx
 
static const int contiUreaEqIdx = Indices::contiUreaEqIdx
 
static const int contiBiofilmEqIdx = Indices::contiBiofilmEqIdx
 
static const int contiCalciteEqIdx = Indices::contiCalciteEqIdx
 
static const int solventSaturationIdx = Indices::solventSaturationIdx
 
static const int zFractionIdx = Indices::zFractionIdx
 
static const int polymerConcentrationIdx = Indices::polymerConcentrationIdx
 
static const int polymerMoleWeightIdx = Indices::polymerMoleWeightIdx
 
static const int temperatureIdx = Indices::temperatureIdx
 
static const int foamConcentrationIdx = Indices::foamConcentrationIdx
 
static const int saltConcentrationIdx = Indices::saltConcentrationIdx
 
static const int microbialConcentrationIdx = Indices::microbialConcentrationIdx
 
static const int oxygenConcentrationIdx = Indices::oxygenConcentrationIdx
 
static const int ureaConcentrationIdx = Indices::ureaConcentrationIdx
 
static const int biofilmConcentrationIdx = Indices::biofilmConcentrationIdx
 
static const int calciteConcentrationIdx = Indices::calciteConcentrationIdx
 

Protected Attributes

Simulator & ebosSimulator_
 
const Grid & grid_
 
const PhaseUsage phaseUsage_
 
ModelParameters param_
 
SimulatorReportSingle 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.
 
std::vector< std::vector< double > > residual_norms_history_
 
double current_relaxation_
 
BVector dx_old_
 
std::vector< StepReportconvergence_reports_
 

Static Protected Attributes

static constexpr bool has_solvent_ = getPropValue<TypeTag, Properties::EnableSolvent>()
 
static constexpr bool has_extbo_ = getPropValue<TypeTag, Properties::EnableExtbo>()
 
static constexpr bool has_polymer_ = getPropValue<TypeTag, Properties::EnablePolymer>()
 
static constexpr bool has_polymermw_ = getPropValue<TypeTag, Properties::EnablePolymerMW>()
 
static constexpr bool has_energy_ = getPropValue<TypeTag, Properties::EnableEnergy>()
 
static constexpr bool has_foam_ = getPropValue<TypeTag, Properties::EnableFoam>()
 
static constexpr bool has_brine_ = getPropValue<TypeTag, Properties::EnableBrine>()
 
static constexpr bool has_micp_ = getPropValue<TypeTag, Properties::EnableMICP>()
 

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,
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 >
SimulatorReportSingle Opm::BlackoilModelEbos< TypeTag >::afterStep ( const SimulatorTimerInterface )
inline

Called once after each time step.

In this class, this function does nothing.

Parameters
[in]timersimulation timer

◆ assembleReservoir()

template<class TypeTag >
SimulatorReportSingle Opm::BlackoilModelEbos< TypeTag >::assembleReservoir ( const SimulatorTimerInterface ,
const int  iterationIdx 
)
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 >
ConvergenceReport 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]iterationcurrent iteration number
[out]residual_normsCNV residuals by phase

◆ localConvergenceData()

template<class TypeTag >
std::tuple<double,double> Opm::BlackoilModelEbos< TypeTag >::localConvergenceData ( std::vector< Scalar > &  R_sum,
std::vector< Scalar > &  maxCoeff,
std::vector< Scalar > &  B_avg 
)
inline

Get reservoir quantities on this process needed for convergence calculations.

Returns
A pair of the local pore volume of interior cells and the pore volumes of the cells associated with a numerical aquifer.

◆ nonlinearIteration()

template<class TypeTag >
template<class NonlinearSolverType >
SimulatorReportSingle Opm::BlackoilModelEbos< TypeTag >::nonlinearIteration ( const int  iteration,
const SimulatorTimerInterface timer,
NonlinearSolverType &  nonlinear_solver 
)
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 >
SimulatorReportSingle Opm::BlackoilModelEbos< TypeTag >::prepareStep ( const SimulatorTimerInterface timer)
inline

Called once before each time step.

Parameters
[in]timersimulation timer

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