12#ifndef DUMUX_PNM_NEWTON_SOLVER_HH
13#define DUMUX_PNM_NEWTON_SOLVER_HH
27template<
class Assembler,
class LinearSolver,
28 template<
class,
class>
class NewtonConsistencyChecks = TwoPNewtonConsistencyChecks>
35 using ParentType::ParentType;
49 auto& gridVariables = this->
assembler().gridVariables();
50 auto& invasionState = gridVariables.gridFluxVarsCache().invasionState();
51 switchedInLastIteration_ = invasionState.update(uCurrentIter, gridVariables.curGridVolVars(), gridVariables.gridFluxVarsCache());
57 NewtonConsistencyChecks<typename Assembler::GridVariables, SolutionVector> checks;
58 checks.performChecks(gridVariables, uCurrentIter, this->
assembler().prevSol());
69 if (switchedInLastIteration_)
82 auto& gridVariables = this->
assembler().gridVariables();
83 gridVariables.gridFluxVarsCache().invasionState().reset();
92 auto& gridVariables = this->
assembler().gridVariables();
93 gridVariables.gridFluxVarsCache().invasionState().advance();
97 bool switchedInLastIteration_{
false};
An implementation of a Newton solver.
Definition: nonlinear/newtonsolver.hh:181
virtual void newtonFail(Variables &u)
Called if the Newton method broke down. This method is called after newtonEnd()
Definition: nonlinear/newtonsolver.hh:703
virtual void newtonEndStep(Variables &vars, const SolutionVector &uLastIter)
Indicates that one Newton iteration was finished.
Definition: nonlinear/newtonsolver.hh:608
typename Backend::DofVector SolutionVector
Definition: nonlinear/newtonsolver.hh:186
virtual bool newtonConverged() const
Returns true if the error of the solution is below the tolerance.
Definition: nonlinear/newtonsolver.hh:653
const Assembler & assembler() const
Access the assembler.
Definition: common/pdesolver.hh:121
A two-phase PNM specific newton solver.
Definition: porenetwork/2p/newtonsolver.hh:30
bool newtonConverged() const final
Returns true if the current solution can be considered to be accurate enough. We enforce an additiona...
Definition: porenetwork/2p/newtonsolver.hh:67
void newtonFail(SolutionVector &u) final
Called if the Newton method broke down. This method is called after newtonEnd() and resets the invasi...
Definition: porenetwork/2p/newtonsolver.hh:79
void newtonSucceed() final
Called if the Newton method ended successfully This method is called after newtonEnd() and advances t...
Definition: porenetwork/2p/newtonsolver.hh:90
void newtonEndStep(SolutionVector &uCurrentIter, const SolutionVector &uLastIter) final
Called after each Newton update.
Definition: porenetwork/2p/newtonsolver.hh:43
Definition: discretization/porenetwork/fvelementgeometry.hh:24
Reference implementation of a Newton solver.