Scaling Laplacian from 2D to 3D

Welcome to the FEniCS discourse forum. As a general suggestion, when you post code please make sure that it contains all required imports. Without those, it is harder for people to run your code and, in this specific case, realize that you are generating the mesh through mshr.

You can use

domain = Box(Point(0, 0, 0), Point(4, 2, 2))

to get the 3D domain. The PDE will be solved in the interior of the box.

If you are new to FEniCS, you may want to read The new DOLFINx solver is now recommended over DOLFIN.