3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm > Class Template Reference

An implementation of a Newton solver. More...

#include <dumux/nonlinear/newtonsolver.hh>

Inheritance diagram for Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >:
Inheritance graph

Description

template<class Assembler, class LinearSolver, class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
class Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >

An implementation of a Newton solver.

Template Parameters
Assemblerthe assembler
LinearSolverthe linear solver
Commthe communication object used to communicate with all processes
Note
If you want to specialize only some methods but are happy with the defaults of the reference solver, derive your solver from this class and simply overload the required methods.

Public Types

using Communication = Comm
 

Public Member Functions

 NewtonSolver (std::shared_ptr< Assembler > assembler, std::shared_ptr< LinearSolver > linearSolver, const Communication &comm=Dune::MPIHelper::getCollectiveCommunication(), const std::string &paramGroup="")
 The Constructor. More...
 
const Communicationcomm () const
 the communicator for parallel runs More...
 
void setMaxRelativeShift (Scalar tolerance)
 Set the maximum acceptable difference of any primary variable between two iterations for declaring convergence. More...
 
void setMaxAbsoluteResidual (Scalar tolerance)
 Set the maximum acceptable absolute residual for declaring convergence. More...
 
void setResidualReduction (Scalar tolerance)
 Set the maximum acceptable residual norm reduction. More...
 
void setTargetSteps (int targetSteps)
 Set the number of iterations at which the Newton method should aim at. More...
 
void setMinSteps (int minSteps)
 Set the number of minimum iterations for the Newton method. More...
 
void setMaxSteps (int maxSteps)
 Set the number of iterations after which the Newton method gives up. More...
 
void solve (SolutionVector &uCurrentIter, TimeLoop &timeLoop, std::shared_ptr< ConvergenceWriter > convWriter)
 Run the Newton method to solve a non-linear system. Does time step control when the Newton fails to converge. More...
 
void solve (SolutionVector &uCurrentIter, TimeLoop &timeLoop) override
 Run the Newton method to solve a non-linear system. Does time step control when the Newton fails to converge. More...
 
void solve (SolutionVector &uCurrentIter) override
 Run the Newton method to solve a non-linear system. The solver is responsible for all the strategic decisions. More...
 
virtual void newtonBegin (SolutionVector &u)
 Called before the Newton method is applied to an non-linear system of equations. More...
 
virtual bool newtonProceed (const SolutionVector &uCurrentIter, bool converged)
 Returns true if another iteration should be done. More...
 
virtual void newtonBeginStep (const SolutionVector &u)
 Indicates the beginning of a Newton iteration. More...
 
virtual void assembleLinearSystem (const SolutionVector &uCurrentIter)
 Assemble the linear system of equations \(\mathbf{A}x - b = 0\). More...
 
void solveLinearSystem (SolutionVector &deltaU)
 Solve the linear system of equations \(\mathbf{A}x - b = 0\). More...
 
void newtonUpdate (SolutionVector &uCurrentIter, const SolutionVector &uLastIter, const SolutionVector &deltaU)
 Update the current solution with a delta vector. More...
 
virtual void newtonEndStep (SolutionVector &uCurrentIter, const SolutionVector &uLastIter)
 Indicates that one Newton iteration was finished. More...
 
virtual void newtonEnd ()
 Called if the Newton method ended (not known yet if we failed or succeeded) More...
 
virtual bool newtonConverged () const
 Returns true if the error of the solution is below the tolerance. More...
 
virtual void newtonFail (SolutionVector &u)
 Called if the Newton method broke down. This method is called after newtonEnd() More...
 
virtual void newtonSucceed ()
 Called if the Newton method ended successfully This method is called after newtonEnd() More...
 
void report (std::ostream &sout=std::cout) const
 output statistics / report More...
 
void resetReport ()
 reset the statistics More...
 
void reportParams (std::ostream &sout=std::cout) const
 Report the options and parameters this Newton is configured with. More...
 
Scalar suggestTimeStepSize (Scalar oldTimeStep) const
 Suggest a new time-step size based on the old time-step size. More...
 
void setVerbose (bool val)
 Specifies if the Newton method ought to be chatty. More...
 
bool verbose () const
 Returns true if the Newton method ought to be chatty. More...
 
void setVerbosity (int val)
 Specifies the verbosity level. More...
 
int verbosity () const
 Return the verbosity level. More...
 
const std::string & paramGroup () const
 Returns the parameter group. More...
 
void attachConvergenceWriter (std::shared_ptr< ConvergenceWriter > convWriter)
 Attach a convergence writer to write out intermediate results after each iteration. More...
 
void detachConvergenceWriter ()
 Detach the convergence writer to stop the output. More...
 

Protected Member Functions

void computeResidualReduction_ (const SolutionVector &uCurrentIter)
 
bool enableResidualCriterion () const
 
void initPriVarSwitch_ (SolutionVector &, std::false_type)
 Initialize the privar switch, noop if there is no priVarSwitch. More...
 
void initPriVarSwitch_ (SolutionVector &sol, std::true_type)
 Initialize the privar switch. More...
 
void invokePriVarSwitch_ (SolutionVector &, std::false_type)
 Switch primary variables if necessary, noop if there is no priVarSwitch. More...
 
void invokePriVarSwitch_ (SolutionVector &uCurrentIter, std::true_type)
 Switch primary variables if necessary. More...
 
const Assembler & assembler () const
 Access the assembler. More...
 
Assembler & assembler ()
 Access the assembler. More...
 
const LinearSolverlinearSolver () const
 Access the linear solver. More...
 
LinearSolverlinearSolver ()
 Access the linear solver. More...
 

Protected Attributes

int targetSteps_
 optimal number of iterations we want to achieve More...
 
int minSteps_
 minimum number of iterations we do More...
 
int maxSteps_
 maximum number of iterations we do before giving up More...
 
int numSteps_
 actual number of steps done so far More...
 
Scalar reduction_
 
Scalar residualNorm_
 
Scalar lastReduction_
 
Scalar initialResidual_
 
Scalar shift_
 
Scalar lastShift_
 
std::ostringstream endIterMsgStream_
 message stream to be displayed at the end of iterations More...
 

Member Typedef Documentation

◆ Communication

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
using Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::Communication = Comm

Constructor & Destructor Documentation

◆ NewtonSolver()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::NewtonSolver ( std::shared_ptr< Assembler >  assembler,
std::shared_ptr< LinearSolver linearSolver,
const Communication comm = Dune::MPIHelper::getCollectiveCommunication(),
const std::string &  paramGroup = "" 
)
inline

The Constructor.

Member Function Documentation

◆ assembleLinearSystem()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::assembleLinearSystem ( const SolutionVector &  uCurrentIter)
inlinevirtual

Assemble the linear system of equations \(\mathbf{A}x - b = 0\).

Parameters
uCurrentIterThe current iteration's solution vector

◆ assembler() [1/2]

template<class Assembler , class LinearSolver >
Assembler & Dumux::PDESolver< Assembler, LinearSolver >::assembler ( )
inlineprotectedinherited

Access the assembler.

◆ assembler() [2/2]

template<class Assembler , class LinearSolver >
const Assembler & Dumux::PDESolver< Assembler, LinearSolver >::assembler ( ) const
inlineprotectedinherited

Access the assembler.

◆ attachConvergenceWriter()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::attachConvergenceWriter ( std::shared_ptr< ConvergenceWriter convWriter)
inline

Attach a convergence writer to write out intermediate results after each iteration.

◆ comm()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
const Communication & Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::comm ( ) const
inline

the communicator for parallel runs

◆ computeResidualReduction_()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::computeResidualReduction_ ( const SolutionVector &  uCurrentIter)
inlineprotected

◆ detachConvergenceWriter()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::detachConvergenceWriter ( )
inline

Detach the convergence writer to stop the output.

◆ enableResidualCriterion()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
bool Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::enableResidualCriterion ( ) const
inlineprotected

◆ initPriVarSwitch_() [1/2]

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::initPriVarSwitch_ ( SolutionVector &  ,
std::false_type   
)
inlineprotected

Initialize the privar switch, noop if there is no priVarSwitch.

◆ initPriVarSwitch_() [2/2]

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::initPriVarSwitch_ ( SolutionVector &  sol,
std::true_type   
)
inlineprotected

Initialize the privar switch.

◆ invokePriVarSwitch_() [1/2]

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::invokePriVarSwitch_ ( SolutionVector &  ,
std::false_type   
)
inlineprotected

Switch primary variables if necessary, noop if there is no priVarSwitch.

◆ invokePriVarSwitch_() [2/2]

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::invokePriVarSwitch_ ( SolutionVector &  uCurrentIter,
std::true_type   
)
inlineprotected

Switch primary variables if necessary.

◆ linearSolver() [1/2]

template<class Assembler , class LinearSolver >
LinearSolver & Dumux::PDESolver< Assembler, LinearSolver >::linearSolver ( )
inlineprotectedinherited

Access the linear solver.

◆ linearSolver() [2/2]

template<class Assembler , class LinearSolver >
const LinearSolver & Dumux::PDESolver< Assembler, LinearSolver >::linearSolver ( ) const
inlineprotectedinherited

Access the linear solver.

◆ newtonBegin()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonBegin ( SolutionVector &  u)
inlinevirtual

Called before the Newton method is applied to an non-linear system of equations.

Parameters
uThe initial solution

Reimplemented in Dumux::MultiDomainNewtonSolver< Assembler, LinearSolver, CouplingManager, Reassembler, Comm >.

◆ newtonBeginStep()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonBeginStep ( const SolutionVector &  u)
inlinevirtual

Indicates the beginning of a Newton iteration.

Reimplemented in Dumux::MultiDomainNewtonSolver< Assembler, LinearSolver, CouplingManager, Reassembler, Comm >.

◆ newtonConverged()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual bool Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonConverged ( ) const
inlinevirtual

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

Reimplemented in Dumux::MultiDomainNewtonSolver< Assembler, LinearSolver, CouplingManager, Reassembler, Comm >.

◆ newtonEnd()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonEnd ( )
inlinevirtual

Called if the Newton method ended (not known yet if we failed or succeeded)

◆ newtonEndStep()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonEndStep ( SolutionVector &  uCurrentIter,
const SolutionVector &  uLastIter 
)
inlinevirtual

Indicates that one Newton iteration was finished.

Parameters
uCurrentIterThe solution after the current Newton iteration
uLastIterThe solution at the beginning of the current Newton iteration

Reimplemented in Dumux::NonEquilibriumNewtonSolver< Assembler, LinearSolver >, and Dumux::MultiDomainNewtonSolver< Assembler, LinearSolver, CouplingManager, Reassembler, Comm >.

◆ newtonFail()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonFail ( SolutionVector &  u)
inlinevirtual

Called if the Newton method broke down. This method is called after newtonEnd()

◆ newtonProceed()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual bool Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonProceed ( const SolutionVector &  uCurrentIter,
bool  converged 
)
inlinevirtual

Returns true if another iteration should be done.

Parameters
uCurrentIterThe solution of the current Newton iteration
convergedif the Newton method's convergence criterion was met in this step

◆ newtonSucceed()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
virtual void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonSucceed ( )
inlinevirtual

Called if the Newton method ended successfully This method is called after newtonEnd()

◆ newtonUpdate()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::newtonUpdate ( SolutionVector &  uCurrentIter,
const SolutionVector &  uLastIter,
const SolutionVector &  deltaU 
)
inline

Update the current solution with a delta vector.

The error estimates required for the newtonConverged() and newtonProceed() 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
uCurrentIterThe solution vector after the current iteration
uLastIterThe solution vector after the last iteration
deltaUThe delta as calculated from solving the linear system of equations. This parameter also stores the updated solution.

◆ paramGroup()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
const std::string & Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::paramGroup ( ) const
inline

Returns the parameter group.

◆ report()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::report ( std::ostream &  sout = std::cout) const
inline

output statistics / report

◆ reportParams()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::reportParams ( std::ostream &  sout = std::cout) const
inline

Report the options and parameters this Newton is configured with.

◆ resetReport()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::resetReport ( )
inline

reset the statistics

◆ setMaxAbsoluteResidual()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::setMaxAbsoluteResidual ( Scalar  tolerance)
inline

Set the maximum acceptable absolute residual for declaring convergence.

Parameters
toleranceThe maximum absolute residual at which the scheme is considered finished

◆ setMaxRelativeShift()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::setMaxRelativeShift ( Scalar  tolerance)
inline

Set the maximum acceptable difference of any primary variable between two iterations for declaring convergence.

Parameters
toleranceThe maximum relative shift between two Newton iterations at which the scheme is considered finished

◆ setMaxSteps()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::setMaxSteps ( int  maxSteps)
inline

Set the number of iterations after which the Newton method gives up.

Parameters
maxStepsNumber of iterations after we give up

◆ setMinSteps()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::setMinSteps ( int  minSteps)
inline

Set the number of minimum iterations for the Newton method.

Parameters
minStepsMinimum number of iterations

◆ setResidualReduction()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::setResidualReduction ( Scalar  tolerance)
inline

Set the maximum acceptable residual norm reduction.

Parameters
toleranceThe maximum reduction of the residual norm at which the scheme is considered finished

◆ setTargetSteps()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::setTargetSteps ( int  targetSteps)
inline

Set the number of iterations at which the Newton method should aim at.

This is used to control the time-step size. The heuristic used is to scale the last time-step size by the deviation of the number of iterations used from the target steps.

Parameters
targetStepsNumber of iterations which are considered "optimal"

◆ setVerbose()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::setVerbose ( bool  val)
inline

Specifies if the Newton method ought to be chatty.

◆ setVerbosity()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::setVerbosity ( int  val)
inline

Specifies the verbosity level.

◆ solve() [1/3]

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::solve ( SolutionVector &  uCurrentIter)
inlineoverridevirtual

Run the Newton method to solve a non-linear system. The solver is responsible for all the strategic decisions.

Implements Dumux::PDESolver< Assembler, LinearSolver >.

◆ solve() [2/3]

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::solve ( SolutionVector &  uCurrentIter,
TimeLoop timeLoop 
)
inlineoverridevirtual

Run the Newton method to solve a non-linear system. Does time step control when the Newton fails to converge.

Reimplemented from Dumux::PDESolver< Assembler, LinearSolver >.

◆ solve() [3/3]

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::solve ( SolutionVector &  uCurrentIter,
TimeLoop timeLoop,
std::shared_ptr< ConvergenceWriter convWriter 
)
inline

Run the Newton method to solve a non-linear system. Does time step control when the Newton fails to converge.

◆ solveLinearSystem()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
void Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::solveLinearSystem ( SolutionVector &  deltaU)
inline

Solve the linear system of equations \(\mathbf{A}x - b = 0\).

Throws Dumux::NumericalProblem if the linear solver didn't converge.

If the linear solver doesn't accept multitype matrices we copy the matrix into a 1x1 block BCRS matrix for solving.

Parameters
deltaUThe difference between the current and the next solution

◆ suggestTimeStepSize()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
Scalar Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::suggestTimeStepSize ( Scalar  oldTimeStep) const
inline

Suggest a new time-step size based on the old time-step size.

The default behavior is to suggest the old time-step size scaled by the ratio between the target iterations and the iterations required to actually solve the last time-step.

◆ verbose()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
bool Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::verbose ( ) const
inline

Returns true if the Newton method ought to be chatty.

◆ verbosity()

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
int Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::verbosity ( ) const
inline

Return the verbosity level.

Member Data Documentation

◆ endIterMsgStream_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
std::ostringstream Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::endIterMsgStream_
protected

message stream to be displayed at the end of iterations

◆ initialResidual_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
Scalar Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::initialResidual_
protected

◆ lastReduction_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
Scalar Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::lastReduction_
protected

◆ lastShift_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
Scalar Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::lastShift_
protected

◆ maxSteps_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
int Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::maxSteps_
protected

maximum number of iterations we do before giving up

◆ minSteps_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
int Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::minSteps_
protected

minimum number of iterations we do

◆ numSteps_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
int Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::numSteps_
protected

actual number of steps done so far

◆ reduction_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
Scalar Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::reduction_
protected

◆ residualNorm_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
Scalar Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::residualNorm_
protected

◆ shift_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
Scalar Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::shift_
protected

◆ targetSteps_

template<class Assembler , class LinearSolver , class Reassembler = PartialReassembler<Assembler>, class Comm = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>>
int Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm >::targetSteps_
protected

optimal number of iterations we want to achieve


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