  The magnetic fields of interplanetary coronal mass ejections (ICMEs), which
originate close to the Sun in the form of a flux rope, determine their
geoeffectiveness. Therefore, robust flux rope-based models of CMEs are required
to perform magnetohydrodynamic (MHD) simulations aimed at space weather
predictions. We propose a modified spheromak model and demonstrate its
applicability to CME simulations. In this model, such properties of a simulated
CME as the poloidal and toroidal magnetic fluxes, and the helicity sign can be
controlled with a set of input parameters. We propose a robust technique for
introducing CMEs with an appropriate speed into a background, MHD solution
describing the solar wind in the inner heliosphere. Through a parametric study,
we find that the speed of a CME is much more dependent on its poloidal flux
than on the toroidal flux. We also show that the CME speed increases with its
total energy, giving us control over its initial speed. We further demonstrate
the applicability of this model to simulations of CME-CME collisions. Finally,
we use this model to simulate the 12 July 2012 CME and compare the plasma
properties at 1 AU with observations. The predicted CME properties agree
reasonably with observational data.
