A numerical model has been implemented and used for the simulation of the optical frequency combs generated by gain-switching single mode laser diodes, either free-running or subjected to optical injection. The dynamical model consists of three rate-equations including stochastic noise terms. An exhaustive comparison between the simulated and the experimental temporal profiles and optical spectra, generated in a wide range of switching and optical injection conditions has been performed. The range of the explored conditions leads to a variety of scenarios including actual combs and broad incoherent spectra, and frequencies in the range of, and well below, the relaxation oscillation frequencies. The detailed maps generated provide guidelines for selecting suitable operation conditions for specific comb characteristics. The excellent quantitative agreement found in the entire range of the explored operation conditions supports the validity of the model for the analysis of the comb generation mechanisms. The model has been used for ascertaining the role of the frequency chirp in the evolution of the comb spectra and discussing the physics underlying the effects of the optical injection.