3D version of function to determin dt