My Project
Loading...
Searching...
No Matches
Opm::FvBaseNewtonMethod< TypeTag > Class Template Reference

A Newton method for models using a finite volume discretization. More...

#include <fvbasenewtonmethod.hh>

Inheritance diagram for Opm::FvBaseNewtonMethod< TypeTag >:
Opm::NewtonMethod< TypeTag >

Public Member Functions

 FvBaseNewtonMethod (Simulator &simulator)
 
- Public Member Functions inherited from Opm::NewtonMethod< TypeTag >
 NewtonMethod (Simulator &simulator)
 
void finishInit ()
 Finialize the construction of the object.
 
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 numeric model.
 
const Model & model () const
 Returns a reference to the numeric model.
 
int numIterations () const
 Returns the number of iterations done since the Newton method was invoked.
 
void setIterationIndex (int value)
 Set the index of current iteration.
 
Scalar tolerance () const
 Return the current tolerance at which the Newton method considers itself to be converged.
 
void setTolerance (Scalar value)
 Set the current tolerance at which the Newton method considers itself to be converged.
 
bool apply ()
 Run the Newton method.
 
Scalar suggestTimeStepSize (Scalar oldDt) const
 Suggest a new time-step size based on the old time-step size.
 
std::ostringstream & endIterMsg ()
 Message that should be printed for the user after the end of an iteration.
 
void eraseMatrix ()
 Causes the solve() method to discared the structure of the linear system of equations the next time it is called.
 
LinearSolverBackend & linearSolver ()
 Returns the linear solver backend object for external use.
 
const LinearSolverBackend & linearSolver () const
 Returns the linear solver backend object for external use.
 
const TimerprePostProcessTimer () const
 
const TimerlinearizeTimer () const
 
const TimersolveTimer () const
 
const TimerupdateTimer () const
 

Protected Member Functions

void update_ (SolutionVector &nextSolution, const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate, const GlobalEqVector &currentResidual)
 Update the current solution with a delta vector.
 
void beginIteration_ ()
 Indicates the beginning of a Newton iteration.
 
Model & model_ ()
 Returns a reference to the model.
 
const Model & model_ () const
 Returns a reference to the model.
 
- Protected Member Functions inherited from Opm::NewtonMethod< TypeTag >
bool verbose_ () const
 Returns true if the Newton method ought to be chatty.
 
void begin_ (const SolutionVector &)
 Called before the Newton method is applied to an non-linear system of equations.
 
void beginIteration_ ()
 Indicates the beginning of a Newton iteration.
 
void linearizeDomain_ ()
 Linearize the global non-linear system of equations associated with the spatial domain.
 
void linearizeAuxiliaryEquations_ ()
 
void preSolve_ (const SolutionVector &, const GlobalEqVector &currentResidual)
 
void postSolve_ (const SolutionVector &, const GlobalEqVector &, GlobalEqVector &solutionUpdate)
 Update the error of the solution given the previous iteration.
 
void update_ (SolutionVector &nextSolution, const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate, const GlobalEqVector &currentResidual)
 Update the current solution with a delta vector.
 
void updateConstraintDof_ (unsigned, PrimaryVariables &nextValue, const Constraints &constraints)
 Update the primary variables for a degree of freedom which is constraint.
 
void updatePrimaryVariables_ (unsigned, PrimaryVariables &nextValue, const PrimaryVariables &currentValue, const EqVector &update, const EqVector &)
 Update a single primary variables object.
 
void writeConvergence_ (const SolutionVector &currentSolution, const GlobalEqVector &solutionUpdate)
 Write the convergence behaviour of the newton method to disk.
 
void endIteration_ (const SolutionVector &, const SolutionVector &)
 Indicates that one Newton iteration was finished.
 
bool proceed_ () const
 Returns true iff another Newton iteration should be done.
 
void end_ ()
 Indicates that we're done solving the non-linear system of equations.
 
void failed_ ()
 Called if the Newton method broke down.
 
void succeeded_ ()
 Called if the Newton method was successful.
 

Friends

class NewtonMethod< TypeTag >
 

Additional Inherited Members

- Static Public Member Functions inherited from Opm::NewtonMethod< TypeTag >
static void registerParameters ()
 Register all run-time parameters for the Newton method.
 
- Static Protected Member Functions inherited from Opm::NewtonMethod< TypeTag >
static bool enableConstraints_ ()
 
- Protected Attributes inherited from Opm::NewtonMethod< TypeTag >
Simulator & simulator_
 
Timer prePostProcessTimer_
 
Timer linearizeTimer_
 
Timer solveTimer_
 
Timer updateTimer_
 
std::ostringstream endIterMsgStream_
 
Scalar error_
 
Scalar lastError_
 
NewtonMethodParams< Scalar > params_
 
int numIterations_
 
LinearSolverBackend linearSolver_
 
CollectiveCommunication comm_
 
ConvergenceWriter convergenceWriter_
 

Detailed Description

template<class TypeTag>
class Opm::FvBaseNewtonMethod< TypeTag >

A Newton method for models using a finite volume discretization.

This class is sufficient for most models which use an Element or a Vertex Centered Finite Volume discretization.

Member Function Documentation

◆ update_()

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

Update the current solution with a delta vector.

The error estimates required for the converged() and proceed() methods should be updated inside this method.

Different update strategies, such as line search and chopped updates can be implemented. The default behavior is just to subtract deltaU from uLastIter, i.e.

\[ u^{k+1} = u^k - \Delta u^k \]

Parameters
nextSolutionThe solution vector at the end of the current iteration
currentSolutionThe solution vector at the beginning of the current iteration
solutionUpdateThe delta as calculated by solving the linear system of equations. This parameter also stores the updated solution.
currentResidualThe residual (i.e., right-hand-side) of the current solution.

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