Optimize mesh with vertices z components

I want to optimize so that water flows to a certain point on my mesh. Therefore, points on the mesh should change in z direction to optimize the flow. Any ideas?