diff --git a/projection_utils.py b/projection_utils.py
index 39f825ea7fabbd48a5106ad68aaeface524becd4..27e87af53bb356bc1a73fa76e995c33464e8d9ff 100644
--- a/projection_utils.py
+++ b/projection_utils.py
@@ -7,6 +7,7 @@
 from __future__ import annotations
 from functools import cache
 from typing import Tuple
+import math
 import numpy as np
 from numpy import ndarray
 from sympy import Symbol
@@ -46,8 +47,8 @@ class Mesh:
         Parameters
         ----------
         num_grid_cells : int
-            Number of cells in the mesh (ghost cells notwithstanding). Usually
-            exponential of 2.
+            Number of cells in the mesh (ghost cells notwithstanding). Has
+            to be an exponential of 2.
         num_ghost_cells : int
             Number of ghost cells on each side of the mesh.
         left_bound : float
@@ -56,6 +57,9 @@ class Mesh:
             Right boundary of the mesh interval.
         """
         self._num_grid_cells = num_grid_cells
+        if not math.log(self._num_grid_cells, 2).is_integer():
+            raise ValueError('The number of cells in the mesh has to be an '
+                             'exponential of 2')
         self._num_ghost_cells = num_ghost_cells
         self._left_bound = left_bound
         self._right_bound = right_bound