diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh
index bd7f96edd1171255006b18df7f53919e20a4cc86..707f6aed8e4892749cc5c6271d957484f5c2dfab 100644
--- a/dune/tectonic/myblockproblem.hh
+++ b/dune/tectonic/myblockproblem.hh
@@ -7,6 +7,9 @@
 #include <dune/common/nullptr.hh>
 #include <dune/common/parametertree.hh>
 
+// Just for debugging
+#include "dune/solvers/computeenergy.hh"
+
 #include <dune/fufem/arithmetic.hh>
 #include <dune/tnnmg/problem-classes/bisection.hh>
 
@@ -17,18 +20,11 @@
 #include "ellipticenergy.hh"
 
 /* Just for debugging */
-template <int dim, class MatrixType, class VectorType>
+template <class MatrixType, class VectorType>
 double computeEnergy(
     MatrixType const &A, VectorType const &x, VectorType const &b,
     Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi) {
-  double ret;
-  VectorType tmp(x.size());
-  A.mv(x, tmp);          //            Ax
-  ret = 0.5 * (tmp * x); // ret = 1/2 <Ax,x>
-
-  ret -= b * x;  // ret = 1/2 <Ax,x> - <b,x>
-  ret += phi(x); // ret = 1/2 <Ax,x> - <b,x> + phi(x)
-  return ret;
+  return computeEnergy(A, x, b) + phi(x);
 }
 
 /** \brief Base class for problems where each block can be solved with a
diff --git a/dune/tectonic/myconvexproblem.hh b/dune/tectonic/myconvexproblem.hh
index b891722928e41de21006f60210c99af60388b200..542ea00ab96082674a221e074cb1fb8345000989 100644
--- a/dune/tectonic/myconvexproblem.hh
+++ b/dune/tectonic/myconvexproblem.hh
@@ -4,6 +4,9 @@
 #ifndef MY_CONVEX_PROBLEM_HH
 #define MY_CONVEX_PROBLEM_HH
 
+// Just for debugging
+#include "dune/solvers/computeenergy.hh"
+
 #include "globalnonlinearity.hh"
 
 template <class MatrixTypeTEMPLATE, class VectorTypeTEMPLATE>
@@ -29,10 +32,7 @@ class MyConvexProblem {
 
   /* Just for debugging */
   double operator()(VectorType const &x) const {
-    double ret = phi(x) - (f * x);
-    VectorType tmp(x.size());
-    A.mv(x, tmp);
-    return ret + 0.5 * (tmp * x);
+    return phi(x) + computeEnergy(A, x, f);
   }
 
   MatrixType const &A;
diff --git a/dune/tectonic/mydirectionalconvexfunction.hh b/dune/tectonic/mydirectionalconvexfunction.hh
index 4aa33f0fd6d904d941a9960843c6814799bcf809..154aa7a59962cb70f50e2621448d45a5d949ffeb 100644
--- a/dune/tectonic/mydirectionalconvexfunction.hh
+++ b/dune/tectonic/mydirectionalconvexfunction.hh
@@ -4,6 +4,9 @@
 #ifndef MY_DIRECTIONAL_CONVEX_FUNCTION_HH
 #define MY_DIRECTIONAL_CONVEX_FUNCTION_HH
 
+// just for debugging
+#include <dune/solvers/computeenergy.hh>
+
 #include <dune/fufem/interval.hh>
 
 template <class NonlinearityType> class MyDirectionalConvexFunction {
@@ -21,7 +24,7 @@ template <class NonlinearityType> class MyDirectionalConvexFunction {
   double operator()(double x) const {
     VectorType tmp = v;
     tmp *= x;
-    return (0.5 * A * x * x) - (b * x) + phi(tmp);
+    return computeEnergy(A, x, b) + phi(tmp);
   }
 
   double quadraticPart() const { return A; }