The present work consists of two main parts: the first part deals with the simulation, with the aid of a modified version of the KIVA-II code, of the global combustion process in a compression ignition engine with direct injection; the second part describes the sensitivity of the code to spatial discretization. The results obtained from the-simulations of the entire analysis are discussed in relation to the experimental data relevant to a DI unit of medium displacement Ruggerini RP 170.The first part of this work describes some of the considerable changes made to the combustion model of the original KIVA-II code. These changes have remarkably improved the code's ability in simulating the overall combustion process. In particular, models were implemented to take into account the auto-ignition process delay, the diffusively controlled combustion and a transition criterion - based on a dynamic calculation of the delayed time - between the first phase of combustion, (kinetic control) and the diffusive control phase.The second part of this work analyses the sensitivity of the modified code to the variations of the refinement degree in the azimuthal direction of the mesh. This analysis is carried out by keeping all the parameters of the global combustion model - described in the first part of this work - constant. Both the fuel spray dynamics and the combustion phase are analysed in detail. A significant dependence upon the mesh is noticed, in relation both to the spray evolution and to the combustion process. In particular, by thickening the mesh, an increasing displacement of the simulated pressure profile by the experimental one has been noticed, while the trend of the pressure profile is still quite correct.