diff --git a/dumux/nonlinear/newtoncontroller.hh b/dumux/nonlinear/newtoncontroller.hh index 4a793a7b4d2b5bc030b1e9b52745fdf3f0899e5c..0d1df97b0acd115fc1debfcbb7f35dad93c1e493 100644 --- a/dumux/nonlinear/newtoncontroller.hh +++ b/dumux/nonlinear/newtoncontroller.hh @@ -206,7 +206,7 @@ public: * \param u The initial solution */ template<class SolutionVector> - void newtonBegin(const SolutionVector &u) + void newtonBegin(const SolutionVector& u) { numSteps_ = 0; } @@ -214,7 +214,8 @@ public: /*! * \brief Indicates the beginning of a Newton iteration. */ - void newtonBeginStep() + template<class SolutionVector> + void newtonBeginStep(const SolutionVector& u) { lastShift_ = shift_; if (numSteps_ == 0) @@ -546,7 +547,7 @@ protected: } template<class JacobianAssembler, class SolutionVector> - void lineSearchUpdate_(const JacobianAssembler& assembler, + void lineSearchUpdate_(JacobianAssembler& assembler, SolutionVector &uCurrentIter, const SolutionVector &uLastIter, const SolutionVector &deltaU) diff --git a/dumux/nonlinear/newtonmethod.hh b/dumux/nonlinear/newtonmethod.hh index 4285e36a868cbf6086ad51071758e38a7676aff9..812702a25264af9ca457f55c757f27cebf590905 100644 --- a/dumux/nonlinear/newtonmethod.hh +++ b/dumux/nonlinear/newtonmethod.hh @@ -81,12 +81,11 @@ public: * The controller is responsible for all the strategic decisions. */ template<class SolutionVector, class ConvergenceWriter = ConvergenceWriterInferface> - bool solve(SolutionVector& u, const std::unique_ptr<ConvergenceWriter>& convWriter = nullptr) + bool solve(SolutionVector& uCurrentIter, const std::unique_ptr<ConvergenceWriter>& convWriter = nullptr) { try { // the given solution is the initial guess - SolutionVector& uCurrentIter = u; SolutionVector uLastIter(uCurrentIter); SolutionVector deltaU(uCurrentIter); @@ -103,7 +102,7 @@ public: { // notify the controller that we're about to start // a new timestep - controller_->newtonBeginStep(); + controller_->newtonBeginStep(uCurrentIter); // make the current solution to the old one if (controller_->newtonNumSteps() > 0) @@ -120,7 +119,7 @@ public: // linearize the problem at the current solution assembleTimer.start(); - controller_->assembleLinearSystem(*assembler_, u); + controller_->assembleLinearSystem(*assembler_, uCurrentIter); assembleTimer.stop(); /////////////// @@ -182,7 +181,7 @@ public: // reset state if newton failed if (!controller_->newtonConverged()) { - controller_->newtonFail(*assembler_, u); + controller_->newtonFail(*assembler_, uCurrentIter); return false; } @@ -204,7 +203,7 @@ public: { if (controller_->verbose()) std::cout << "Newton: Caught exception: \"" << e.what() << "\"\n"; - controller_->newtonFail(*assembler_, u); + controller_->newtonFail(*assembler_, uCurrentIter); return false; } }