2D simulation code