Newton method solving for generic TPSA model. More...

#include <tpsanewtonmethod.hpp>

Public Member Functions

 TpsaNewtonMethod (Simulator &simulator)
 Constructor. More...
 
bool apply ()
 Run the Newton method. More...
 
bool converged () const
 Returns true if the error of the solution is below the tolerance. More...
 
Problem & problem ()
 Returns a reference to the object describing the current physical problem. More...
 
const Problem & problem () const
 Returns a reference to the object describing the current physical problem. More...
 
Model & model ()
 Returns a reference to the geomechanics model. More...
 
const Model & model () const
 Returns a reference to the geomechanics model. More...
 
LinearSolverBackend & linearSolver ()
 Returns the linear solver backend object for external use. More...
 
const LinearSolverBackend & linearSolver () const
 Returns the linear solver backend object for external use. More...
 
int numIterations () const
 Returns the number of iterations done since the Newton method was invoked. More...
 
int numLinearizations () const
 Returns the number of linearizations that has done since the Newton method was invoked. More...
 
Scalar tolerance () const
 Return the current tolerance at which the Newton method considers itself to be converged. More...
 
Scalar minIterations () const
 Returns minimum number of Newton iterations used. More...
 
const TimerprePostProcessTimer () const
 Return post-process timer. More...
 
const TimerlinearizeTimer () const
 Return linearization timer. More...
 
const TimersolveTimer () const
 Return linear solver timer. More...
 
const TimerupdateTimer () const
 Return solution update timer. More...
 

Static Public Member Functions

static void registerParameters ()
 Register all run-time parameters for the Newton method. More...
 

Protected Member Functions

int verbosity_ () const
 Verbosity level of Newton print messages. More...
 
void begin_ ()
 Called before the Newton method is applied to an non-linear system of equations. More...
 
void beginIteration_ ()
 Calculations at the beginning of a Newton iteration. More...
 
void linearizeDomain_ ()
 Linearize the global non-linear system of equations associated with the spatial domain. More...
 
void preSolve_ (const SolutionVector &, const GlobalEqVector &currentResidual)
 Compute error before a Newton iteration. More...
 
void update_ (SolutionVector &nextSolution, const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate, const GlobalEqVector &currentResidual)
 Update the current solution with a delta vector. More...
 
void updatePrimaryVariables_ (unsigned, PrimaryVariables &nextValue, const PrimaryVariables &currentValue, const EqVector &update, const EqVector &)
 Update a single primary variables object. More...
 
void endIteration_ ()
 Indicates that one Newton iteration was finished. More...
 
bool proceed_ () const
 Returns true iff another Newton iteration should be done. More...
 
void failed_ ()
 Called if the Newton method broke down. More...
 

Protected Attributes

Simulator & simulator_
 
LinearSolverBackend linearSolver_
 
Timer prePostProcessTimer_
 
Timer linearizeTimer_
 
Timer solveTimer_
 
Timer updateTimer_
 
Scalar error_
 
Scalar lastError_
 
TpsaNewtonMethodParams< Scalar > params_
 
int numIterations_
 
int numLinearizations_
 

Detailed Description

template<class TypeTag>
class Opm::TpsaNewtonMethod< TypeTag >

Newton method solving for generic TPSA model.

Generates the Jacobian matrix, J(u^n) and residual vector, R(u^n), with a solution vector, u^n, at iteration n. Subsequently the linear system J(u^n)\delta u^n = -R(u^n) is solved to get u^{n+1} = u^n + \Delta u^n.

Constructor & Destructor Documentation

◆ TpsaNewtonMethod()

template<class TypeTag >
Opm::TpsaNewtonMethod< TypeTag >::TpsaNewtonMethod ( Simulator &  simulator)
inlineexplicit

Constructor.

Parameters
simulatorSimulator object

References Opm::TpsaNewtonMethod< TypeTag >::params_.

Member Function Documentation

◆ apply()

◆ begin_()

template<class TypeTag >
void Opm::TpsaNewtonMethod< TypeTag >::begin_ ( )
inlineprotected

◆ beginIteration_()

template<class TypeTag >
void Opm::TpsaNewtonMethod< TypeTag >::beginIteration_ ( )
inlineprotected

Calculations at the beginning of a Newton iteration.

References Opm::TpsaNewtonMethod< TypeTag >::error_, and Opm::TpsaNewtonMethod< TypeTag >::lastError_.

Referenced by Opm::TpsaNewtonMethod< TypeTag >::apply().

◆ converged()

template<class TypeTag >
bool Opm::TpsaNewtonMethod< TypeTag >::converged ( ) const
inline

Returns true if the error of the solution is below the tolerance.

Returns
Bool indicating if convergence has been achived

References Opm::TpsaNewtonMethod< TypeTag >::error_, and Opm::TpsaNewtonMethod< TypeTag >::tolerance().

Referenced by Opm::TpsaNewtonMethod< TypeTag >::apply(), and Opm::TpsaNewtonMethod< TypeTag >::proceed_().

◆ endIteration_()

template<class TypeTag >
void Opm::TpsaNewtonMethod< TypeTag >::endIteration_ ( )
inlineprotected

◆ failed_()

template<class TypeTag >
void Opm::TpsaNewtonMethod< TypeTag >::failed_ ( )
inlineprotected

◆ linearizeDomain_()

template<class TypeTag >
void Opm::TpsaNewtonMethod< TypeTag >::linearizeDomain_ ( )
inlineprotected

Linearize the global non-linear system of equations associated with the spatial domain.

References Opm::TpsaNewtonMethod< TypeTag >::model(), and Opm::TpsaNewtonMethod< TypeTag >::numLinearizations_.

Referenced by Opm::TpsaNewtonMethod< TypeTag >::apply().

◆ linearizeTimer()

template<class TypeTag >
const Timer & Opm::TpsaNewtonMethod< TypeTag >::linearizeTimer ( ) const
inline

Return linearization timer.

Returns
Reference to linearization timer object

References Opm::TpsaNewtonMethod< TypeTag >::linearizeTimer_.

◆ linearSolver() [1/2]

template<class TypeTag >
LinearSolverBackend & Opm::TpsaNewtonMethod< TypeTag >::linearSolver ( )
inline

Returns the linear solver backend object for external use.

Returns
Reference to linear solver object

References Opm::TpsaNewtonMethod< TypeTag >::linearSolver_.

◆ linearSolver() [2/2]

template<class TypeTag >
const LinearSolverBackend & Opm::TpsaNewtonMethod< TypeTag >::linearSolver ( ) const
inline

Returns the linear solver backend object for external use.

Returns
Reference to linear solver object

References Opm::TpsaNewtonMethod< TypeTag >::linearSolver_.

◆ minIterations()

template<class TypeTag >
Scalar Opm::TpsaNewtonMethod< TypeTag >::minIterations ( ) const
inline

Returns minimum number of Newton iterations used.

Returns
Minimum number of Newton iterations

References Opm::TpsaNewtonMethod< TypeTag >::params_.

◆ model() [1/2]

template<class TypeTag >
Model & Opm::TpsaNewtonMethod< TypeTag >::model ( )
inline

◆ model() [2/2]

template<class TypeTag >
const Model & Opm::TpsaNewtonMethod< TypeTag >::model ( ) const
inline

Returns a reference to the geomechanics model.

Returns
Reference to geomechanics model object

References Opm::TpsaNewtonMethod< TypeTag >::simulator_.

◆ numIterations()

template<class TypeTag >
int Opm::TpsaNewtonMethod< TypeTag >::numIterations ( ) const
inline

Returns the number of iterations done since the Newton method was invoked.

Returns
Number of Newton iteratinos

References Opm::TpsaNewtonMethod< TypeTag >::numIterations_.

Referenced by Opm::TpsaNewtonMethod< TypeTag >::apply(), and Opm::TpsaNewtonMethod< TypeTag >::proceed_().

◆ numLinearizations()

template<class TypeTag >
int Opm::TpsaNewtonMethod< TypeTag >::numLinearizations ( ) const
inline

Returns the number of linearizations that has done since the Newton method was invoked.

Returns
Number of linearizations

References Opm::TpsaNewtonMethod< TypeTag >::numLinearizations_.

◆ prePostProcessTimer()

template<class TypeTag >
const Timer & Opm::TpsaNewtonMethod< TypeTag >::prePostProcessTimer ( ) const
inline

Return post-process timer.

Returns
Reference to post-process timer object

References Opm::TpsaNewtonMethod< TypeTag >::prePostProcessTimer_.

◆ preSolve_()

template<class TypeTag >
void Opm::TpsaNewtonMethod< TypeTag >::preSolve_ ( const SolutionVector &  ,
const GlobalEqVector &  currentResidual 
)
inlineprotected

◆ problem() [1/2]

template<class TypeTag >
Problem & Opm::TpsaNewtonMethod< TypeTag >::problem ( )
inline

Returns a reference to the object describing the current physical problem.

Returns
Reference to problem object

References Opm::TpsaNewtonMethod< TypeTag >::simulator_.

◆ problem() [2/2]

template<class TypeTag >
const Problem & Opm::TpsaNewtonMethod< TypeTag >::problem ( ) const
inline

Returns a reference to the object describing the current physical problem.

Returns
Reference to problem object

References Opm::TpsaNewtonMethod< TypeTag >::simulator_.

◆ proceed_()

template<class TypeTag >
bool Opm::TpsaNewtonMethod< TypeTag >::proceed_ ( ) const
inlineprotected

◆ registerParameters()

template<class TypeTag >
static void Opm::TpsaNewtonMethod< TypeTag >::registerParameters ( )
inlinestatic

Register all run-time parameters for the Newton method.

References Opm::TpsaNewtonMethodParams< Scalar >::registerParameters().

◆ solveTimer()

template<class TypeTag >
const Timer & Opm::TpsaNewtonMethod< TypeTag >::solveTimer ( ) const
inline

Return linear solver timer.

Returns
Reference to linear solver timer object

References Opm::TpsaNewtonMethod< TypeTag >::solveTimer_.

◆ tolerance()

template<class TypeTag >
Scalar Opm::TpsaNewtonMethod< TypeTag >::tolerance ( ) const
inline

Return the current tolerance at which the Newton method considers itself to be converged.

Returns
Tolerance for Newton error

References Opm::TpsaNewtonMethod< TypeTag >::params_.

Referenced by Opm::TpsaNewtonMethod< TypeTag >::converged().

◆ update_()

template<class TypeTag >
void Opm::TpsaNewtonMethod< TypeTag >::update_ ( SolutionVector &  nextSolution,
const SolutionVector &  currentSolution,
const GlobalEqVector &  solutionUpdate,
const GlobalEqVector &  currentResidual 
)
inlineprotected

Update the current solution with a delta vector.

Parameters
nextSolutionThe solution vector after the current iteration
currentSolutionThe solution vector after the last iteration
solutionUpdateThe delta vector as calculated by solving the linear system of equations
currentResidualThe residual vector of the current Newton-Raphson iteraton

Different update strategies, such as chopped updates can be implemented by overriding this method. The default behavior is use the standard Newton-Raphson update strategy, i.e. u^{n+1} = u^n - \Delta u^n

References Opm::TpsaNewtonMethod< TypeTag >::model(), and Opm::TpsaNewtonMethod< TypeTag >::updatePrimaryVariables_().

Referenced by Opm::TpsaNewtonMethod< TypeTag >::apply().

◆ updatePrimaryVariables_()

template<class TypeTag >
void Opm::TpsaNewtonMethod< TypeTag >::updatePrimaryVariables_ ( unsigned  ,
PrimaryVariables &  nextValue,
const PrimaryVariables &  currentValue,
const EqVector &  update,
const EqVector &   
)
inlineprotected

Update a single primary variables object.

Parameters
nextValueThe solution vector after the current iteration
currentValueThe solution vector after the last iteration
updateThe delta vector as calculated by solving the linear system of equations
currentResidualThe residual vector of the current Newton-Raphson iteraton

Referenced by Opm::TpsaNewtonMethod< TypeTag >::update_().

◆ updateTimer()

template<class TypeTag >
const Timer & Opm::TpsaNewtonMethod< TypeTag >::updateTimer ( ) const
inline

Return solution update timer.

Returns
Reference to solution update timer object

References Opm::TpsaNewtonMethod< TypeTag >::updateTimer_.

◆ verbosity_()

template<class TypeTag >
int Opm::TpsaNewtonMethod< TypeTag >::verbosity_ ( ) const
inlineprotected

Verbosity level of Newton print messages.

Returns
Level indicating verbosity

Newton procedure verbosity: 0=none, 1=basic, 2=all

References Opm::TpsaNewtonMethod< TypeTag >::params_, and Opm::TpsaNewtonMethod< TypeTag >::simulator_.

Referenced by Opm::TpsaNewtonMethod< TypeTag >::apply(), and Opm::TpsaNewtonMethod< TypeTag >::endIteration_().

Member Data Documentation

◆ error_

◆ lastError_

◆ linearizeTimer_

template<class TypeTag >
Timer Opm::TpsaNewtonMethod< TypeTag >::linearizeTimer_
protected

◆ linearSolver_

template<class TypeTag >
LinearSolverBackend Opm::TpsaNewtonMethod< TypeTag >::linearSolver_
protected

◆ numIterations_

◆ numLinearizations_

◆ params_

◆ prePostProcessTimer_

template<class TypeTag >
Timer Opm::TpsaNewtonMethod< TypeTag >::prePostProcessTimer_
protected

◆ simulator_

◆ solveTimer_

template<class TypeTag >
Timer Opm::TpsaNewtonMethod< TypeTag >::solveTimer_
protected

◆ updateTimer_

template<class TypeTag >
Timer Opm::TpsaNewtonMethod< TypeTag >::updateTimer_
protected

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