diff --git a/dumux/assembly/fvassembler.hh b/dumux/assembly/fvassembler.hh index c60d14fff8cd37d56417d2574acf57b8daa5b87e..962e83a5332fe20ceba633e2795560a61bd72b62 100644 --- a/dumux/assembly/fvassembler.hh +++ b/dumux/assembly/fvassembler.hh @@ -154,9 +154,6 @@ public: { checkAssemblerState_(); - // update the grid variables for the case of active caching - gridVariables_->update(curSol); - assemble_([&](const Element& element) { LocalAssembler localAssembler(*this, element, curSol); diff --git a/dumux/nonlinear/newtonsolver.hh b/dumux/nonlinear/newtonsolver.hh index a5e34418f45e7692e4b1c29d1b803a05cbc78074..4ff3f1b2f2ec6b76b2c500c5084d976161dae1d3 100644 --- a/dumux/nonlinear/newtonsolver.hh +++ b/dumux/nonlinear/newtonsolver.hh @@ -541,17 +541,10 @@ public: { uCurrentIter = uLastIter; uCurrentIter -= deltaU; + solutionChanged_(uCurrentIter); if (enableResidualCriterion_) computeResidualReduction_(uCurrentIter); - - else - { - // If we get here, the convergence criterion does not require - // additional residual evaluations. Thus, the grid variables have - // not yet been updated to the new uCurrentIter. - this->assembler().updateGridVariables(uCurrentIter); - } } } @@ -782,6 +775,14 @@ public: protected: + /*! + * \brief Update solution-depended quantities like grid variables after the solution has changed. + */ + virtual void solutionChanged_(const SolutionVector &uCurrentIter) + { + this->assembler().updateGridVariables(uCurrentIter); + } + void computeResidualReduction_(const SolutionVector &uCurrentIter) { residualNorm_ = this->assembler().residualNorm(uCurrentIter); @@ -1048,6 +1049,7 @@ private: uCurrentIter = deltaU; uCurrentIter *= -lambda; uCurrentIter += uLastIter; + solutionChanged_(uCurrentIter); computeResidualReduction_(uCurrentIter); diff --git a/dumux/porousmediumflow/richards/newtonsolver.hh b/dumux/porousmediumflow/richards/newtonsolver.hh index bafc188d171595db8b09b5a411a1f5e1f59e518b..0e2785993311e3032f38252fdb69931f71b054f0 100644 --- a/dumux/porousmediumflow/richards/newtonsolver.hh +++ b/dumux/porousmediumflow/richards/newtonsolver.hh @@ -108,16 +108,11 @@ private: } } + // update the grid variables + this->solutionChanged_(uCurrentIter); + if (this->enableResidualCriterion()) this->computeResidualReduction_(uCurrentIter); - - else - { - // If we get here, the convergence criterion does not require - // additional residual evalutions. Thus, the grid variables have - // not yet been updated to the new uCurrentIter. - this->assembler().updateGridVariables(uCurrentIter); - } } };