A model for the geomagnetic field reversal rate and constraints on the heat flux variations at the core-mantle boundary