From ce2e9c037b6be3a3818357fcaa7dd116d0a5cab4 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Mon, 4 Feb 2013 18:35:41 +0100
Subject: [PATCH] Use an H1-style norm for the velocity

---
 src/one-body-sample.cc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index 22ef3bf0..c978a555 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -61,6 +61,7 @@
 #include <dune/fufem/functionspacebases/p1nodalbasis.hh>
 #include <dune/fufem/sharedpointermap.hh>
 #include <dune/solvers/norms/energynorm.hh>
+#include <dune/solvers/norms/sumnorm.hh>
 #include <dune/solvers/solvers/loopsolver.hh>
 #include <dune/solvers/solvers/solver.hh> // Solver::FULL
 
@@ -238,6 +239,7 @@ int main(int argc, char *argv[]) {
     // Set up normal stress, mass matrix, and gravity functional
     double normalStress;
     MatrixType massMatrix;
+    EnergyNorm<MatrixType, VectorType> const massMatrixNorm(massMatrix);
     VectorType gravityFunctional;
     {
       double const gravity = 9.81;
@@ -280,6 +282,8 @@ int main(int argc, char *argv[]) {
     surfaceNormalStress = normalStress;
 
     MatrixType stiffnessMatrix;
+    EnergyNorm<MatrixType, VectorType> const stiffnessMatrixNorm(
+        stiffnessMatrix);
     {
       StVenantKirchhoffAssembler<GridType, P1Basis::LocalFiniteElement,
                                  P1Basis::LocalFiniteElement> const
@@ -303,6 +307,8 @@ int main(int argc, char *argv[]) {
       OperatorAssembler<P1Basis, P1Basis>(p1Basis, p1Basis).assemble(
           frictionalBoundaryMassAssembler, frictionalBoundaryMassMatrix);
     }
+    SumNorm<VectorType> const velocityEnergyNorm(1.0, stiffnessMatrixNorm, 1.0,
+                                                 massMatrixNorm);
 
     auto const nodalIntegrals =
         assemble_frictional<GridType, GridView, SmallVector, P1Basis>(
@@ -387,7 +393,7 @@ int main(int argc, char *argv[]) {
       stateUpdater->setup(tau);
       timeSteppingScheme->setup(ell, tau, time, problem_rhs, problem_iterate,
                                 problem_A);
-      EnergyNorm<MatrixType, VectorType> velocityEnergyNorm(problem_A);
+
       LoopSolver<VectorType> overallSolver(
           multigridStep, parset.get<size_t>("solver.tnnmg.maxiterations"),
           solver_tolerance, &velocityEnergyNorm, verbosity,
-- 
GitLab