A toroidal modeling tool is developed to study the runaway electron (RE) avalanche production process in tokamak plasmas, by coupling the Rosenbluth–Putvinski avalanche model (Rosenbluth and Putvinski 1997 Nucl. Fusion 37 1355) with an n = 0 magneto-hydrodynamic (MHD) solver. Initial value numerical simulations are carried out for two DIII-D discharges with different plasma shapes (one near circular, and the other with high elongation). It is found that, assuming the same level of about 1% seed current level, the Rosenbluth–Putvinski model somewhat underestimates the RE plateau current for the circular-shaped plasma, as compared with that measured in DIII-D experiments. For an elongated, higher current plasma, simulations find strong runaway current avalanche production despite the lack of measured plateau RE current in experiments. A possible reason for this discrepancy is a lack of additional RE dissipation physics in the present two-dimensional model. Systematic scans of the plasma boundary shape, at fixed pre-disruption plasma current, find that the plasma elongation helps to reduce the RE avalanche production, confirming recent results obtained with an analytic model (Fülöp et al 2020 J. Plasma Phys. 86 474860101). The effect of the plasma triangularity (either positive or negative), on the other hand, has a minor effect. On the physics side, the avalanche process involves two competing mechanisms associated with the electric field. On the one hand, a stronger electric field produces a higher instantaneous avalanche growth rate. On the other hand, a fast growing RE current quickly reduces the fraction of the conduction current together with the electric field, and hence a faster dissipation of the poloidal flux. As a final result of these two dynamic processes, the runaway plateau current is not always the largest with the strongest initial electric field. These results lay the foundation for future self-consistent inclusion of the MHD dynamics and the RE amplification process.