Flow effects on the morphology and dynamics of aeolian and subaqueous barchan dunes