opm-simulators
Opm::NonlinearSystemBlackOilReservoirTPSA< TypeTag > Class Template Reference

Nonlinear system for coupling Flow simulations with TPSA geomechanics. More...

#include <NonlinearSystemBlackOilReservoirTPSA.hpp>

Inheritance diagram for Opm::NonlinearSystemBlackOilReservoirTPSA< TypeTag >:
Opm::NonlinearSystemBlackOilReservoir< TypeTag > Opm::NonlinearSystem< TypeTag >

Public Types

using ModelParameters = typename ParentType::ModelParameters
 
- Public Types inherited from Opm::NonlinearSystemBlackOilReservoir< TypeTag >
enum  DebugFlags { STRICT = 0, RELAXED = 1, TUNINGDP = 2 }
 
using ParentType = NonlinearSystem< TypeTag >
 
using Simulator = typename ParentType::Simulator
 
using Grid = typename ParentType::Grid
 
using ElementContext = GetPropType< TypeTag, Properties::ElementContext >
 
using IntensiveQuantities = GetPropType< TypeTag, Properties::IntensiveQuantities >
 
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 >
 
using Scalar = GetPropType< TypeTag, Properties::Scalar >
 
using GlobalEqVector = typename ParentType::GlobalEqVector
 
using ModelParameters = BlackoilModelParameters< Scalar >
 
using VectorBlockType = Dune::FieldVector< Scalar, numEq >
 
using MatrixBlockType = typename SparseMatrixAdapter::MatrixBlock
 
using Mat = typename SparseMatrixAdapter::IstlMatrix
 
using BVector = Dune::BlockVector< VectorBlockType >
 
using ComponentName = ::Opm::ComponentName< FluidSystem, Indices >
 
- Public Types inherited from Opm::NonlinearSystem< TypeTag >
using Simulator = GetPropType< TypeTag, Properties::Simulator >
 
using Grid = GetPropType< TypeTag, Properties::Grid >
 
using FluidSystem = GetPropType< TypeTag, Properties::FluidSystem >
 
using Indices = GetPropType< TypeTag, Properties::Indices >
 
using Scalar = GetPropType< TypeTag, Properties::Scalar >
 
using GlobalEqVector = GetPropType< TypeTag, Properties::GlobalEqVector >
 
using ModelParameters = BlackoilModelParameters< Scalar >
 
using WellModel = GetPropType< TypeTag, Properties::WellModel >
 
using ComponentName = ::Opm::ComponentName< FluidSystem, Indices >
 

Public Member Functions

 NonlinearSystemBlackOilReservoirTPSA (Simulator &simulator, const ModelParameters &param, BlackoilWellModel< TypeTag > &well_model, const bool terminal_output)
 Constructor. More...
 
template<class NonlinearSolverType >
SimulatorReportSingle nonlinearIteration (const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
 Perform a nonlinear iteration updating Flow and TPSA geomechanics. More...
 
template<class NonlinearSolverType >
SimulatorReportSingle nonlinearIterationFixedStressTPSA (const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
 Perform a nonlinear iteration updating Flow and TPSA geomechanics in a fixed-stress, iterative loop. More...
 
template<class NonlinearSolverType >
SimulatorReportSingle nonlinearIterationLaggedTPSA (const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
 Perform a nonlinear iteration updating Flow and TPSA geomechanics in a lagged scheme. More...
 
bool solveTpsaEquations ()
 Solve TPSA geomechanics equations. More...
 
- Public Member Functions inherited from Opm::NonlinearSystemBlackOilReservoir< TypeTag >
 NonlinearSystemBlackOilReservoir (Simulator &simulator, const ModelParameters &param, BlackoilWellModel< TypeTag > &well_model, const bool terminal_output)
 Construct the model. More...
 
const EclipseState & eclState () const
 
SimulatorReportSingle prepareStep (const SimulatorTimerInterface &timer)
 Called once before each time step. More...
 
void initialLinearization (SimulatorReportSingle &report, const int minIter, const int maxIter, const SimulatorTimerInterface &timer) override
 
template<class NonlinearSolverType >
SimulatorReportSingle nonlinearIteration (const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
 Called once per nonlinear iteration. More...
 
template<class NonlinearSolverType >
SimulatorReportSingle nonlinearIterationNewton (const SimulatorTimerInterface &timer, NonlinearSolverType &nonlinear_solver)
 
Scalar relativeChange () const
 
int linearIterationsLastSolve () const
 Number of linear iterations used in last call to solveJacobianSystem().
 
double & linearSolveSetupTime ()
 
void solveJacobianSystem (BVector &x)
 Solve the Jacobian system Jx = r where J is the Jacobian and r is the residual. More...
 
bool shouldStoreSolutionUpdate () const override
 Get solution update vector as a PrimaryVariable.
 
void prepareSolutionUpdate () override
 
void storeSolutionUpdate (const GlobalEqVector &dx) override
 
MaxSolutionUpdateData getMaxSolutionUpdate (const std::vector< unsigned > &ixCells)
 
std::tuple< Scalar, Scalar > convergenceReduction (Parallel::Communication comm, const Scalar pvSumLocal, const Scalar numAquiferPvSumLocal, std::vector< Scalar > &R_sum, std::vector< Scalar > &maxCoeff, std::vector< Scalar > &B_avg)
 
std::pair< Scalar, Scalar > localConvergenceData (std::vector< Scalar > &R_sum, std::vector< Scalar > &maxCoeff, std::vector< Scalar > &B_avg, std::vector< int > &maxCoeffCell)
 Get reservoir quantities on this process needed for convergence calculations. More...
 
CnvPvSplitData characteriseCnvPvSplit (const std::vector< Scalar > &B_avg, const double dt)
 Compute pore-volume/cell count split among "converged", "relaxed converged", "unconverged" cells based on CNV point measures. More...
 
void convergencePerCell (const std::vector< Scalar > &B_avg, const double dt, const double tol_cnv, const double tol_cnv_energy)
 Compute the number of Newtons required by each cell in order to satisfy the solution change convergence criteria at the last time step. More...
 
ConvergenceReport getReservoirConvergence (const double reportTime, const double dt, const int maxIter, std::vector< Scalar > &B_avg, std::vector< Scalar > &residual_norms)
 
ConvergenceReport getConvergence (const SimulatorTimerInterface &timer, const int maxIter, std::vector< Scalar > &residual_norms)
 Compute convergence based on total mass balance (tol_mb) and maximum residual mass balance (tol_cnv). More...
 
template<class T >
std::vector< std::vector< Scalar > > computeFluidInPlace (const T &, const std::vector< int > &fipnum) const
 Wrapper required due to not following generic API.
 
std::vector< std::vector< Scalar > > computeFluidInPlace (const std::vector< int > &) const
 Should not be called.
 
const SimulatorReportlocalAccumulatedReports () const
 return the statistics of local solves accumulated for this rank
 
const std::vector< SimulatorReport > & domainAccumulatedReports () const
 return the statistics of local solves accumulated for each domain on this rank
 
void writeNonlinearIterationsPerCell (const std::filesystem::path &odir) const
 Write the number of nonlinear iterations per cell to a file in ResInsight compatible format.
 
void popLastConvergenceReport ()
 Remove the last convergence report entry and residual norms history entry.
 
void writePartitions (const std::filesystem::path &odir) const
 
template<class FluidState , class Residual >
void getMaxCoeff (const unsigned cell_idx, const IntensiveQuantities &intQuants, const FluidState &fs, const Residual &modelResid, const Scalar pvValue, std::vector< Scalar > &B_avg, std::vector< Scalar > &R_sum, std::vector< Scalar > &maxCoeff, std::vector< int > &maxCoeffCell)
 
bool hasNlddSolver () const
 Returns true if an NLDD solver exists.
 
- Public Member Functions inherited from Opm::NonlinearSystem< TypeTag >
bool isParallel () const
 
const Simulator & simulator () const
 
Simulator & simulator ()
 
bool terminalOutputEnabled () const
 
int numPhases () const
 
const SimulatorReportSinglefailureReport () const
 
const std::vector< StepReport > & stepReports () const
 
const ComponentNamecompNames () const
 
const ModelParametersparam () const
 
WellModel & wellModel ()
 
const WellModel & wellModel () const
 
void beginReportStep ()
 
void endReportStep ()
 
SimulatorReportSingle assembleReservoir (const SimulatorTimerInterface &timer)
 
void updateTUNING (const Tuning &tuning)
 
void updateTUNINGDP (const TuningDp &tuning_dp)
 
void updateSolution (const GlobalEqVector &dx)
 
template<class LogFailure >
void addReservoirConvergenceMetrics (ConvergenceReport &report, const int componentIdx, const std::string_view componentName, const std::span< const Scalar > residuals, const std::span< const ConvergenceReport::ReservoirFailure::Type > types, const std::span< const Scalar > tolerances, const Scalar maxResidualAllowed, LogFailure &&logFailure) const
 

Additional Inherited Members

- Static Public Attributes inherited from Opm::NonlinearSystemBlackOilReservoir< TypeTag >
static constexpr bool enableSaltPrecipitation = getPropValue<TypeTag, Properties::EnableSaltPrecipitation>()
 
static constexpr int numEq = Indices::numEq
 
static constexpr int contiSolventEqIdx = Indices::contiSolventEqIdx
 
static constexpr int contiZfracEqIdx = Indices::contiZfracEqIdx
 
static constexpr int contiPolymerEqIdx = Indices::contiPolymerEqIdx
 
static constexpr int contiEnergyEqIdx = Indices::contiEnergyEqIdx
 
static constexpr int contiPolymerMWEqIdx = Indices::contiPolymerMWEqIdx
 
static constexpr int contiFoamEqIdx = Indices::contiFoamEqIdx
 
static constexpr int contiBrineEqIdx = Indices::contiBrineEqIdx
 
static constexpr int contiMicrobialEqIdx = Indices::contiMicrobialEqIdx
 
static constexpr int contiOxygenEqIdx = Indices::contiOxygenEqIdx
 
static constexpr int contiUreaEqIdx = Indices::contiUreaEqIdx
 
static constexpr int contiBiofilmEqIdx = Indices::contiBiofilmEqIdx
 
static constexpr int contiCalciteEqIdx = Indices::contiCalciteEqIdx
 
static constexpr unsigned solventSaturationIdx = Indices::solventSaturationIdx
 
static constexpr unsigned zFractionIdx = Indices::zFractionIdx
 
static constexpr unsigned polymerConcentrationIdx = Indices::polymerConcentrationIdx
 
static constexpr unsigned polymerMoleWeightIdx = Indices::polymerMoleWeightIdx
 
static constexpr unsigned temperatureIdx = Indices::temperatureIdx
 
static constexpr unsigned foamConcentrationIdx = Indices::foamConcentrationIdx
 
static constexpr unsigned saltConcentrationIdx = Indices::saltConcentrationIdx
 
static constexpr unsigned microbialConcentrationIdx = Indices::microbialConcentrationIdx
 
static constexpr unsigned oxygenConcentrationIdx = Indices::oxygenConcentrationIdx
 
static constexpr unsigned ureaConcentrationIdx = Indices::ureaConcentrationIdx
 
static constexpr unsigned biofilmVolumeFractionIdx = Indices::biofilmVolumeFractionIdx
 
static constexpr unsigned calciteVolumeFractionIdx = Indices::calciteVolumeFractionIdx
 
- Protected Member Functions inherited from Opm::NonlinearSystem< TypeTag >
 NonlinearSystem (Simulator &simulator, const ModelParameters &param, WellModel &wellModel, const bool terminal_output)
 
SimulatorReportSingle prepareStep (const SimulatorTimerInterface &timer)
 
template<class WellModelType >
SimulatorReportSingle assembleReservoir (WellModelType &wellModel)
 
template<class ModelParametersType >
void applyTUNING (ModelParametersType &param, const Tuning &tuning)
 
template<class ModelParametersType >
void applyTUNINGDP (ModelParametersType &param, const TuningDp &tuning_dp)
 
template<class ValueType >
std::tuple< ValueType, ValueType > convergenceReduction (Parallel::Communication comm, const ValueType primaryVolumeLocal, const ValueType secondaryVolumeLocal, std::vector< ValueType > &sumValues, std::vector< ValueType > &maxValues, std::vector< ValueType > &averagedValues)
 
void popLastStepReport ()
 
- Protected Attributes inherited from Opm::NonlinearSystemBlackOilReservoir< TypeTag >
long int global_nc_
 The number of cells of the global grid.
 
SolutionVector solUpd_
 
std::unique_ptr< NonlinearSystemNldd< TypeTag > > nlddSolver_
 Non-linear DD solver.
 
BlackoilModelConvergenceMonitor< Scalar > conv_monitor_
 
- Protected Attributes inherited from Opm::NonlinearSystem< TypeTag >
Simulator & simulator_
 
const Grid & grid_
 
bool terminal_output_
 
ModelParameters param_
 
WellModel & well_model_
 
SimulatorReportSingle failureReport_
 
std::vector< StepReportconvergence_reports_
 
ComponentName compNames_ {}
 
std::vector< std::vector< Scalar > > residual_norms_history_
 
Scalar current_relaxation_
 
GlobalEqVector dx_old_
 
- Static Protected Attributes inherited from Opm::NonlinearSystemBlackOilReservoir< TypeTag >
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::EnergyModuleType>() == EnergyModules::FullyImplicitThermal
 
static constexpr bool has_foam_ = getPropValue<TypeTag, Properties::EnableFoam>()
 
static constexpr bool has_brine_ = getPropValue<TypeTag, Properties::EnableBrine>()
 
static constexpr bool has_bioeffects_ = getPropValue<TypeTag, Properties::EnableBioeffects>()
 
static constexpr bool has_micp_ = Indices::enableMICP
 

Detailed Description

template<class TypeTag>
class Opm::NonlinearSystemBlackOilReservoirTPSA< TypeTag >

Nonlinear system for coupling Flow simulations with TPSA geomechanics.

Constructor & Destructor Documentation

◆ NonlinearSystemBlackOilReservoirTPSA()

template<class TypeTag >
Opm::NonlinearSystemBlackOilReservoirTPSA< TypeTag >::NonlinearSystemBlackOilReservoirTPSA ( Simulator &  simulator,
const ModelParameters param,
BlackoilWellModel< TypeTag > &  well_model,
const bool  terminal_output 
)
inlineexplicit

Constructor.

Parameters
simulatorReference to simulator object
paramReference to parameters for model
well_modelRefenerence to well model
terminal_outputBool for terminal output

Member Function Documentation

◆ nonlinearIteration()

template<class TypeTag >
template<class NonlinearSolverType >
SimulatorReportSingle Opm::NonlinearSystemBlackOilReservoirTPSA< TypeTag >::nonlinearIteration ( const SimulatorTimerInterface timer,
NonlinearSolverType &  nonlinear_solver 
)
inline

Perform a nonlinear iteration updating Flow and TPSA geomechanics.

Parameters
timerSimulation timer
nonlinear_solverNonlinear solver type
Returns
Report for simulator performance
Note
Strategies of coupling Flow and TPSA currently implemented:
  • fixed-stress: fixed-stress algorithm, i.e. iteratively solving Flow and TPSA equations in sequence
  • lagged: one-way coupling where Flow is solved with TPSA info from previous time step

◆ nonlinearIterationFixedStressTPSA()

template<class TypeTag >
template<class NonlinearSolverType >
SimulatorReportSingle Opm::NonlinearSystemBlackOilReservoirTPSA< TypeTag >::nonlinearIterationFixedStressTPSA ( const SimulatorTimerInterface timer,
NonlinearSolverType &  nonlinear_solver 
)
inline

Perform a nonlinear iteration updating Flow and TPSA geomechanics in a fixed-stress, iterative loop.

Parameters
timerSimulation timer
nonlinear_solverNonlinear solver type
Returns
Report for simulator performance

◆ nonlinearIterationLaggedTPSA()

template<class TypeTag >
template<class NonlinearSolverType >
SimulatorReportSingle Opm::NonlinearSystemBlackOilReservoirTPSA< TypeTag >::nonlinearIterationLaggedTPSA ( const SimulatorTimerInterface timer,
NonlinearSolverType &  nonlinear_solver 
)
inline

Perform a nonlinear iteration updating Flow and TPSA geomechanics in a lagged scheme.

Parameters
iterationFlow nonlinear iteration
timerSimulation timer
nonlinear_solverNonlinear solver type
Returns
Report for simulator performance

◆ solveTpsaEquations()

template<class TypeTag >
bool Opm::NonlinearSystemBlackOilReservoirTPSA< TypeTag >::solveTpsaEquations ( )
inline

Solve TPSA geomechanics equations.

Returns
Bool indicating TPSA convergence
Note
Calls Newton method for TPSA

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