diff --git a/cosserat-continuum.cc b/cosserat-continuum.cc
index 04bd5e7914fd9878f32a902a0d9f3dc98332a12f..74892cafadcc808bd9d2098e7ed234715f4e98bf 100644
--- a/cosserat-continuum.cc
+++ b/cosserat-continuum.cc
@@ -249,8 +249,13 @@ int main (int argc, char *argv[]) try
     
     DeformedGridType deformedGrid(grid, deformationFunction);
 
-    LeafAmiraMeshWriter<DeformedGridType>::writeSurfaceGrid(deformedGrid.leafView(), "cosseratGrid");
-
+    if (dim==2)
+        LeafAmiraMeshWriter<DeformedGridType>::writeSurfaceGrid(deformedGrid.leafView(), "cosseratGrid");
+    else {
+        LeafAmiraMeshWriter<DeformedGridType> amiramesh(deformedGrid);
+        amiramesh.write("cosseratGrid");
+    }
+    
     // Make three vector fields containing the directors
     // I don't think there is a simpler way to get the data into vanilla Amira