We present a numerical study of the cosmic density versus velocity divergence relation (DVDR) in the mildly non-linear regime. We approximate the dark matter as a non-relativistic pressureless fluid, and solve its equations of motion on a grid fixed in comoving coordinates. Unlike N-body schemes, this method yields directly the volume-averaged velocity field. The results of our simulations are compared with the predictions of the third-order perturbation theory (3PT) for the DVDR. We investigate both the mean ‘forward’ relation (density in terms of velocity divergence) and the mean ‘inverse’ relation (velocity divergence in terms of density), with emphasis on the latter. On scales larger than about 20 Mpc, our code recovers the predictions of the 3PT remarkably well and significantly better than in recent N-body simulations. On scales of a few Mpc, the DVDR predicted by 3PT differs slightly from the simulated one. In particular, approximating the inverse DVDR by a third-order polynomial turns out to give a poor fit. We propose a simple analytical description of the inverse relation, which works well for mildly non-linear scales.