A continuous model for sand dunes and its application to barchan dunes