added adaptive mesh refinement, 2d has bugs