A numerical model of a solar flare based on electron beam heating of the chromosphere