All Classes Namespaces Files Functions Variables Typedefs Enumerator Pages
Opm::NonlinearSolver< PhysicalModel > Class Template Reference

A nonlinear solver class suitable for general fully-implicit models, as well as pressure, transport and sequential models. More...

#include <NonlinearSolver.hpp>

Classes

struct  SolverParameters
 

Public Types

enum  RelaxType { DAMPEN, SOR }
 
typedef
PhysicalModel::ReservoirState 
ReservoirState
 
typedef PhysicalModel::WellState WellState
 

Public Member Functions

 NonlinearSolver (const SolverParameters &param, std::unique_ptr< PhysicalModel > model)
 Construct solver for a given model. More...
 
SimulatorReport step (const SimulatorTimerInterface &timer, ReservoirState &reservoir_state, WellState &well_state)
 Take a single forward step, after which the states will be modified according to the physical model. More...
 
SimulatorReport step (const SimulatorTimerInterface &timer, const ReservoirState &initial_reservoir_state, const WellState &initial_well_state, ReservoirState &reservoir_state, WellState &well_state)
 Take a single forward step, after which the states will be modified according to the physical model. More...
 
const SimulatorReport & failureReport () const
 return the statistics if the step() method failed
 
int linearizations () const
 Number of linearizations used in all calls to step().
 
int nonlinearIterations () const
 Number of full nonlinear solver iterations used in all calls to step().
 
int linearIterations () const
 Number of linear solver iterations used in all calls to step().
 
int wellIterations () const
 Number of well iterations used in all calls to step().
 
int nonlinearIterationsLastStep () const
 Number of nonlinear solver iterations used in the last call to step().
 
int linearIterationsLastStep () const
 Number of linear solver iterations used in the last call to step().
 
int wellIterationsLastStep () const
 Number of well iterations used in all calls to step().
 
std::vector< std::vector
< double > > 
computeFluidInPlace (const ReservoirState &x, const std::vector< int > &fipnum) const
 Compute fluid in place. More...
 
std::vector< std::vector
< double > > 
computeFluidInPlace (const std::vector< int > &fipnum) const
 
const PhysicalModel & model () const
 Reference to physical model.
 
PhysicalModel & model ()
 Mutable reference to physical model.
 
void detectOscillations (const std::vector< std::vector< double >> &residual_history, const int it, bool &oscillate, bool &stagnate) const
 Detect oscillation or stagnation in a given residual history.
 
template<class BVector >
void stabilizeNonlinearUpdate (BVector &dx, BVector &dxOld, const double omega) const
 Apply a stabilization to dx, depending on dxOld and relaxation parameters. More...
 
double relaxMax () const
 The greatest relaxation factor (i.e. smallest factor) allowed.
 
double relaxIncrement () const
 The step-change size for the relaxation factor.
 
enum RelaxType relaxType () const
 The relaxation type (DAMPEN or SOR).
 
double relaxRelTol () const
 The relaxation relative tolerance.
 
int maxIter () const
 The maximum number of nonlinear iterations allowed.
 
int minIter () const
 The minimum number of nonlinear iterations allowed.
 
void setParameters (const SolverParameters &param)
 Set parameters to override those given at construction time.
 

Detailed Description

template<class PhysicalModel>
class Opm::NonlinearSolver< PhysicalModel >

A nonlinear solver class suitable for general fully-implicit models, as well as pressure, transport and sequential models.

Constructor & Destructor Documentation

template<class PhysicalModel>
Opm::NonlinearSolver< PhysicalModel >::NonlinearSolver ( const SolverParameters param,
std::unique_ptr< PhysicalModel >  model 
)
explicit

Construct solver for a given model.

The model is a std::unique_ptr because the object to which model points to is not allowed to be deleted as long as the NonlinearSolver object exists.

Parameters
[in]paramparameters controlling nonlinear process
[in,out]modelphysical simulation model.

Member Function Documentation

template<class PhysicalModel>
std::vector<std::vector<double> > Opm::NonlinearSolver< PhysicalModel >::computeFluidInPlace ( const ReservoirState &  x,
const std::vector< int > &  fipnum 
) const
inline

Compute fluid in place.

Parameters
[in]ReservoirState
[in]FIPNUMfor active cells not global cells.
Returns
fluid in place, number of fip regions, each region contains 5 values which are liquid, vapour, water, free gas and dissolved gas.
template<class PhysicalModel >
template<class BVector >
void Opm::NonlinearSolver< PhysicalModel >::stabilizeNonlinearUpdate ( BVector &  dx,
BVector &  dxOld,
const double  omega 
) const

Apply a stabilization to dx, depending on dxOld and relaxation parameters.

Implemention for Dune block vectors.

template<class PhysicalModel >
SimulatorReport Opm::NonlinearSolver< PhysicalModel >::step ( const SimulatorTimerInterface timer,
ReservoirState &  reservoir_state,
WellState &  well_state 
)

Take a single forward step, after which the states will be modified according to the physical model.

Parameters
[in]timersimulation timer
[in,out]reservoir_statereservoir state variables
[in,out]well_statewell state variables
template<class PhysicalModel >
SimulatorReport Opm::NonlinearSolver< PhysicalModel >::step ( const SimulatorTimerInterface timer,
const ReservoirState &  initial_reservoir_state,
const WellState &  initial_well_state,
ReservoirState &  reservoir_state,
WellState &  well_state 
)

Take a single forward step, after which the states will be modified according to the physical model.

This version allows for the states passed as in/out arguments to be different from the initial states.

Parameters
[in]timersimulation timer
[in]initial_reservoir_statereservoir state variables at start of timestep
[in]initial_well_statewell state variables at start of timestep
[in,out]reservoir_statereservoir state variables
[in,out]well_statewell state variables
Returns
number of linear iterations used

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