Two-dimensional mathematical and numerical model for the dynamics of granular avalanches