Formation and evolution of nearshore sandbars