diff --git a/dune/tectonic/ellipticenergy.hh b/dune/tectonic/ellipticenergy.hh
index 68c8e480463ec2f32cf3477c27df4b817538f0f5..af295f83b63f852360e2c8b83a83ecad113c1185 100644
--- a/dune/tectonic/ellipticenergy.hh
+++ b/dune/tectonic/ellipticenergy.hh
@@ -11,7 +11,7 @@
 #include "localfriction.hh"
 
 namespace Dune {
-template <int dim> class EllipticEnergy {
+template <size_t dim> class EllipticEnergy {
 public:
   using SmallVector = FieldVector<double, dim>;
   using SmallMatrix = FieldMatrix<double, dim, dim>;
@@ -19,7 +19,7 @@ template <int dim> class EllipticEnergy {
   using NonlinearityType = LocalFriction<dim>;
 
   EllipticEnergy(SmallMatrix const &A, SmallVector const &b,
-                 shared_ptr<NonlinearityType const> phi, int ignore = dim)
+                 shared_ptr<NonlinearityType const> phi, size_t ignore = dim)
       : A(A), b(b), phi(phi), ignore(ignore) {}
 
   double operator()(SmallVector const &v) const {
@@ -32,9 +32,9 @@ template <int dim> class EllipticEnergy {
   SmallMatrix const &A;
   SmallVector const &b;
   shared_ptr<NonlinearityType const> const phi;
-  int const ignore; // Dimension that should be ignored; goes from 0
-                    // to dim-1; the special value dim means that no
-                    // dimension should be ignored
+  /* Dimension that should be ignored; goes from 0 to dim-1; the
+     special value dim means that no dimension should be ignored */
+  size_t const ignore;
 
   void gradient(SmallVector const &x, SmallVector &y) const {
     A.mv(x, y);
diff --git a/dune/tectonic/globalnonlinearity.hh b/dune/tectonic/globalnonlinearity.hh
index f0ad8933926729abd5d55ed721958e87c1b4a90b..a28164002e4332315e61e1f0b4afb2a8a7664028 100644
--- a/dune/tectonic/globalnonlinearity.hh
+++ b/dune/tectonic/globalnonlinearity.hh
@@ -23,7 +23,7 @@ class GlobalNonlinearity {
   using VectorType = VectorTypeTEMPLATE;
   using LocalMatrixType = typename MatrixType::block_type;
   using LocalVectorType = typename VectorType::block_type;
-  static const int block_size = LocalVectorType::dimension;
+  size_t static const block_size = LocalVectorType::dimension;
   using FrictionType = LocalFriction<block_size>;
 
   double operator()(VectorType const &x) const {
@@ -38,7 +38,7 @@ class GlobalNonlinearity {
   /*
     Return a restriction of the outer function to the i'th node.
   */
-  virtual shared_ptr<LocalFriction<block_size>> restriction(int i) const = 0;
+  virtual shared_ptr<LocalFriction<block_size>> restriction(size_t i) const = 0;
 
   void addHessian(VectorType const &v, MatrixType &hessian) const {
     for (size_t i = 0; i < v.size(); ++i) {
@@ -77,7 +77,7 @@ class GlobalNonlinearity {
     }
   }
 
-  double regularity(int i, typename VectorType::block_type const &x) const {
+  double regularity(size_t i, typename VectorType::block_type const &x) const {
     auto const res = restriction(i);
     return res->regularity(x);
   }
diff --git a/dune/tectonic/globalruinanonlinearity.hh b/dune/tectonic/globalruinanonlinearity.hh
index 5a899ed2216244767c925ef72149bb1d4a20e1c1..3e1570ac8b6a288c6a0bc32a5f67b415a752cf75 100644
--- a/dune/tectonic/globalruinanonlinearity.hh
+++ b/dune/tectonic/globalruinanonlinearity.hh
@@ -50,7 +50,7 @@ class GlobalRuinaNonlinearity
   /*
     Return a restriction of the outer function to the i'th node.
   */
-  shared_ptr<FrictionType> restriction(int i) const override {
+  shared_ptr<FrictionType> restriction(size_t i) const override {
     return restrictions[i];
   }
 
diff --git a/dune/tectonic/localfriction.hh b/dune/tectonic/localfriction.hh
index 490d663fbbd418bfa1457172d659797be83730e6..57289d2dc0c4b8e9cde6f88f3a017d6e854a55d8 100644
--- a/dune/tectonic/localfriction.hh
+++ b/dune/tectonic/localfriction.hh
@@ -31,7 +31,7 @@ double dotFirstNormalised(VectorType const &x, VectorType const &y) {
 }
 
 namespace Dune {
-template <int dimension> class LocalFriction {
+template <size_t dimension> class LocalFriction {
 public:
   using VectorType = FieldVector<double, dimension>;
   using MatrixType = FieldMatrix<double, dimension, dimension>;
@@ -92,14 +92,14 @@ template <int dimension> class LocalFriction {
     double const tensorweight = (H2 - H1 / xnorm) / xnorm2;
     double const idweight = H1 / xnorm;
 
-    for (int i = 0; i < dimension; ++i)
-      for (int j = 0; j < i; ++j) {
+    for (size_t i = 0; i < dimension; ++i)
+      for (size_t j = 0; j < i; ++j) {
         double const entry = tensorweight * x[i] * x[j];
         A[i][j] += entry;
         A[j][i] += entry;
       }
 
-    for (int k = 0; k < dimension; ++k) {
+    for (size_t k = 0; k < dimension; ++k) {
       double const entry = tensorweight * x[k] * x[k];
       A[k][k] += entry + idweight;
     }
diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh
index b94d3dcf21b77503edd90cc43ddef0d28ca006c3..2f440a8340812a7d49709d1990671399bc617ea2 100644
--- a/dune/tectonic/myblockproblem.hh
+++ b/dune/tectonic/myblockproblem.hh
@@ -35,14 +35,14 @@ template <class ConvexProblemTypeTEMPLATE> class MyBlockProblem {
   using MatrixType = typename ConvexProblemType::MatrixType;
   using LocalVectorType = typename ConvexProblemType::LocalVectorType;
   using LocalMatrixType = typename ConvexProblemType::LocalMatrixType;
-  int static const block_size = ConvexProblemType::block_size;
-  int static const coarse_block_size = block_size;
+  size_t static const block_size = ConvexProblemType::block_size;
+  size_t static const coarse_block_size = block_size;
 
   /** \brief Solves one local system using a modified gradient method */
   class IterateObject;
 
   struct Linearization {
-    static const int block_size = coarse_block_size;
+    size_t static const block_size = coarse_block_size;
 
     using LocalMatrixType =
         typename MyBlockProblem<ConvexProblemType>::LocalMatrixType;
@@ -67,7 +67,7 @@ template <class ConvexProblemTypeTEMPLATE> class MyBlockProblem {
   std::string getOutput(bool header = false) const {
     if (header) {
       outStream.str("");
-      for (int j = 0; j < block_size; ++j)
+      for (size_t j = 0; j < block_size; ++j)
         outStream << "  trunc" << std::setw(2) << j;
     }
     std::string s = outStream.str();
@@ -81,7 +81,7 @@ template <class ConvexProblemTypeTEMPLATE> class MyBlockProblem {
                                Linearization const &linearization) const {
     projected_v = v;
     for (size_t i = 0; i < v.size(); ++i)
-      for (int j = 0; j < block_size; ++j)
+      for (size_t j = 0; j < block_size; ++j)
         if (linearization.truncation[i][j])
           projected_v[i][j] = 0;
   }
@@ -126,7 +126,7 @@ template <class ConvexProblemTypeTEMPLATE> class MyBlockProblem {
         continue;
       }
 
-      for (int j = 0; j < block_size; ++j)
+      for (size_t j = 0; j < block_size; ++j)
         if (linearization.ignore[i][j])
           linearization.truncation[i][j] = true;
     }
@@ -166,7 +166,7 @@ template <class ConvexProblemTypeTEMPLATE> class MyBlockProblem {
       auto const col_end = linearization.A[row].end();
       for (auto col_it = linearization.A[row].begin(); col_it != col_end;
            ++col_it) {
-        int const col = col_it.index();
+        size_t const col = col_it.index();
         for (size_t i = 0; i < col_it->N(); ++i) {
           auto const blockEnd = (*col_it)[i].end();
           for (auto blockIt = (*col_it)[i].begin(); blockIt != blockEnd;
@@ -177,12 +177,12 @@ template <class ConvexProblemTypeTEMPLATE> class MyBlockProblem {
         }
       }
 
-      for (int j = 0; j < block_size; ++j)
+      for (size_t j = 0; j < block_size; ++j)
         if (linearization.truncation[row][j])
           linearization.b[row][j] = 0.0;
     }
 
-    for (int j = 0; j < block_size; ++j)
+    for (size_t j = 0; j < block_size; ++j)
       outStream << std::setw(9) << linearization.truncation.countmasked(j);
   }
 
@@ -227,7 +227,7 @@ class MyBlockProblem<ConvexProblemTypeTEMPLATE>::IterateObject {
   }
 
   /** \brief Update the i-th block of the current iterate */
-  void updateIterate(LocalVectorType const &ui, int i) {
+  void updateIterate(LocalVectorType const &ui, size_t i) {
     u[i] = ui;
     return;
   }
@@ -238,10 +238,10 @@ class MyBlockProblem<ConvexProblemTypeTEMPLATE>::IterateObject {
    * \param ignore Set of degrees of freedom to leave untouched
    */
   void solveLocalProblem(
-      LocalVectorType &ui, int m,
+      LocalVectorType &ui, size_t m,
       typename Dune::BitSetVector<block_size>::const_reference ignore) {
     {
-      int ic =
+      size_t ic =
           block_size; // Special value that indicates nothing should be ignored
       switch (ignore.count()) {
         case 0: // Full problem
@@ -262,7 +262,7 @@ class MyBlockProblem<ConvexProblemTypeTEMPLATE>::IterateObject {
 
       auto const end = problem.A[m].end();
       for (auto it = problem.A[m].begin(); it != end; ++it) {
-        int const j = it.index();
+        size_t const j = it.index();
         if (j == m)
           localA = &(*it); // localA = A[m][m]
         else
diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index a81668442e3541142fef73766a2879c350ef670a..0ea095a87d9397fe33ea00f5a8701147d30c555d 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -91,13 +91,14 @@
 #include "state/ruinastateupdater.hh"
 #include "state/dieterichstateupdater.hh"
 
-int const dims = DIM;
+size_t const dims = DIM;
 
-template <class VectorType, class MatrixType, class FunctionType, int dims>
-Dune::shared_ptr<TimeSteppingScheme<VectorType, MatrixType, FunctionType, dims>>
+template <class VectorType, class MatrixType, class FunctionType, int dimension>
+Dune::shared_ptr<
+    TimeSteppingScheme<VectorType, MatrixType, FunctionType, dimension>>
 initTimeStepper(Config::scheme scheme,
                 FunctionType const &velocityDirichletFunction,
-                Dune::BitSetVector<dims> const &velocityDirichletNodes,
+                Dune::BitSetVector<dimension> const &velocityDirichletNodes,
                 MatrixType const &massMatrix, MatrixType const &stiffnessMatrix,
                 VectorType const &u_initial, VectorType const &v_initial,
                 VectorType const &a_initial) {
@@ -277,11 +278,11 @@ int main(int argc, char *argv[]) {
       }
       {
         double volume = 1.0;
-        for (int i = 0; i < dims; ++i)
+        for (size_t i = 0; i < dims; ++i)
           volume *= (upperRight[i] - lowerLeft[i]);
 
         double area = 1.0;
-        for (int i = 0; i < dims; ++i)
+        for (size_t i = 0; i < dims; ++i)
           if (i != 1)
             area *= (upperRight[i] - lowerLeft[i]);
 
diff --git a/src/solverfactory.cc b/src/solverfactory.cc
index 37cd0d40195bb7f18ffdad3552ce1e832fdd368d..cdd188529bc4cc94f8e881cdc64978ea6c5cea92 100644
--- a/src/solverfactory.cc
+++ b/src/solverfactory.cc
@@ -11,9 +11,9 @@
 
 #include "solverfactory.hh"
 
-template <int dim, class BlockProblemType, class GridType>
+template <size_t dim, class BlockProblemType, class GridType>
 SolverFactory<dim, BlockProblemType, GridType>::SolverFactory(
-    Dune::ParameterTree const &parset, int refinements, GridType const &grid,
+    Dune::ParameterTree const &parset, size_t refinements, GridType const &grid,
     Dune::BitSetVector<dim> const &ignoreNodes)
     : baseEnergyNorm(linearBaseSolverStep),
       linearBaseSolver(&linearBaseSolverStep,
@@ -43,7 +43,7 @@ SolverFactory<dim, BlockProblemType, GridType>::SolverFactory(
   multigridStep->ignoreNodes_ = &ignoreNodes;
 }
 
-template <int dim, class BlockProblemType, class GridType>
+template <size_t dim, class BlockProblemType, class GridType>
 SolverFactory<dim, BlockProblemType, GridType>::~SolverFactory() {
   for (auto &x : transferOperators)
     delete x;
@@ -51,7 +51,7 @@ SolverFactory<dim, BlockProblemType, GridType>::~SolverFactory() {
   delete multigridStep;
 }
 
-template <int dim, class BlockProblemType, class GridType>
+template <size_t dim, class BlockProblemType, class GridType>
 typename SolverFactory<dim, BlockProblemType, GridType>::SolverType *
 SolverFactory<dim, BlockProblemType, GridType>::getSolver() {
   return multigridStep;
diff --git a/src/solverfactory.hh b/src/solverfactory.hh
index 45f4a0d670db1616933f5028f438324b8e973fd9..4b8c533e6cdc9e86d6aff343a4633d87aa735ba6 100644
--- a/src/solverfactory.hh
+++ b/src/solverfactory.hh
@@ -12,7 +12,7 @@
 #include <dune/solvers/transferoperators/compressedmultigridtransfer.hh>
 #include <dune/tnnmg/iterationsteps/tnnmgstep.hh>
 
-template <int dim, class BlockProblemTypeTEMPLATE, class GridType>
+template <size_t dim, class BlockProblemTypeTEMPLATE, class GridType>
 class SolverFactory {
 public:
   using BlockProblemType = BlockProblemTypeTEMPLATE;
@@ -26,7 +26,7 @@ class SolverFactory {
                                                        NonlinearSmootherType>;
 
 public:
-  SolverFactory(Dune::ParameterTree const &parset, int refinements,
+  SolverFactory(Dune::ParameterTree const &parset, size_t refinements,
                 GridType const &grid,
                 Dune::BitSetVector<dim> const &ignoreNodes);
 
diff --git a/src/timestepping.hh b/src/timestepping.hh
index fd247f6c0e82de875731ee32fa607e9991b32a99..861d84752373e1612eb909643dd5d2c21896d11d 100644
--- a/src/timestepping.hh
+++ b/src/timestepping.hh
@@ -3,7 +3,7 @@
 
 #include <dune/common/bitsetvector.hh>
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 class TimeSteppingScheme {
 public:
   void virtual nextTimeStep() = 0;
diff --git a/src/timestepping/backward_euler.cc b/src/timestepping/backward_euler.cc
index b95a00635857a5d0df054fddb2f1d32f2939af8c..eef042e35e52d896009533e2e80ea74518ad7d06 100644
--- a/src/timestepping/backward_euler.cc
+++ b/src/timestepping/backward_euler.cc
@@ -1,4 +1,4 @@
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 BackwardEuler<VectorType, MatrixType, FunctionType, dim>::BackwardEuler(
     MatrixType const &_A, MatrixType const &_M, VectorType const &_u_initial,
     VectorType const &_v_initial,
@@ -11,13 +11,13 @@ BackwardEuler<VectorType, MatrixType, FunctionType, dim>::BackwardEuler(
       dirichletNodes(_dirichletNodes),
       dirichletFunction(_dirichletFunction) {}
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() {
   v_o = v;
   u_o = u;
 }
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::setup(
     VectorType const &ell, double _tau, double time, VectorType &rhs,
     VectorType &iterate, MatrixType &AM) {
@@ -94,7 +94,7 @@ void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::setup(
     }
 }
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::postProcess(
     VectorType const &iterate) {
   postProcessCalled = true;
@@ -105,7 +105,7 @@ void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::postProcess(
   Arithmetic::addProduct(u, tau, v);
 }
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void BackwardEuler<VectorType, MatrixType, FunctionType,
                    dim>::extractDisplacement(VectorType &displacement) const {
   if (!postProcessCalled)
@@ -114,7 +114,7 @@ void BackwardEuler<VectorType, MatrixType, FunctionType,
   displacement = u;
 }
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::extractVelocity(
     VectorType &velocity) const {
   if (!postProcessCalled)
diff --git a/src/timestepping/backward_euler.hh b/src/timestepping/backward_euler.hh
index 202c4420e32253bb3405253bb35591294b379dd7..98eb362b92d994f697db52f54353c8e8a9fa9052 100644
--- a/src/timestepping/backward_euler.hh
+++ b/src/timestepping/backward_euler.hh
@@ -1,7 +1,7 @@
 #ifndef DUNE_TECTONIC_TIMESTEPPING_BACKWARD_EULER_HH
 #define DUNE_TECTONIC_TIMESTEPPING_BACKWARD_EULER_HH
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 class BackwardEuler
     : public TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> {
 public:
diff --git a/src/timestepping/newmark.cc b/src/timestepping/newmark.cc
index 743b660de41146856066b3bb2930e8b134590922..f2190ac452f6c888a38dd7c7fe32c985c53a8da9 100644
--- a/src/timestepping/newmark.cc
+++ b/src/timestepping/newmark.cc
@@ -1,4 +1,4 @@
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 Newmark<VectorType, MatrixType, FunctionType, dim>::Newmark(
     MatrixType const &_A, MatrixType const &_M, VectorType const &_u_initial,
     VectorType const &_v_initial, VectorType const &_a_initial,
@@ -12,14 +12,14 @@ Newmark<VectorType, MatrixType, FunctionType, dim>::Newmark(
       dirichletNodes(_dirichletNodes),
       dirichletFunction(_dirichletFunction) {}
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void Newmark<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() {
   a_o = a;
   v_o = v;
   u_o = u;
 }
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void Newmark<VectorType, MatrixType, FunctionType, dim>::setup(
     VectorType const &ell, double _tau, double time, VectorType &rhs,
     VectorType &iterate, MatrixType &AM) {
@@ -99,7 +99,7 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup(
     }
 }
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void Newmark<VectorType, MatrixType, FunctionType, dim>::postProcess(
     VectorType const &iterate) {
   postProcessCalled = true;
@@ -118,7 +118,7 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::postProcess(
   Arithmetic::subtractProduct(a, 1.0, a_o);
 }
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void Newmark<VectorType, MatrixType, FunctionType, dim>::extractDisplacement(
     VectorType &displacement) const {
   if (!postProcessCalled)
@@ -127,7 +127,7 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::extractDisplacement(
   displacement = u;
 }
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 void Newmark<VectorType, MatrixType, FunctionType, dim>::extractVelocity(
     VectorType &velocity) const {
   if (!postProcessCalled)
diff --git a/src/timestepping/newmark.hh b/src/timestepping/newmark.hh
index ff707a7ef9389607fa2023876dc21da728e71bcf..f4dc7e600b4314b58ef401d3c28b05abea236a0a 100644
--- a/src/timestepping/newmark.hh
+++ b/src/timestepping/newmark.hh
@@ -1,7 +1,7 @@
 #ifndef DUNE_TECTONIC_TIMESTEPPING_NEWMARK_HH
 #define DUNE_TECTONIC_TIMESTEPPING_NEWMARK_HH
 
-template <class VectorType, class MatrixType, class FunctionType, int dim>
+template <class VectorType, class MatrixType, class FunctionType, size_t dim>
 class Newmark
     : public TimeSteppingScheme<VectorType, MatrixType, FunctionType, dim> {
 public: