An Adaptive Mesh Algorithm for Free Surface Flows in General Geometries