Numerical studies of flame acceleration and onset of detonation in homogenous and inhomogeneous mixture