A dynamical model of the coral-algae competition in a coral reef ecosystem