We introduce a formulation of the finite element method (FEM) adapted to typical geometry of groundwater problems. The three-dimensional domain is discretized in the following way: the projection to the horizontal plane is a triangulation (unstructured mesh) and the mesh is composed of layers in the space. Thus there is need to define finite elements on trilateral prims. We show an alternative numerical solution of porous media (potential) flow by means of combining the FEM on 2D triangle mesh and finite differences in the vertical direction (1D columns of mesh nodes). This approach correspond to the fact that the horizontal dimension is much larger then the vertical in the groundwater problems. The same numerical scheme can be also formulated in terms of finite volume method, providing the mass balance property, important for subsequent solution of the solute transport problem.