From 04986755869752ef6ee35ca2f138df356f55f23e Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Fri, 1 Jun 2012 15:19:32 +0000
Subject: [PATCH] Compute the norm of the correction by calling
 norm->diff(old,new).

Previously, we computed the difference ourselves and then called
the norm object to get the norm of that difference.  The change
hence doesn't make any difference in almost all cases except...
In the implementation of the 2-Lagrange-Multiplier method for the
Richards equation, the iteration variables are Robin boundary values
on the skeleton of the decomposition.  However for computing the
errors and convergence rates I want to use the energy norm of the
subdomain solutions.  Hence given Robin traces, my norm object
(MultiDomainPhysicalEnergyNorm) solves the subdomain problems
and computes the norm of that.  But since it is a nonlinear problem
calling diff is not the same as calling operator() for a difference.

[[Imported from SVN: r6330]]
---
 dune/solvers/solvers/loopsolver.cc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dune/solvers/solvers/loopsolver.cc b/dune/solvers/solvers/loopsolver.cc
index 35f3b22e..62a3b8f5 100644
--- a/dune/solvers/solvers/loopsolver.cc
+++ b/dune/solvers/solvers/loopsolver.cc
@@ -84,14 +84,13 @@ void ::LoopSolver<VectorType, BitVectorType>::solve()
 
         // Compute error
         double oldNorm = this->errorNorm_->operator()(oldSolution);
-        oldSolution -= iterationStep_->getSol();
 
-        double normOfCorrection;
         double normOfError=std::numeric_limits<double>::quiet_NaN();
-        double convRate;
 
-        normOfCorrection = this->errorNorm_->operator()(oldSolution);
-        convRate = normOfCorrection / normOfOldCorrection;
+        // Please don't replace this call to 'diff' by computing the norm of the difference.
+        // In some nonlinear DD applications the 'diff' method may be nonlinear.
+        double normOfCorrection = this->errorNorm_->diff(oldSolution,iterationStep_->getSol());
+        double convRate = normOfCorrection / normOfOldCorrection;
         error = normOfCorrection;
         normOfOldCorrection = normOfCorrection;
 
-- 
GitLab