opm-simulators
Loading...
Searching...
No Matches
Opm::TpsaNewtonMethod< TypeTag > Class Template Reference

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

#include <tpsanewtonmethod.hpp>

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

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

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

Member Function Documentation

◆ apply()

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

Run the Newton method.

Returns
Bool indicating if Newton converged

◆ 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

◆ linearizeTimer()

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

Return linearization timer.

Returns
Reference to linearization timer object

◆ 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

◆ 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

◆ minIterations()

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

Returns minimum number of Newton iterations used.

Returns
Minimum number of Newton iterations

◆ model() [1/2]

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

Returns a reference to the geomechanics model.

Returns
Reference to geomechanics model object

◆ 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

◆ 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

◆ 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

◆ prePostProcessTimer()

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

Return post-process timer.

Returns
Reference to post-process timer object

◆ preSolve_()

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

Compute error before a Newton iteration.

Parameters
currentSolutionCurrent solution vector
currentResidualCurrent residual vector

◆ 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

◆ 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

◆ proceed_()

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

Returns true iff another Newton iteration should be done.

Returns
Bool indicating if Newton iterations should continue

◆ solveTimer()

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

Return linear solver timer.

Returns
Reference to linear solver timer object

◆ 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

◆ 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

◆ 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

◆ updateTimer()

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

Return solution update timer.

Returns
Reference to solution update timer object

◆ 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


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