diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc
index fba0757183cc82bfa5c8f31d2feeb611a76cbdad..c2126be16a9e51ff588a9f58dd77f2ccc98e384f 100644
--- a/src/cosserat-continuum.cc
+++ b/src/cosserat-continuum.cc
@@ -15,11 +15,14 @@
 #include <dune/common/parametertreeparser.hh>
 
 #include <dune/grid/uggrid.hh>
-#include <dune/grid/onedgrid.hh>
 #include <dune/grid/utility/structuredgridfactory.hh>
 
 #include <dune/grid/io/file/gmshreader.hh>
 
+#if HAVE_DUNE_FOAMGRID
+#include <dune/foamgrid/foamgrid.hh>
+#endif
+
 #include <dune/functions/functionspacebases/pqknodalbasis.hh>
 
 #include <dune/fufem/boundarypatch.hh>
@@ -120,7 +123,12 @@ int main (int argc, char *argv[]) try
     // ///////////////////////////////////////
     //    Create the grid
     // ///////////////////////////////////////
-    typedef std::conditional<dim==1,OneDGrid,UGGrid<dim> >::type GridType;
+#if HAVE_DUNE_FOAMGRID
+    typedef std::conditional<dim==dimworld,UGGrid<dim>, FoamGrid<dim,dimworld> >::type GridType;
+#else
+    static_assert(dim==dimworld, "FoamGrid needs to be installed to allow problems with dim != dimworld.");
+    typedef UGGrid<dim> GridType;
+#endif
 
     shared_ptr<GridType> grid;